feat(orch): worker-authored result handoff via report_result tool#18
Merged
Conversation
ee9d1fe to
f69a75b
Compare
Workers now choose what gets relayed to the manager instead of leaving it to a scrape of the last TUI pane. A new report_result MCP tool records an authoritative HandoffSummary — the worker's findings/outcome, optionally its diff vs base, and optionally inlined notes — which is preferred over the scraped LatestSummary everywhere a worker's result is surfaced (completion notification, manager context, supervisor snapshot). Why: a reviewer worker produced a full review (findings with file:line refs), but the manager received only a teaser. The handoff was scraped from the visible Codex TUI pane and truncated at 2000 BYTES; the pane's box-drawing separators (3 bytes each) meant only ~1050 characters survived, and head-anchored truncation kept the build-log preamble while dropping the findings that started at char 1188. The manager then wasted a follow-up worker re-deriving them. Also fixes latent over-permissioning: pr_followup/ci_followup workers shared the FULL manager MCP surface, so they could spawn_session, publish_pr, mark_objective_done, or cancel_session — none of which a worker should do. Tools are now split into three role-scoped surfaces. - New Forge.Diff (GitForge runs git diff vs resolved base, led by --stat; Fake is seedable) so report_result can attach the worker's changes. - Session.HandoffSummary column + idempotent migration for existing DBs. - Three MCP surfaces, each exposing exactly its tools: manager (/mcp/, full), follow-up (/fmcp/: update_pr/comment_pr/create_note/ask_user/report_result), coding worker (/wmcp/: report_result/create_note/ask_user). Tool defs factored into shared per-tool constructors. - Worker + follow-up preambles instruct calling report_result before the done marker. - Fallback scrape (LatestSummary) is now rune-safe and tail-anchored, so the conclusion survives even when a worker doesn't report. Tests: report_result summary/diff/notes/empty-diff/required-summary, relay preference order, tail truncation, GitForge.Diff, and a surface-scoping test asserting workers/follow-ups never see the manager-only tools. vet + gofmt + -race clean.
f69a75b to
6d095ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Workers now choose what gets relayed to their manager via a new
report_resultMCP tool, instead of the manager receiving a scrape of the worker's last TUI pane.Why
A reviewer worker (real incident, manager
4fb7acff) produced a complete review — findings withfile:linerefs and the verification commands it ran — but the manager received only a teaser ("…I'm preparing the final review…") and then wasted a follow-up worker re-deriving the findings.Root cause was the relay, not the agent:
─separators, footer, input prompt).Changes
report_result(summary, include_diff?, notes?)— worker-authored handoff stored in a newSession.HandoffSummary, preferred over the scrapedLatestSummaryeverywhere a worker's result is surfaced (completion notification, manager context, supervisor snapshot).include_diffcapturesgit diffvs base (committed + uncommitted) from the worker's checkout, run on its own target, led by a--statso a truncated diff still names files.notesinlines referencedcreate_notebodies (shared-memory notes don't otherwise reach the manager)./mcp/, full surface/fmcp/:update_pr,comment_pr,create_note,ask_user,report_result/wmcp/:report_result,create_note,ask_userpr_followup/ci_followupworkers previously shared the full manager surface, so they couldspawn_session,publish_pr,mark_objective_done, orcancel_session— none of which a worker should do. They now get the scoped follow-up surface.Forge.Diffmethod (GitForge runsgit diffvs resolved base; Fake is seedable).handoff_summarycolumn + idempotent migration for existing DBs.report_result(with real findings, not a teaser) before the done marker.LatestSummaryis now rune-safe and tail-anchored, so the conclusion survives even when a worker doesn't report.Tests
report_result(summary / diff / notes / empty-diff / required-summary), relay preference order, tail-truncation rune-safety,GitForge.Diff, and a surface-scoping test asserting workers/follow-ups never see the manager-only tools.go vet,gofmt, andgo test -race ./...all clean.