Skip to content

Commit a66eafb

Browse files
Clean up stale/verbose comments in src/subagent (#630)
Comment-only pass: removes ticket-number references, deletes or corrects comments asserting guarantees the code no longer provides (e.g. a stale pruneCompleted exemption claim in session-store.ts, an inaccurate "never capped" claim about fleetRecords in agent-fleet.ts), and trims narrative comments down to their WHY. No logic changes; no CHANGELOG entry.
1 parent 8016d9c commit a66eafb

25 files changed

Lines changed: 141 additions & 156 deletions

src/subagent/agent-fleet.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
});

src/subagent/authority.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe("assertTierMayMountFleetVerb", () => {
1111
expect(() => assertTierMayMountFleetVerb("leaf", "task")).toThrow(FleetAuthorityError);
1212
expect(() => assertTierMayMountFleetVerb("leaf", "search_agents")).toThrow(FleetAuthorityError);
1313
expect(() => assertTierMayMountFleetVerb("leaf", "spawn_agent")).toThrow(FleetAuthorityError);
14-
// CL-6943: the reusable-session verbs are gated the same way.
14+
// The reusable-session verbs are gated the same way.
1515
expect(() => assertTierMayMountFleetVerb("leaf", "close_agent")).toThrow(FleetAuthorityError);
1616
expect(() => assertTierMayMountFleetVerb("leaf", "resume_agent")).toThrow(FleetAuthorityError);
17-
// CL-6997: interrupt_agent / followup_task are gated the same way.
17+
// Interrupt_agent / followup_task are gated the same way.
1818
expect(() => assertTierMayMountFleetVerb("leaf", "interrupt_agent")).toThrow(
1919
FleetAuthorityError,
2020
);

src/subagent/authority.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Fleet authority (CL-6941): the runtime boundary between the three tiers.
2+
* Fleet authority: the runtime boundary between the three tiers.
33
*
44
* Tier enforcement lives here and at the tool-mount point in run.ts — never
55
* in a prompt. This module owns two checks:
@@ -93,9 +93,8 @@ function isDescendant(
9393
* No verb in this codebase currently lets one live agent target another
9494
* (`task` only spawns; it never addresses an existing session), so the
9595
* subtree rule below is exercised only by authority.test.ts — it is not
96-
* enforced at runtime yet. It exists now so CL-6942 (split spawn from wait)
97-
* and CL-6944 (send_input steering) — the first two verbs that make one
98-
* agent addressable by another — can call it from day one instead of
96+
* enforced at runtime yet. It exists now so future verbs that make one
97+
* agent addressable by another can call it from day one instead of
9998
* inventing their own check. Until one of those wires a call site here, do
10099
* not describe this rule as enforced; only assertTierMayMountFleetVerb is.
101100
*

src/subagent/brief-dispatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Parent-side re-dispatch bookkeeping for task briefs (CL-4343 + CL-5203).
2+
* Parent-side re-dispatch bookkeeping for task briefs.
33
*
44
* This module tracks how often the *parent* re-spawns the same brief so
55
* salvage outcomes can be classified per-fingerprint (successful completes

src/subagent/dispose.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function isSubAgentCancelError(err: unknown, signal?: AbortSignal): boole
3131
export const SUBAGENT_SPAWN_DRAIN_MS = 2_000;
3232

3333
/**
34-
* Bounded cleanup deadline for close_agent (CL-6943): a wedged descendant's
34+
* Bounded cleanup deadline for close_agent: a wedged descendant's
3535
* teardown is abandoned (not awaited further), not a reason to hang the
3636
* caller.
3737
*/

src/subagent/fleet-report.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* cannot keep: a lane failed or went quiet, and the single moment the fleet runs
77
* dry. Per-lane "done — summary" walls are intentionally never printed — they
88
* restate the strip and the parent and turn the transcript into a second
9-
* status log (CL-5846).
9+
* status log.
1010
*
1111
* Pure and stateless per call — the caller keeps the returned watch and hands
1212
* it back on the next observation. No painting, no store access.
@@ -175,7 +175,7 @@ export function observeFleet(
175175

176176
// A lane going quiet is no longer emitted to the transcript: the single
177177
// agents-panel rollup row carries the quiet count instead, so a stalled
178-
// fleet stops producing "went quiet" walls (CL-5846). stallReported is
178+
// fleet stops producing "went quiet" walls. stallReported is
179179
// still tracked internally so the strip does not flap.
180180
}
181181

@@ -184,7 +184,7 @@ export function observeFleet(
184184

185185
// Board owns live lanes. Parent prose owns success narratives. Transcript
186186
// only: fail/stall while work is still running, or one dry-fleet tally.
187-
// Never per-lane "done — summary" walls (CL-5846).
187+
// Never per-lane "done — summary" walls.
188188
if (wentDry) {
189189
return {
190190
watch,

src/subagent/followup-live-agent.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* CL-6997 regression guard: lifecycle-tools.test.ts proves interrupt_agent /
2+
* Regression guard: lifecycle-tools.test.ts proves interrupt_agent /
33
* followup_task behave correctly against *fake registered closures* at the
44
* tool/store layer — it never exercises run.ts's real wiring, where
55
* `followup` calls `agent!.send()` on the same live agent object created by
@@ -82,7 +82,7 @@ function createStubAgent() {
8282
};
8383
}
8484

85-
describe("interrupt_agent / followup_task reuse the same live agent (CL-6997)", () => {
85+
describe("interrupt_agent / followup_task reuse the same live agent", () => {
8686
test("followup after interrupt sends into the SAME agent instance — not a rebuilt one", async () => {
8787
const cwd = await tmpCwd();
8888
let constructions = 0;

src/subagent/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ describe("sub-agent stop helpers", () => {
284284
).toBeNull();
285285
});
286286

287-
test("re-read pressure no longer stops a worker (CL-6936)", () => {
287+
test("re-read pressure no longer stops a worker", () => {
288288
let thrash = EMPTY_THRASH_STATE;
289289
thrash = nextThrashState(thrash, [
290290
{ type: "tool_call", name: "edit_file", arguments: { path: "a.ts" } },
@@ -608,7 +608,7 @@ describe("thrash edge cases", () => {
608608
expect(stop(s)).toBeNull();
609609
});
610610

611-
test("re-reading the same chunk repeatedly is not a stop (CL-6936)", () => {
611+
test("re-reading the same chunk repeatedly is not a stop", () => {
612612
let s = EMPTY_THRASH_STATE;
613613
s = nextThrashState(s, [edit("big.ts")]);
614614
for (let i = 0; i < 8; i++) {

src/subagent/intervention-log.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function flush(): Promise<void> {
2424
await new Promise((resolve) => setTimeout(resolve, 10));
2525
}
2626

27-
describe("intervention log (CL-6938)", () => {
27+
describe("intervention log", () => {
2828
test("records carry the shared context, the measurement, and the run state", async () => {
2929
const dir = await mkdtemp(join(tmpdir(), "intervention-log-"));
3030
const sink = createInterventionLog(

src/subagent/intervention-log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* There was no way to tell how often a stop or nudge trigger was wrong. Every
55
* threshold in the tree was set by judgment, and the tuning history is a
66
* record of that not working — a grok 6/10 pair reverted as miscalibrated,
7-
* and a grok stall timeout reverted (CL-6938).
7+
* and a grok stall timeout reverted.
88
*
99
* The point of this file is that a threshold change can cite data. Each record
1010
* carries the trigger's *measured value beside its threshold*, the identity of

0 commit comments

Comments
 (0)