fix(spawn): preserve role name as workerId; align skill text with built-in name - #1663
Conversation
…text resolveSpawnIdentity's non-UUID guard (introduced in 8886e5f to keep the canonical-lookup query from casting role-name strings to UUID) was minting a fresh UUID for `workerId` in its early-return. That UUID then propagated through findOrCreateAgent → registerSpawnWorker → hireAgent as both `custom_name` and `role`, which broke every `--to <role>` resolver tier (`exact id`, `dir:<name>`, `custom_name+team`, `role` all miss when custom_name is a UUID). Most visible on council teams: members listed by UUID instead of `council--architect`, etc. Fix: preserve `name` as `workerId` in the early-return. The DB-level UUID is minted later by `findOrCreateAgent` and is the only place a UUID is structurally required. The original PR #1627 bug (`PostgresError: invalid input syntax for type uuid: "engineer-4-eac7"`) is still resolved because the SQL probe is still skipped for non-UUID `name`; only the in-memory `workerId` value changes. Also retires `genie agent spawn tracer` (no such built-in) in favor of `genie agent spawn trace` in skills/trace and skills/report — drift from the canonical built-in name `trace`. Wish: .genie/wishes/fix-spawn-uuid-rename-regression/WISH.md (Group 1) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request fixes a regression in resolveSpawnIdentity where non-UUID agent names were incorrectly replaced with generated UUIDs, breaking role-based dispatch. It also updates documentation examples to use trace instead of tracer and adds a new regression test suite. Feedback identifies several remaining references to tracer in the documentation that need updating for consistency and suggests using the UUID_REGEX constant in agents.ts to improve maintainability.
|
|
||
| # 2. Run /trace | ||
| genie agent spawn tracer | ||
| genie agent spawn trace |
| ```bash | ||
| # 1. Spawn a tracer (read-only — no code changes) | ||
| genie agent spawn tracer | ||
| genie agent spawn trace |
| // `--to <role>` resolver tier. | ||
| if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(name)) { | ||
| return { kind: 'canonical', workerId: uuidFactory(), sessionUuid: uuidFactory() }; | ||
| return { kind: 'canonical', workerId: name, sessionUuid: uuidFactory() }; |
Summary
resolveSpawnIdentity's non-UUID guard (introduced in8886e5f0) was minting a fresh UUID forworkerIdin its early-return. That UUID propagated throughfindOrCreateAgent→registerSpawnWorker→hireAgentas bothcustom_nameandrole, breaking every--to <role>resolver tier on dev-local. Most visible on council teams: members listed by UUID instead ofcouncil--architect. Fix: preservenameasworkerIdin the early-return — the DB-level UUID is minted later byfindOrCreateAgentand is the only place a UUID is structurally required.skills/trace/SKILL.mdandskills/report/SKILL.mdprescribedgenie agent spawn tracer, but notracerbuilt-in exists; canonical name istrace(matchesteam-lead/AGENTS.mdand frontmatter). Replaced 4 occurrences.Wish
.genie/wishes/fix-spawn-uuid-rename-regression/WISH.mdFiles
src/term-commands/agents.tsworkerId: uuidFactory()→workerId: name+ clarifying commentsrc/term-commands/__tests__/spawn-identity-name-guard.test.tsskills/trace/SKILL.mdtracer→trace(L42, L66)skills/report/SKILL.mdtracer→trace(L204, L243)Validation
bun test src/term-commands/__tests__/spawn-identity-name-guard.test.ts— 4 pass, 0 fail.bun run typecheck— clean.grep -rn 'spawn tracer' skills/— zero matches.Test plan
bun dist/genie.js agent spawn engineer→ PGagents.custom_name = 'engineer'(NOT a UUID).genie team create test --type council→genie team ls testshows role names, not UUIDs.genie send '<msg>' --to council--architect --team testresolves successfully.Why the fix is minimal
The original PR #1627 issue (
PostgresError: invalid input syntax for type uuid: "engineer-4-eac7") is still resolved because the SQL probe is still skipped for non-UUIDname; only the in-memoryworkerIdvalue changes. DB-level uniqueness is enforced by the UUIDagents.idcolumn minted later infindOrCreateAgent.🤖 Generated with Claude Code