fix(coordinator): restore mandatory dispatch contract - #1969
fix(coordinator): restore mandatory dispatch contract#1969tamirdresher wants to merge 2 commits into
Conversation
Closes bradygaster#1231 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🟠 Impact Analysis — PR #1969Risk tier: 🟠 HIGH 📊 Summary
🎯 Risk Factors
📦 Modules Affectedci-workflows (1 file)
root (3 files)
squad-cli (2 files)
squad-sdk (2 files)
templates (2 files)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| 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.
There was a problem hiding this comment.
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
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
test/coordinator-inline-dispatch-gate.test.ts — The header comment claims this test enforces "byte-level PARITY across all 5 synced copies", but… |
|
.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.
| * 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: |
| 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). |

Summary
Validation
npm run buildnpm 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