Skip to content

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

Description

@atomantic

branch-reconcile is the repo's second fan-out orchestrator — it spawns one sub-agent per in-flight branch, in parallel, and every branch it hands out is an issue-derived ref (claim/issue-<num>, cos/<task>/issue-<num>/<agent>). It is the same shape as the claim swarm's Phase B, but it dispatches all of its sub-agents at the coordinator's own default model and effort.

Issues carry model: / effort: dispatch labels that a planner chose after reading the code. The claim swarm now routes each fan-out agent by its own issue's labels (DISPATCH_HINT_FANOUT_GUIDANCE in server/lib/dispatchLabels.js, wired into resolveSwarmBlock in server/services/cosTaskPreStepBlocks.js). A reconcile batch containing one model:heavy redesign branch alongside four mechanical ones still routes all five identically.

Scope

  1. Carry the labels into the prompt. formatInFlightForPrompt (server/services/branchReconcile.js) renders one block per branch (state, PR, worktree, drift, collision paths, Do:) and never fetches issue labels. Extract the issue number from the branch name with the same rule the claim flow uses — the claim/issue-<num> segment, or the issue-<num> third segment of cos/<task>/issue-<num>/<agent> — then read that issue's labels from the forge and add a per-branch line naming the recommended model: / effort: when either is present. Omit the line entirely when the branch is not issue-derived or the lookup fails; a failed label read must never block or reshape reconciliation.
  2. Add the routing contract to the prompt body. Interpolate DISPATCH_HINT_FANOUT_GUIDANCE into the branch-reconcile prompt in server/services/taskPromptDefaults/prompts.js, next to the existing "Spawn ONE sub-agent per branch" instruction, and tell the coordinator to name the model/effort it used per branch in its summary — the same reporting requirement the swarm block carries.
  3. Ship the prompt change properly. A prompts.js edit needs a PROMPT_VERSIONS bump plus the prior default preserved in PREVIOUS_DEFAULT_PROMPTS (server/services/taskPromptDefaults/), so installs whose stored prompt still matches the old default auto-upgrade.

Acceptance

  • A branch derived from an issue labeled model:heavy renders that recommendation in its block; an unlabeled or non-issue branch renders no extra line.
  • A forge label lookup that fails leaves the reconcile prompt byte-identical to today's, minus the guidance block.
  • The prompt carries DISPATCH_HINT_FANOUT_GUIDANCE verbatim (imported, not retyped) so the reading vocabulary cannot drift from the writing vocabulary.
  • PROMPT_VERSIONS bumped and the previous default recorded; the prompt-drift suite passes.

Files

  • server/services/branchReconcile.js (formatInFlightForPrompt, ~line 1457)
  • server/services/taskPromptDefaults/prompts.js (branch-reconcile, the "Spawn ONE sub-agent per branch" line)
  • server/services/taskPromptDefaults/versions.js + previousDefaults.js
  • server/lib/dispatchLabels.js (consume DISPATCH_HINT_FANOUT_GUIDANCE; no change needed there)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cos-agentsChief-of-Staff autonomous agentseffort:mediumEffort: mediummodel:mediumModel size: mediumplanTracked by /do:replanplanner:opus-5Plan authored by the opus-5 model

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions