Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/hooks/handlers/auto-spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* When an agent sends a message to a recipient that doesn't have a live
* tmux pane, this handler attempts to respawn them from their saved
* template (created during the original `genie agent spawn`).
* template (created during the original `genie spawn`).
*
* Resolution order (directory-aware):
* 1. Check worker registry for live pane → skip if alive
Expand Down Expand Up @@ -78,9 +78,9 @@ export async function autoSpawn(payload: HookPayload): Promise<HandlerResult> {
return;
}

// Respawn via genie agent spawn (non-blocking fork)
// Respawn via genie spawn (non-blocking fork)

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 comment mentions a "non-blocking fork", but spawnSync is used on line 93, which is a synchronous and blocking operation. This is correctly explained in the comment on lines 90-92. To avoid confusion, I suggest updating this comment to reflect that the operation is synchronous.

Suggested change
// Respawn via genie spawn (non-blocking fork)
// Respawn via genie spawn (synchronous fork)

const { spawnSync } = require('node:child_process') as typeof import('node:child_process');
const args = ['agent', 'spawn', '--provider', template.provider, '--team', template.team];
const args = ['spawn', '--provider', template.provider, '--team', template.team];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pass required agent name to genie spawn argv

After switching to top-level genie spawn, this argv no longer matches the CLI contract: genie spawn --help shows usage genie spawn [options] <name>, but the constructed args omit <name> and later still append legacy flags like --role/--resume that top-level spawn does not accept. In practice, auto-spawn now exits with parse errors instead of bringing the recipient online whenever this path runs.

Useful? React with 👍 / 👎.

if (template.role) args.push('--role', template.role);
if (template.skill) args.push('--skill', template.skill);
if (template.cwd) args.push('--cwd', template.cwd);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/handlers/identity-inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function identityInject(payload: HookPayload): Promise<HandlerResul
const msgType = input.type as string | undefined;
if (msgType !== 'message' && msgType !== 'broadcast') return;

// Resolve agent name from env (set by genie agent spawn via GENIE_AGENT_NAME)
// Resolve agent name from env (set by genie spawn via GENIE_AGENT_NAME)
const agentName = process.env.GENIE_AGENT_NAME;
if (!agentName) return;

Expand Down
4 changes: 2 additions & 2 deletions src/hooks/inject.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Hook Injection — writes CC hook config into team settings.json
*
* Called during `genie agent spawn` to ensure every spawned agent
* Called during `genie spawn` to ensure every spawned agent
* routes its hook events through `genie hook dispatch`.
*/

Expand Down Expand Up @@ -109,7 +109,7 @@ async function injectIntoFile(settingsPath: string): Promise<boolean> {

/**
* Inject hook dispatch config into a team's settings.json.
* Called automatically during `genie agent spawn`.
* Called automatically during `genie spawn`.
*/
export async function injectTeamHooks(teamName: string): Promise<boolean> {
const path = teamSettingsPath(teamName);
Expand Down
Loading