Skip to content

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

Open
tamirdresher wants to merge 1 commit into
github:devfrom
tamirdresher:tamirdresher-microsoft-squad-dispatch-regression
Open

tamirdresher wants to merge 1 commit into
github: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.

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 25
Files added 1
Files modified 24
Files deleted 0
Modules touched 8

🎯 Risk Factors

  • 25 files changed (21-50 → HIGH)
  • 8 modules touched (5-8 → HIGH)

📦 Modules Affected

ci-workflows (1 file)
  • .github/agents/squad.agent.md
copilot-config (1 file)
  • .copilot/skills/client-compatibility/SKILL.md
docs (1 file)
  • docs/src/content/docs/scenarios/client-compatibility.md
root (6 files)
  • .changeset/restore-coordinator-dispatch-contract.md
  • templates/client-compatibility-reference.md
  • templates/routing.md
  • templates/skills/client-compatibility/SKILL.md
  • templates/spawn-reference.md
  • templates/squad.agent.md.template
squad-cli (5 files)
  • packages/squad-cli/templates/client-compatibility-reference.md
  • packages/squad-cli/templates/routing.md
  • packages/squad-cli/templates/skills/client-compatibility/SKILL.md
  • packages/squad-cli/templates/spawn-reference.md
  • packages/squad-cli/templates/squad.agent.md.template
squad-sdk (5 files)
  • packages/squad-sdk/templates/client-compatibility-reference.md
  • packages/squad-sdk/templates/routing.md
  • packages/squad-sdk/templates/skills/client-compatibility/SKILL.md
  • packages/squad-sdk/templates/spawn-reference.md
  • packages/squad-sdk/templates/squad.agent.md.template
templates (5 files)
  • .squad-templates/client-compatibility-reference.md
  • .squad-templates/routing.md
  • .squad-templates/skills/client-compatibility/SKILL.md
  • .squad-templates/spawn-reference.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 c114e5f

PR Scope: 🔧 Infrastructure

⚠️ 2 item(s) to address before review

Status Check Details
✅ Single commit 1 commit — clean history
✅ 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 0 active Copilot thread(s) resolved (2 outdated skipped)
❌ CI passing 4 check(s) still running

Files Changed (25 files, +306 −123)

File +/−
.changeset/restore-coordinator-dispatch-contract.md +6 −0
.copilot/skills/client-compatibility/SKILL.md +11 −8
.github/agents/squad.agent.md +19 −8
.squad-templates/client-compatibility-reference.md +6 −4
.squad-templates/routing.md +1 −1
.squad-templates/skills/client-compatibility/SKILL.md +11 −8
.squad-templates/spawn-reference.md +1 −1
.squad-templates/squad.agent.md +19 −8
docs/src/content/docs/scenarios/client-compatibility.md +10 −6
packages/squad-cli/templates/client-compatibility-reference.md +6 −4
packages/squad-cli/templates/routing.md +1 −1
packages/squad-cli/templates/skills/client-compatibility/SKILL.md +11 −8
packages/squad-cli/templates/spawn-reference.md +1 −1
packages/squad-cli/templates/squad.agent.md.template +19 −8
packages/squad-sdk/templates/client-compatibility-reference.md +6 −4
packages/squad-sdk/templates/routing.md +1 −1
packages/squad-sdk/templates/skills/client-compatibility/SKILL.md +11 −8
packages/squad-sdk/templates/spawn-reference.md +1 −1
packages/squad-sdk/templates/squad.agent.md.template +19 −8
templates/client-compatibility-reference.md +6 −4
templates/routing.md +1 −1
templates/skills/client-compatibility/SKILL.md +11 −8
templates/spawn-reference.md +1 −1
templates/squad.agent.md.template +19 −8
test/coordinator-inline-dispatch-gate.test.ts +108 −13

Total: +306 −123


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 thread .squad-templates/squad.agent.md Resolved

@bradygaster bradygaster left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Deep review — PR #1969 (fix(coordinator): restore mandatory dispatch contract)

Verdict: REQUEST CHANGES — the fix is incomplete: it hardens the always-on squad.agent.md copies but leaves a lazy-loaded reference file with directly contradictory guidance that can silently reintroduce the exact regression this PR closes.

Findings

  1. [High] client-compatibility-reference.md still tells the coordinator to work inline on fallback — contradicts the new refusal contract, in all 4 synced copies.

    • Files: .squad-templates/client-compatibility-reference.md:11-15, templates/client-compatibility-reference.md:15, packages/squad-cli/templates/client-compatibility-reference.md:15, packages/squad-sdk/templates/client-compatibility-reference.md:15
    • squad.agent.md now says (this PR): "None available: refuse domain work ... Never fall back to doing domain work inline." But the on-demand reference the coordinator is explicitly pointed to for "platform detection" (squad.agent.md → "On-demand reference: Read .squad/templates/client-compatibility-reference.md for platform detection...") still says: "3. Fallback mode — neither task nor runSubagent/agent available → work inline. Do not apologize or explain the limitation. Execute the task directly." Its Platform Detection list also never mentions Copilot App / create_session at all (only CLI/VS Code/Fallback), so an agent that consults this reference for App-mode detection gets an incomplete, contradictory picture.
    • This is the same file the new test's own root-cause docstring names as part of where the original #1035 regression hid, yet coordinator-inline-dispatch-gate.test.ts adds no assertion against it — so nothing prevents an agent (or a future refactor) from following the stale "work inline" instruction here and reintroducing #1231/#1035.
    • Same stale text ("Fallback mode — Neither task nor runSubagent available / Work inline without delegation / Execute the task directly") is duplicated in docs/src/content/docs/scenarios/client-compatibility.md:230-233.
    • Fix: update the Platform Detection / Fallback mode section in all 4 template copies (+ docs page) to add the App/create_session path and change Fallback mode to refuse domain work, matching squad.agent.md. Extend the regression test to cover this file so it can't drift again.
  2. [Low, valid — unresolved Copilot thread] test/coordinator-inline-dispatch-gate.test.ts:16 — the docstring claims this file "asserts byte-level PARITY across all 5 synced copies," but its assertions (assertGateBody/assertMandatoryContract/assertScribeBootstrap) are regex/pattern-based semantic checks, not byte comparisons; actual byte-for-byte parity is enforced separately by template-sync.test.ts. Reword to avoid overstating this file's guarantee.

  3. [Low, valid — unresolved Copilot thread] .squad-templates/squad.agent.md:439 — the "### Client Compatibility" intro ("CLI uses task/read_agent, VS Code uses runSubagent") still omits the Copilot App/create_session path introduced two sections above in this same PR, for the same contract. Pre-existing line, but now inconsistent with the dispatch mechanism this PR just expanded to 3 platforms.

Evidence checked

  • Full diff 5ab85b4f...pr-1969 (11 files, +159/-50); all 5 squad.agent.md copies confirmed byte-identical to canonical; all 4 routing.md copies consistent; changeset present and correctly scoped (patch, CLI+SDK).
  • mergeStateStatus: BEHIND is cosmetic — git merge-base pr-1969 origin/dev equals dev HEAD, so the branch already contains all of dev's tip; no real divergence.
  • All CI checks green (build, tests incl. coordinator-inline-dispatch-gate.test.ts/template-sync.test.ts/init-upgrade-parity.test.ts, prompt-size report, bootstrap/scope/security/architectural gates).
  • Both existing Copilot review threads are unresolved and, on inspection, valid (items 2–3 above); treated as untrusted input but independently verified against the diff.
  • Scribe bootstrap semantics (App/CLI use task, not create_session, since Scribe doesn't produce commits) are internally consistent with the pre-existing "Sub-session rules (App mode only)" split.

Blockers to merge

  • Finding 1 must be resolved (or explicitly scoped out with a tracked follow-up and no lingering "work inline" text) before this can land, since it re-opens the exact failure mode the PR is titled to fix.
  • Findings 2–3 should be addressed in the same pass since they're already flagged, unresolved, and cheap to fix.

@bradygaster bradygaster left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed the current diff and cannot approve this yet. Please rebase onto dev, resolve the two remaining review threads, and update all synchronized client-compatibility-reference.md copies so fallback guidance matches the restored mandatory dispatch contract. The current branch still leaves contradictory inline-fallback instructions in the repository.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 💬 1 unresolved review thread(s) (1 from Copilot). Address and resolve them.
  • 🔄 Changes requested by @bradygaster. Address their feedback and request re-review.
  • ⬇️ 59 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 💬 1 unresolved review thread(s) (1 from Copilot). Address and resolve them.
  • 🔄 Changes requested by @bradygaster. Address their feedback and request re-review.
  • ⬇️ 93 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 10 days.

What needs attention:

  • 💬 1 unresolved review thread(s) (1 from Copilot). Address and resolve them.
  • 🔄 Changes requested by @bradygaster. Address their feedback and request re-review.
  • ⬇️ 242 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🏗️ Architectural Review

Authoritative evidence: base-controlled pull_request_target reporter.

⚠️ Architectural review: 1 warning(s).

Severity Category Finding Files
🟡 warning sweeping-refactor This PR touches 25 files (25 modified/added, 0 deleted). Large PRs are harder to review — consider splitting if possible. —

Automated architectural review — informational only.

@bradygaster
bradygaster self-requested a review October 8, 2026 03:33
@tamirdresher
tamirdresher force-pushed the tamirdresher-microsoft-squad-dispatch-regression branch from 9590694 to 320fd3e Compare October 14, 2026 13:50
- Re-embed the inline-dispatch gate, STOP gate, VS Code runSubagent micro-playbook, and first-turn Scribe bootstrap in squad.agent.md
- Align client-compatibility-reference.md, spawn-reference.md, client-compatibility SKILL.md, and docs with Copilot App (create_session) and non-spawning refusal rules
- Add regression test suite in test/coordinator-inline-dispatch-gate.test.ts enforcing semantic/pattern parity across all synced copies

Closes github#1231

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5cf0811c-a02a-41a7-ab00-904b6900db7b
@tamirdresher
tamirdresher force-pushed the tamirdresher-microsoft-squad-dispatch-regression branch from 320fd3e to c114e5f Compare October 14, 2026 13:56
@tamirdresher

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest dev (5cd199c) as a single clean commit (c114e5f) and verified all review items:

  1. Updated .squad-templates/client-compatibility-reference.md and all synced copies ( emplates/, packages/squad-cli/templates/, packages/squad-sdk/templates/), .squad-templates/spawn-reference.md (+ synced copies), .squad-templates/skills/client-compatibility/SKILL.md (+ synced copies), and docs/src/content/docs/scenarios/client-compatibility.md to include Copilot App (create_session) and replace the inline fallback guidance with refusal when no dispatch tool is available.
  2. Expanded est/coordinator-inline-dispatch-gate.test.ts to assert client-compatibility-reference.md, spawn-reference.md, skills/client-compatibility/SKILL.md, and docs/src/content/docs/scenarios/client-compatibility.md do not contradict the inline-dispatch gate, and updated the header docstring to accurately describe semantic/pattern parity vs est/template-sync.test.ts byte-level parity.
  3. Updated ### Client Compatibility in .squad-templates/squad.agent.md (+ all 5 synced copies) to include Copilot App (create_session) alongside CLI ( ask/
    ead_agent) and VS Code (
    unSubagent), and resolved both Copilot review threads.

Ready for re-review @bradygaster.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 🔄 Changes requested by @bradygaster. Address their feedback and request re-review.
  • ⬇️ 16 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@joslat joslat mentioned this pull request Oct 25, 2026
12 of 13 tasks
@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 🔄 Changes requested by @bradygaster. Address their feedback and request re-review.
  • ⬇️ 60 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 🔄 Changes requested by @bradygaster. Address their feedback and request re-review.
  • ⬇️ 75 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

This branch has not been deployed

No deployments
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

3 participants