Skip to content

fix(coordinator): restore mandatory dispatch contract - #1969

Open
tamirdresher wants to merge 2 commits into
bradygaster:devfrom
tamirdresher:tamirdresher-microsoft-squad-dispatch-regression
Open

fix(coordinator): restore mandatory dispatch contract#1969
tamirdresher wants to merge 2 commits into
bradygaster:devfrom
tamirdresher:tamirdresher-microsoft-squad-dispatch-regression

Conversation

@tamirdresher

@tamirdresher tamirdresher commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • restore a narrow, mandatory Direct Mode boundary so code, tests, analysis, docs, configuration, and other domain work always dispatch
  • refuse domain work when the client exposes no dispatch tool instead of silently falling back to inline execution
  • start Scribe once on the first Team Mode turn, independent of whether another agent has already run
  • synchronize coordinator and routing templates across CLI, SDK, root, and dogfood copies
  • add semantic parity tests that prevent future template syncs from deleting the dispatch or Scribe bootstrap gates

Validation

  • npm run build
  • npm test -- --run test/coordinator-inline-dispatch-gate.test.ts test/template-sync.test.ts test/cli/init-upgrade-parity.test.ts (276 passed)

Closes #1231

⚠️ Needs Procedures (prompt architecture) and FIDO (quality) review before merging; both routed Squad attempts returned no work product, so the fix was completed directly.

Closes bradygaster#1231

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 1, 2026 07:54
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🟠 Impact Analysis — PR #1969

Risk tier: 🟠 HIGH

📊 Summary

Metric Count
Files changed 11
Files added 1
Files modified 10
Files deleted 0
Modules touched 6

🎯 Risk Factors

  • 11 files changed (6-20 → MEDIUM)
  • 6 modules touched (5-8 → HIGH)

📦 Modules Affected

ci-workflows (1 file)
  • .github/agents/squad.agent.md
root (3 files)
  • .changeset/restore-coordinator-dispatch-contract.md
  • templates/routing.md
  • templates/squad.agent.md.template
squad-cli (2 files)
  • packages/squad-cli/templates/routing.md
  • packages/squad-cli/templates/squad.agent.md.template
squad-sdk (2 files)
  • packages/squad-sdk/templates/routing.md
  • packages/squad-sdk/templates/squad.agent.md.template
templates (2 files)
  • .squad-templates/routing.md
  • .squad-templates/squad.agent.md
tests (1 file)
  • test/coordinator-inline-dispatch-gate.test.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit e7ecd5a

PR Scope: 🔧 Infrastructure

⚠️ 4 item(s) to address before review

Status Check Details
Single commit 2 commits — consider squashing before review
Not in draft Ready for review
Branch up to date Up to date with dev
Copilot review No Copilot review yet — it may still be processing
Changeset present Changeset file found
Scope clean No .squad/ or docs/proposals/ files
No merge conflicts No merge conflicts
Copilot threads resolved 1 unresolved Copilot thread(s) — fix and resolve before merging
CI passing 12 check(s) still running

Files Changed (11 files, +159 −50)

File +/−
.changeset/restore-coordinator-dispatch-contract.md +6 −0
.github/agents/squad.agent.md +18 −7
.squad-templates/routing.md +1 −1
.squad-templates/squad.agent.md +18 −7
packages/squad-cli/templates/routing.md +1 −1
packages/squad-cli/templates/squad.agent.md.template +18 −7
packages/squad-sdk/templates/routing.md +1 −1
packages/squad-sdk/templates/squad.agent.md.template +18 −7
templates/routing.md +1 −1
templates/squad.agent.md.template +18 −7
test/coordinator-inline-dispatch-gate.test.ts +59 −11

Total: +159 −50


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It changes always-on coordinator prompt architecture and session bootstrapping semantics, which warrants specialist review despite tests.

Review tier: Lite
Findings: 2 Low severity

New issues introduced by this change (2)
Severity Finding
Low severity test/​coordinator-inline-dispatch-gate.test.ts — The header comment claims this test enforces "byte-level PARITY across all 5 synced copies", but…
Low severity .squad-templates/​squad.agent.md — This client-surface summary omits Copilot App behavior even though the inline-dispatch gate now…
What changed in this PR

Restores a strict “dispatch-required” boundary in the coordinator template (removing inline fallback when no dispatch tools exist), adds a mandatory first-Team-Mode Scribe bootstrap, and hardens template synchronization with regression tests to prevent these gates from being removed or relocated again.

Changes:

  • Tighten coordinator guidance: domain work must dispatch via create_session/task/runSubagent, otherwise refuse (Direct Mode only for brief in-context facts/questions).
  • Introduce an always-on “Session Init — Scribe Bootstrap” requirement and update routing templates to reflect “start once at beginning of Team Mode.”
  • Expand regression tests to enforce semantic parity for the dispatch contract + Scribe bootstrap across synced template copies.
File Description
test/​coordinator-inline-dispatch-gate.test.ts Adds assertions for the mandatory dispatch contract + Scribe bootstrap + routing parity across synced copies.
.squad-templates/​squad.agent.md Canonical coordinator template updated with mandatory dispatch contract, refusal on missing spawn tools, and first-turn Scribe bootstrap.
templates/​squad.agent.md.template Synced coordinator template copy updated to match the canonical contract and gates.
.github/​agents/​squad.agent.md Dogfood agent template updated to match the canonical dispatch + Scribe gates.
packages/​squad-cli/​templates/​squad.agent.md.template CLI template copy updated to match the canonical dispatch + Scribe gates.
packages/​squad-sdk/​templates/​squad.agent.md.template SDK template copy updated to match the canonical dispatch + Scribe gates.
.squad-templates/​routing.md Updates routing rule to reflect “Scribe starts once at beginning of Team Mode session.”
templates/​routing.md Synced routing template copy updated with the new Scribe rule.
packages/​squad-cli/​templates/​routing.md CLI routing template copy updated with the new Scribe rule.
packages/​squad-sdk/​templates/​routing.md SDK routing template copy updated with the new Scribe rule.
.changeset/​restore-coordinator-dispatch-contract.md Adds a patch changeset for CLI/SDK reflecting the restored dispatch contract and Scribe bootstrap.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +14 to 16
* This test pins the always-on dispatch contract into the canonical coordinator
* template AND asserts byte-level PARITY across all 5 synced copies so a future
* size-reduction refactor cannot silently relocate them again:
Comment on lines 437 to +439
Detect the client surface once per session and adapt spawning behavior accordingly: CLI uses `task`/`read_agent`, VS Code uses `runSubagent`.

**Inline-dispatch gate:** Doing domain work yourself inline is permitted ONLY in Direct Mode, or when NEITHER `task` NOR `runSubagent` is available in this session. In every other case you MUST dispatch — `task` on CLI, `runSubagent` on VS Code. Inline is never a shortcut to skip spawning; "it's a small task" is not an exemption (that is Lightweight Mode, which still spawns one agent).
**Inline-dispatch gate:** Doing domain work yourself inline is permitted ONLY in Direct Mode. Otherwise you MUST dispatch through `create_session`, `task`, or `runSubagent`; if none is available, refuse domain work. Inline is never a shortcut to skip spawning, and "it's a small task" is not an exemption (that is Lightweight Mode, which still spawns one agent).
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.

Agent reverts to single-threaded execution despite Squad infrastructure — behavioral persistence gap

4 participants