squad cast is not atomic: a failed AgentProvenanceError cast leaves an orphan member in team.md, routing.md and .squad/agents/
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
調査の方向性
Start with packages/squad-cli/src/cli/commands/cast.ts and trace runCastAdd through updateCastingStateWithAgent; read the registry reconciliation in packages/squad-sdk/src/casting/agent-provenance.ts and the caller in packages/squad-cli/src/cli-entry.ts. Check how existing cast and doctor tests cover failure handling. Done means a rejected cast leaves no partial member files or roster entries, reports a concise error, and squad doctor detects roster members missing from the registry.
索引モデルが issue の本文から書いたものです。
説明
Version: CLI built from release/prepare-2.0.0-preview.5 @ 38d45d02 (package version 2.0.0-preview.6), macOS, Node.
What happens
squad cast --name <name> --role <role> writes the member's charter, history, team.md row and routing.md row before it updates the casting registry. When the registry update throws AgentProvenanceError, nothing is rolled back. The command exits 1 with a raw stack trace. The project is left with a member that is on the roster and in routing but not in .squad/casting/registry.json.
Retrying doesn't help. Without --force, it stops at "already exists". With --force, it hits the same AgentProvenanceError. The next squad upgrade then projects the orphan into .claude/agents/<id>.md, and squad doctor reports all checks passing.
Repro
D=$(mktemp -d); cd "$D"; git init -q
node <squad-cli>/dist/cli-entry.js init --roles --client copilot,claude
git add -A && git commit -qm init
node <squad-cli>/dist/cli-entry.js cast --name Alpha --role "Test Engineer" # ok
git add -A && git commit -qm alpha
node <squad-cli>/dist/cli-entry.js cast --name Beta --role "Test Engineer" # fails (see #2524)
echo $? # 1
git status --short
Output of the failing cast (stack trace printed verbatim to the user):
AgentProvenanceError: New agent id "beta" ambiguously resembles existing role owner(s) alpha; supply the existing stable id for a rename
at reconcileAgentProvenanceRegistry (.../squad-sdk/dist/casting/agent-provenance.js:963:23)
at updateCastingStateWithAgent (.../squad-cli/dist/cli/commands/cast.js:273:26)
at async runCastAdd (.../squad-cli/dist/cli/commands/cast.js:341:5)
...
git status after the failure:
M .squad/routing.md # + | Test Engineer | Beta | — |
M .squad/team.md # + | Beta | Test Engineer | `.squad/agents/beta/charter.md` | ✅ Active |
?? .squad/agents/beta/ # charter.md, history.md
.squad/casting/registry.json has no beta entry, and .squad/config.json is not updated either, because addAgentToConfig runs after the throw.
Then:
node <squad-cli>/dist/cli-entry.js cast --name Beta --role "Test Engineer" # ✗ Agent "Beta" already exists ... (use --force)
node <squad-cli>/dist/cli-entry.js cast --name Beta --role "Test Engineer" --force # same AgentProvenanceError
node <squad-cli>/dist/cli-entry.js upgrade # ✓ created .claude/agents/beta.md
node <squad-cli>/dist/cli-entry.js doctor # Summary: 13 passed, 0 failed, 0 warnings
Expected
- The cast either completes or changes nothing. Validate against the casting registry first (or stage everything and commit last), so a provenance rejection leaves
team.md,routing.md,.squad/agents/and.claude/agents/untouched. AgentProvenanceErroris shown as a one-line✗error with a hint, not an uncaught stack trace.squad doctorflags roster members (team.mdrows or.squad/agents/*/charter.md) that are missing from the casting registry.
Source
packages/squad-cli/src/cli/commands/cast.ts,runCastAdd(line 362). The order is: charter and history written (line 407),updateTeamMdWithAgent(412),ensureBuiltinRoster,updateRoutingMdWithAgent, and only thenupdateCastingStateWithAgent(415), which callsreconcileAgentProvenanceRegistry(line 319).packages/squad-sdk/src/casting/agent-provenance.ts, line 1194–1203: the throw site.- The CLI caller in
packages/squad-cli/src/cli-entry.ts(line ~922) doesn't catchAgentProvenanceError.
Related: #2524 (root cause of this particular rejection: two members can't share a role).
🤖 Generated with Claude Code
- 主要言語
- TypeScript
- スター
- 3.4k
- フォーク
- 516
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 116
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/squad のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bot:ai-assisted component:platform-js status:untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
midnightntwrk/platform-js#38 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ranxianglei/billion-context#7068 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mybigday/whisper.rn#348 ·
-
enhancement severity:low
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Battle-Cattle/BCUK-Bot-4#1075 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
ilan-pinto/roaring-lions#1552 ·
メンテナーはふだん 1 日以内に返信