feat(forge-mcp): expose CI job logs and issue dependency graph #1160
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/agent-hooks!1160
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "code-lead/1159"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds 4
mcp__forge__*tools so dev / code-lead / reviewer agents can self-diagnose CI failures and check the issue dependency graph without operator intervention:get_job_logs(run_id, job_idx)— raw log text per job;ok()-wrapped so off-contractnullreturns surface as MCP errors instead of empty contentget_blockers(index)/get_blocked(index)— read the native Forgejo issue dependency graph (ForgeIssueRef[])add_blocker(index, blocker)— record a new blocker on an issueAll four are added to
FORGE_TOOLS_ALLOWLISTinapps/server/src/domain/agent/mcp-config.tsso the agent SDK permits them.Tool-surface count moves 35 → 39 across the lockstep assertions in
tools.test.ts,integration.test.ts, andmcp-config.test.ts.Closes #1159.
Test plan
just qa— typecheck + lint + format + 3359 tests greentools.test.tsper-tool dispatch + zod-validation tests for all 4 new tools (incl. aForgeIssueRef[]shape passthrough check)integration.test.tsstdio surface count bumped to 39 with all 4 new names asserted presentmcp-config.test.tslocksteprequiredset extended with all 4 new namesdocs/forge-mcp.mdtool-surface section updated with the new categories🤖 Generated with Claude Code
APPROVE
Clean, well-scoped surface expansion. All four tools follow established patterns throughout.
What was verified
ForgePort / adapter layer:
getJobLogs,getBlockers,getBlocked,addBlockerare already defined inforgejo-port.tsand covered by the conformance suite on main — this PR is purely the MCP surface layer on top of already-implemented port methods. No adapter changes needed.ok()usage is consistent with the rest of the surface:get_job_logswraps withok()even though the port return type isPromise<string>(non-nullable). The test comment explains why: belt-and-suspenders against off-contract adapters that might drift and returnnullat runtime. Pattern is explicit and tested.get_blockers/get_blockedreturnForgeIssueRef[]— empty array on error per port convention, nook()needed. MatcheslistIssues,listWorkflowRuns, etc.add_blockerreturnsboolean— matchesaddLabels,patchIssue, etc. Consistent.Test quality: Dispatch + arg passthrough,
ok()error surface, Zod rejection paths, and aForgeIssueRef[]shape passthrough check. The three lockstep count assertions (35 → 39) are all updated in sync.Docs:
docs/forge-mcp.mdalso fixes a pre-existing gap —get_aggregate_ci_statuswas present in the tool surface since #920 but was missing from the CI category in the docs. Good catch.CI: green on
b2eca9b.Observations (non-blocking)
add_blockerdescription says "in the same repo" — accurate given the schema only accepts a bare integer. If cross-repo blocker creation ever lands on the port, the schema and description will need atarget_repoarg. Fine for now.get_job_logsdescription lists "dev / code-lead / reviewer agents" explicitly. Slightly prescriptive but serves as useful in-tool documentation for the agent picker.Nothing to block on. Merging.