Route branch-reconcile sub-agents by their issue's model:/effort: labels - #6386
Merged
Conversation
…els (#6373) The claim swarm's Phase B already routes each fan-out agent by its own issue's dispatch labels; branch-reconcile fans out over issue-derived branches the same way but always ran every sub-agent at the coordinator's own default model/effort, so a model:heavy redesign branch and four mechanical ones got identical routing. formatInFlightForPrompt now extracts the issue number from each branch name (claim/issue-<num> or cos/<task>/issue-<num>/<agent>, reusing issueNumberFromRef) and reads that issue's labels via the new getIssueDispatchHint (server/services/github.js) and dispatchHintFromLabels (server/lib/dispatchLabels.js, the read-side inverse of forgeDispatchLabels). A failed or empty lookup omits the line rather than blocking or reshaping reconciliation. The branch-reconcile prompt now also interpolates DISPATCH_HINT_FANOUT_GUIDANCE next to the fan-out instruction, telling the coordinator to route each sub-agent from its own branch's recommendation — bumped to PROMPT_VERSIONS v4 with the v3 default preserved in PREVIOUS_DEFAULT_PROMPTS so existing installs auto-upgrade.
Local review flagged the sequential await-in-loop: N issue-derived branches cost N gh round-trips in series instead of one parallel batch. Also clarifies why dispatchHintLineForBranch keeps its own .catch even though the real getIssueDispatchHint never rejects — the "a failed lookup must never block reconciliation" guarantee belongs to this call site, not to trusting the callee.
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.
Summary
branch-reconcile's coordinator fans out one sub-agent per in-flight branch but always ran every one at the run's own default model/effort, even when a branch's issue carriedmodel:/effort:dispatch labels a planner already chose.formatInFlightForPrompt(server/services/branchReconcile.js) now extracts the issue number from each issue-derived branch (claim/issue-<num>orcos/<task>/issue-<num>/<agent>, reusingissueNumberFromRef) and reads that issue's labels via a newgetIssueDispatchHint(server/services/github.js) +dispatchHintFromLabels(server/lib/dispatchLabels.js, the read-side inverse offorgeDispatchLabels). A failed or empty lookup omits the line rather than blocking or reshaping reconciliation.branch-reconciledefault prompt now interpolatesDISPATCH_HINT_FANOUT_GUIDANCE(imported verbatim, same constant the claim swarm's Phase B uses) next to the "spawn one sub-agent per branch" instruction, telling the coordinator to route each sub-agent by its own branch's recommendation and to name what it used per branch in its summary.PROMPT_VERSIONS['branch-reconcile']to v4 with the outgoing v3 default preserved inPREVIOUS_DEFAULT_PROMPTS, so installs holding the unmodified v3 prompt auto-upgrade.Test plan
cd server && npm test— full suite green (2007 files / 39930 tests).server/lib/dispatchLabels.test.js(dispatchHintFromLabels),server/services/github.test.js(getIssueDispatchHint),server/services/branchReconcile.test.js(per-branch dispatch-hint line: named branch,cos/.../issue-<num>/...branch, non-issue branch omits, neither-label omits, failed forge read omits without disturbing the rest of the block),server/services/taskPromptDefaults.test.js(v4 prompt-drift regression + snapshot).server/services/taskPromptDefaults/integrity.snapshot.jsonvianode scripts/regen-prompt-integrity-snapshot.js.Closes #6373