Repository navigation
fix(dispatch): unique role suffix to unblock wave dispatch collisions #1626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |||||||
| */ | ||||||||
|
|
||||||||
| import { execSync } from 'node:child_process'; | ||||||||
| import { randomUUID } from 'node:crypto'; | ||||||||
| import { existsSync } from 'node:fs'; | ||||||||
| import { mkdir, readFile, writeFile } from 'node:fs/promises'; | ||||||||
| import { tmpdir } from 'node:os'; | ||||||||
|
|
@@ -722,7 +723,7 @@ async function runWorkDispatch( | |||||||
| console.log(` Wish: ${wishPath}`); | ||||||||
| console.log(` Group: ${group}`); | ||||||||
|
|
||||||||
| const effectiveRole = `${agentName}-${group}`; | ||||||||
| const effectiveRole = `${agentName}-${group}-${randomUUID().slice(0, 4)}`; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the effectiveRole now includes a random suffix, it would be beneficial to log the full role name to the console. This helps the operator identify the specific agent instance for commands like genie read or genie send ... --to , especially when multiple agents of the same type are running in a wave.
Suggested change
|
||||||||
| const leaderTarget = await resolveLeaderTarget(); | ||||||||
| const workPrompt = `Execute Group ${group} of wish "${slug}". Your full context is in the system prompt. Read the wish at ${wishPath} if needed. Implement all deliverables, run validation, and report completion.\n\nWhen done:\n1. Run: genie done ${slug}#${group}\n2. Run: genie send 'Group ${group} complete. <summary>' --to ${leaderTarget}`; | ||||||||
|
|
||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
randomUUID().slice(0, 4)leaves only 16 bits of entropy foreffectiveRole, so two same-group dispatches can still generate the same role and hitrejectDuplicateRole(the original failure mode), just probabilistically instead of deterministically. In multi-wish wave dispatches where many workers are started, this creates intermittent hard-to-reproduce aborts; consider a longer suffix (or retry-on-collision) so role uniqueness is effectively guaranteed.Useful? React with 👍 / 👎.