Skip to content

fix(coordinator): resolve all P1 coordinator bugs — externalized state, teamRoot, stale work, cleanup loops - #1132

Merged
bradygaster merged 4 commits into
devfrom
bradygaster/squad-p1-coordinator-bugs
May 19, 2026
Merged

bradygaster merged 4 commits into
devfrom
bradygaster/squad-p1-coordinator-bugs

Conversation

@bradygaster

Copy link
Copy Markdown
Collaborator

Summary

Fixes all 4 P1 coordinator bugs in a single coherent change to squad.agent.md (and all template copies).

Bugs Fixed

Issue Problem Fix
#1116 Externalized state not resolved → Init Mode New "State & Team Root Resolution" section reads config.json.stateLocation before mode check
#1127 teamRoot in config.json ignored → Init Mode in satellite repos Same section reads teamRoot; Worktree Awareness step 0 checks config overrides first
#1125 Agents working on stale/closed items New "WORK FRESHNESS" rule in spawn template — tracker is authoritative over local plan files
#1067 Infinite post-work cleanup loop (195+ tool calls) AFTER work is now best-effort with 80-call budget, explicit stop-on-failure, Scribe-only skill extraction

Changes

  • .github/agents/squad.agent.md — all 4 fixes
  • .squad-templates/squad.agent.md — mirror
  • packages/squad-cli/templates/squad.agent.md.template — mirror
  • packages/squad-sdk/templates/squad.agent.md.template — mirror
  • templates/squad.agent.md.template — mirror

How to test

  1. fix(coordinator): squad.agent.md does not resolve externalized state — always enters Init Mode #1116/Coordinator agent (squad.agent.md) ignores .squad/config.json teamRoot — satellite/linked repos trigger Init Mode every session #1127: squad init --mode remote <path> in a fresh repo, then start a Copilot session — coordinator should find the team via config.json redirect instead of entering Init Mode.
  2. Agents Getting Lost - Working on old items #1125: Close all issues in a tracker, verify agents don't pick up stale local plan items.
  3. Bug: agents enter infinite post-work cleanup loop after completing primary task #1067: Spawn an agent and observe it completes post-work in <10 tool calls or stops on first failure.

Notes

Closes #1116, Closes #1127, Closes #1125, Closes #1067

Copilot AI added 2 commits May 18, 2026 15:57
…nd cleanup loops

Addresses all 4 P1 coordinator bugs:

- #1116: Add State & Team Root Resolution section before mode-switch check.
  Reads config.json stateLocation/teamRoot before deciding Init vs Team mode.
- #1127: Worktree Awareness step 0 checks config.json overrides first,
  so satellite/linked repos correctly resolve their remote team root.
- #1125: Add WORK FRESHNESS rule to spawn template — external tracker is
  authoritative, agents must verify against it before working on items.
- #1067: Make AFTER work best-effort with tool call budget (80 max),
  explicit stop-on-failure, and Scribe-only skill extraction.

Closes #1116, Closes #1127, Closes #1125, Closes #1067

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 18, 2026 22:57

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.

Pull request overview

Updates the Squad coordinator agent governance file (squad.agent.md) and all four template mirrors with prompt-level instructions to fix four P1 coordinator behaviors: externalized-state resolution (#1116), satellite teamRoot redirect (#1127), tracker-authoritative work freshness (#1125), and a bounded, best-effort post-work cleanup phase (#1067).

Changes:

  • Adds a "State & Team Root Resolution" section before the Init/Team mode check, plus a step 0 in the Worktree Awareness algorithm to honor config.json stateLocation/teamRoot overrides.
  • Adds a "WORK FRESHNESS" rule to the spawn prompt declaring the external tracker authoritative over local plan/checkbox files.
  • Reworks the spawn prompt's "AFTER work" section into a best-effort phase with an 80 tool-call budget, stop-on-failure semantics, and Scribe-only skill extraction (removes the git-notes decision-write step in the git-notes branch).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/agents/squad.agent.md Runtime coordinator prompt: all four fixes applied.
.squad-templates/squad.agent.md Canonical template mirror of the runtime file.
templates/squad.agent.md.template Top-level template mirror.
packages/squad-cli/templates/squad.agent.md.template CLI-package template mirror.
packages/squad-sdk/templates/squad.agent.md.template SDK-package template mirror.
.changeset/fix-p1-coordinator-bugs.md Patch changeset for @bradygaster/squad-cli describing the fix.

@bradygaster
bradygaster requested a review from tamirdresher May 19, 2026 05:42
Comment thread .github/agents/squad.agent.md Resolved
Comment thread .github/agents/squad.agent.md Resolved
Comment thread .squad-templates/squad.agent.md Resolved
Copilot AI added 2 commits May 18, 2026 22:59
The git note was inadvertently removed when fixing the infinite cleanup
loop (#1067). Restore it as a single-attempt, no-retry instruction so it
still annotates the commit when it succeeds but cannot cause retry loops.

Closes #1067

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses reviewer feedback that a hard 80-call session budget could clip
legitimate primary work in complex tasks. The budget now applies only to
post-work hygiene (max 20 calls), and agents skip post-work entirely if
they've already used 60+ calls on primary work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster
bradygaster merged commit ecf5b65 into dev May 19, 2026
6 checks passed
@bradygaster
bradygaster deleted the bradygaster/squad-p1-coordinator-bugs branch August 8, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants