squad cast can't add a second member with the same role: the provenance "rename" heuristic matches on the exact role string

未关闭
#2,524 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

Start with packages/squad-sdk/src/casting/agent-provenance.ts around reconcileAgentProvenanceRegistry and the roleHints check, then trace how packages/squad-cli/src/cli/commands/cast.ts calls it. Check the cast command tests for repeated roles and rename behavior. Done means a new member can share an existing role without being mistaken for a rename, with the command’s rename behavior defined explicitly.

由索引模型根据 Issue 内容生成。

描述

bug

Version: CLI built from release/prepare-2.0.0-preview.5 @ 38d45d02 (package version 2.0.0-preview.6).

What happens

Casting a second member whose role string equals an existing active member's role is rejected:

D=$(mktemp -d); cd "$D"; git init -q
node <squad-cli>/dist/cli-entry.js init --roles --client copilot,claude
node <squad-cli>/dist/cli-entry.js cast --name Alpha --role "Test Engineer"   # ✓
node <squad-cli>/dist/cli-entry.js cast --name Beta  --role "Test Engineer"   # ✗
AgentProvenanceError: New agent id "beta" ambiguously resembles existing role owner(s) alpha; supply the existing stable id for a rename

Teams with two or more people in the same role (two Test Engineers, two Backend Engineers) can't be cast with squad cast. The only workaround is to invent a distinct role string for each member. This failure also leaves partial state behind; that's #2525.

Why it looks wrong

  • The docblock on reconcileAgentProvenanceRegistry says identity binds only through the explicit id: "Display name, role, labels, paths, and other incidental signals never establish identity." The roleHints check makes role establish (suspected) identity anyway.
  • The hint can't be followed from the CLI. squad cast derives the id from --name, and it has no way to "supply the existing stable id for a rename." Renaming Alpha to Beta and adding Beta as a new member look identical, so the heuristic blocks the add.

Expected

Adding a member with a new id and a new display name always adds a member, even when its role matches someone else's. A rename should be explicit, for example squad cast --rename <existing-id> --name <new-name>, or a dedicated squad rename. That would supply the existing id to reconcileAgentProvenanceRegistry. The ambiguity check could be dropped, or turned into an informational note ("Alpha already holds Test Engineer; adding Beta as a second one").

Source

  • packages/squad-sdk/src/casting/agent-provenance.ts, lines 1194–1203 (if (!previous) { const roleHints = ... record.role === role ...; throw ... }). The docblock contradicting it is at lines 1142–1148.
  • packages/squad-cli/src/cli/commands/cast.ts: updateCastingStateWithAgent (line 295) passes one candidate { id: slug, displayName, role, universe: 'cli-cast' } and has no rename input.

🤖 Generated with Claude Code

主要语言
TypeScript
星标
3.4k
派生
516
平均合并
1 天 15 小时
30 天内合并 PR
116

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/squad 的其他 Issue

查看 github/squad 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。