Skip to content

Route branch-reconcile sub-agents by their issue's model:/effort: labels - #6386

Merged
atomantic merged 2 commits into
mainfrom
claim/issue-6373
Sep 6, 2026
Merged

Route branch-reconcile sub-agents by their issue's model:/effort: labels#6386
atomantic merged 2 commits into
mainfrom
claim/issue-6373

Conversation

@atomantic

Copy link
Copy Markdown
Owner

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 carried model:/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> or cos/<task>/issue-<num>/<agent>, reusing issueNumberFromRef) and reads that issue's labels via a new getIssueDispatchHint (server/services/github.js) + 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 default prompt now interpolates DISPATCH_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.
  • Bumped PROMPT_VERSIONS['branch-reconcile'] to v4 with the outgoing v3 default preserved in PREVIOUS_DEFAULT_PROMPTS, so installs holding the unmodified v3 prompt auto-upgrade.

Test plan

  • cd server && npm test — full suite green (2007 files / 39930 tests).
  • New/updated unit 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).
  • Regenerated server/services/taskPromptDefaults/integrity.snapshot.json via node scripts/regen-prompt-integrity-snapshot.js.

Closes #6373

…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.
@atomantic
atomantic merged commit 437ef19 into main Sep 6, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6373 branch September 6, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Route branch-reconcile sub-agents by their issue's model:/effort: labels

1 participant