11/**
2- * spawn_agent / wait_agents (CL-6942) : the non-blocking half of fleet
3- * dispatch, split out of `task()`'s fused spawn+wait.
2+ * spawn_agent / wait_agents: the non-blocking half of fleet dispatch,
3+ * split out of `task()`'s fused spawn+wait.
44 *
55 * `task()` (task-tool.ts) remains the fused, blocking primitive and is
66 * unchanged. These two verbs let an orchestrator start several workers in
@@ -395,9 +395,9 @@ export function createSpawnAgentTool(deps: AgentFleetDeps): AgentTool {
395395 description,
396396 agentId : resolved . directorId ,
397397 brief,
398- // CL-6943: a spawn_agent worker's session survives a clean
399- // completion instead of being torn down — close_agent (or
400- // resume_agent, transitively) governs it from here on.
398+ // A spawn_agent worker's session survives a clean completion instead
399+ // of being torn down — close_agent (or resume_agent, transitively)
400+ // governs it from here on.
401401 retained : true ,
402402 } ) ;
403403 deps . fleetRecords . register ( session . id ) ;
@@ -446,8 +446,8 @@ export function createSpawnAgentTool(deps: AgentFleetDeps): AgentTool {
446446 ...( resolved . capabilities !== undefined ? { capabilities : resolved . capabilities } : { } ) ,
447447 systemPromptRole : resolved . systemPromptRole ,
448448 directorId : resolved . directorId ,
449- // CL-6943: keep the session open after a clean completion, and hand
450- // the store a bounded close for close_agent to call later.
449+ // Keep the session open after a clean completion, and hand the
450+ // store a bounded close for close_agent to call later.
451451 persist : true ,
452452 onAgentReady : ( { close, interrupt, followup } ) => {
453453 deps . sessions . registerClose ( session . id , close ) ;
@@ -458,27 +458,27 @@ export function createSpawnAgentTool(deps: AgentFleetDeps): AgentTool {
458458 } ;
459459
460460 // Fire and forget: this handler must return before the worker finishes.
461- // fleetRecords (never capped) is the durable source of truth wait_agents
462- // reads from; deps.sessions.complete/fail is still called for the TUI's
463- // benefit, but only after fleetRecords already has the result, and
464- // fleetRecords is written before it so the synchronous subscribe
465- // notification fired by complete()/fail() always sees the up-to-date
461+ // fleetRecords is the durable source of truth wait_agents reads from
462+ // (see the module doc for its own cap/eviction policy);
463+ // deps.sessions.complete/fail is still called for the TUI's benefit,
464+ // but only after fleetRecords already has the result, so the
465+ // synchronous subscribe notification always sees the up-to-date
466466 // record.
467467 deps
468468 . run ( params )
469469 . then ( ( result ) => {
470470 if ( childCtl . signal . aborted ) return ;
471- // CL-6997: interrupt_agent already flipped this session to
472- // "interrupted" synchronously (session-store.interruptOne) — do
473- // not let the settling promise's normal bookkeeping overwrite
474- // that with a "completed" status.
471+ // interrupt_agent already flipped this session to "interrupted"
472+ // synchronously (session-store.interruptOne) — do not let the
473+ // settling promise's normal bookkeeping overwrite that with a
474+ // "completed" status.
475475 if ( result . interrupted === true ) return ;
476476 deps . fleetRecords . resolve ( session . id , result . report ) ;
477- // CL-7001: result.agentRetained is only true on run.ts's clean-
478- // completion path when persist actually skipped teardown — a
479- // deadline/cancel salvage resolves through the same promise but
480- // always disposed its agent first, so the store must not treat it
481- // as resumable just because retained:true was requested at spawn.
477+ // result.agentRetained is only true on run.ts's clean-completion
478+ // path when persist actually skipped teardown — a deadline/cancel
479+ // salvage resolves through the same promise but always disposed
480+ // its agent first, so the store must not treat it as resumable
481+ // just because retained:true was requested at spawn.
482482 deps . sessions . complete ( session . id , result . report , {
483483 agentRetained : result . agentRetained === true ,
484484 } ) ;
0 commit comments