Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/term-commands/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Increase role suffix entropy to avoid residual collisions

Using randomUUID().slice(0, 4) leaves only 16 bits of entropy for effectiveRole, so two same-group dispatches can still generate the same role and hit rejectDuplicateRole (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 👍 / 👎.

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

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 effectiveRole = `${agentName}-${group}-${randomUUID().slice(0, 4)}`;
const effectiveRole = agentName + "-" + group + "-" + randomUUID().slice(0, 4);
console.log(" Role: " + effectiveRole);

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}`;

Expand Down
Loading