Skip to content

fix(spawn): preserve role name as workerId; align skill text with built-in name - #1663

Merged
namastex888 merged 1 commit into
devfrom
fix/spawn-uuid-rename-regression
May 5, 2026
Merged

namastex888 merged 1 commit into
devfrom
fix/spawn-uuid-rename-regression

Conversation

@automagik-genie

Copy link
Copy Markdown
Contributor

Summary

  • Bug A (P0 regression): resolveSpawnIdentity's non-UUID guard (introduced in 8886e5f0) was minting a fresh UUID for workerId in its early-return. That UUID propagated through findOrCreateAgent → registerSpawnWorker → hireAgent as both custom_name and role, breaking every --to <role> resolver tier on dev-local. Most visible on council teams: members listed by UUID instead of council--architect. 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.
  • Bug B (P3 doc drift): skills/trace/SKILL.md and skills/report/SKILL.md prescribed genie agent spawn tracer, but no tracer built-in exists; canonical name is trace (matches team-lead/AGENTS.md and frontmatter). Replaced 4 occurrences.

Wish

.genie/wishes/fix-spawn-uuid-rename-regression/WISH.md

Files

File Change LOC
src/term-commands/agents.ts workerId: uuidFactory() → workerId: name + clarifying comment 6 +/- 3
src/term-commands/__tests__/spawn-identity-name-guard.test.ts New regression suite (4 tests, no PG) +64
skills/trace/SKILL.md tracer → trace (L42, L66) 2 +/- 2
skills/report/SKILL.md tracer → trace (L204, L243) 2 +/- 2

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 → PG agents.custom_name = 'engineer' (NOT a UUID).
  • genie team create test --type council → genie team ls test shows role names, not UUIDs.
  • genie send '<msg>' --to council--architect --team test resolves successfully.
  • CI green.

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-UUID name; only the in-memory workerId value changes. DB-level uniqueness is enforced by the UUID agents.id column minted later in findOrCreateAgent.

🤖 Generated with Claude Code

…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>
@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 964c4a5b-5190-4060-b292-181a4fd6928b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/spawn-uuid-rename-regression

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@namastex888
namastex888 merged commit c5cdb35 into dev May 5, 2026
15 checks passed

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment thread skills/report/SKILL.md

# 2. Run /trace
genie agent spawn tracer
genie agent spawn trace

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.

medium

The example command on the following line (line 244) still uses --to tracer. Since the agent is now spawned as trace on line 243, the target name in the send command should be updated to --to trace to ensure the example remains correct and functional.

Comment thread skills/trace/SKILL.md
```bash
# 1. Spawn a tracer (read-only — no code changes)
genie agent spawn tracer
genie agent spawn trace

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.

medium

The subsequent commands in this example (lines 69 and 72) still refer to the agent as tracer (e.g., --to tracer and genie agent log tracer). These should be updated to trace to align with the change made to the spawn command on line 66.

// `--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() };

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.

medium

While modifying this block, consider refactoring the preceding line (line 2362) to use the UUID_REGEX constant defined at line 2277 instead of the hardcoded regex literal. This improves maintainability and ensures consistency across the module.

@automagik-genie
automagik-genie deleted the fix/spawn-uuid-rename-regression branch September 25, 2026 04:51
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.

2 participants