You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agent-status): expire a subagent wake so a settled row cannot stay working - #47724
When a subagent inside a chat finishes, but a job that subagent had started is still running, Orca assumes the subagent will wake up again when that job ends, and shows it as working. Sometimes it never wakes up, and nothing ever clears the "1 agent working" badge — the chat is stuck looking busy until you close it. This makes that guess time out, so the row goes back to finished when the subagent really did not wake.
What Changed
Before: a finished subagent shown working again when one of its launched tasks ended stayed working forever in the cases Claude Code does not resume it. The chat kept reading working with mainAgent.state: done, no live children, and stayed that way until someone closed the chat — the issue reports 50 minutes and 75 minutes.
After: the row returns to the subagent's recorded done / succeeded once the guess expires, and the chat reads as done.
Mechanism: ClaudeChildWork.end() calls wakeOwner() for every ending but a stop, which unconditionally re-marks a succeeded agent owner as running with no expiry. That guard now holds a 60-second lease per owner. drain() settles expired leases before it collects evidence, restoring the owner under its own id (ended, with the run and outcome it had). Any frame naming the owner releases the lease at once, so a real resume is never undone. The restored ending is emitted as a normal ended edge, so the existing lead-status fold does the rest.
A timer restates the row at the next lease deadline, because in the reported cases no further frame arrives. It reuses the same scheduler the owed-notification lease already uses.
The two touched files were both at the 300-line max-lines limit, so the ownership index, the lease, the expiry timers and the publish path moved into their own modules; the adapter's and decoder's behaviour is unchanged apart from the lease.
Why
This follows the first fix the issue proposes: a wake needs an expiry. The alternative — only showing the owner working from the frame where the provider reports it running again — loses the "restart a moment later" flicker the current comment explicitly avoids, and would show the owner as finished while Claude Code runs it again for a turn.
The lease is keyed on the owner and is released by any frame that names it, so it cannot hold a pane that genuinely resumed. It is in-memory and per-session, and clear() (session close/retire) drops it.
N/A — this is a status-normalization change with no UI surface of its own. The observable difference is the reported child-work state (owner working → ended), and it is covered by automated tests. I could not attach a live capture: reproducing it needs a real Claude Code subagent that leaves background work behind, which I could not drive deterministically here.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
src/main/claude/child-work/claude-child-work-decoder.test.ts drives the public observe/drain entry with the frames the issue reports: an agent owner starts, its child task starts, the owner notifies completed, then the child notifies completed from that owner.
the owner is shown working at once (today's behaviour is kept);
it settles back to ended / succeeded with its run id once the lease runs out;
it stays working while the lease is still running;
a frame naming the owner inside the lease keeps it working (a real resume is never undone);
wakeExpiryAt() reports the deadline, so the host can restate without another frame.
Every added test was checked by removing its mechanism and confirming it fails: the three lease tests, keeps the wake when a frame naming the owner is rejected as historical, and accepts a running roster entry for the owner after its wake expired. I did not observe a live subagent in this environment; the hook sequence used is the one the issue reports.
pnpm test on src/main/claude, src/shared/agent-status, src/shared/agent-hook-listener: 22 files, 78 tests passing.
pnpm typecheck (tsconfig.node.json): passing.
oxlint and oxfmt --check on the changed files: clean.
Performance
None, because a wake adds one map entry per child ending, and the expiry timer only runs while a wake is held.
Risk
Level: Low
The riskiest part is the restored edge acting on a record the provider has moved on from. It only runs when the lease expires and the live record is still the woken, running one; a stop, a failed ending, or a new spawn leaves a different record and is left alone. A real resume always sends a frame naming the owner, which releases the lease — so the failure mode is at worst a 60-second delay before a genuinely resumed owner is shown working again.
Reversible with a plain revert; nothing persisted depends on it.
AI Disclosure
Claude (Anthropic) was used to read the event pipeline, write the change and its tests, and run the checks above. I read the decoder and the admission/fold path it feeds before choosing the approach, and reproduced the current behaviour in the test before changing it.
Review
Self-review summary:
Cross-platform: no platform-specific code; the reporter's case was macOS and the path is shared.
SSH/remote: the fix lives in the shared Claude child-work decoder, so remote and local sessions both get it.
Performance: one map entry per child ending; one timer while a wake is held.
UI quality: no UI change; the row simply stops misreporting.
Security: no input, path, or shell handling touched.
Blast radius: confined to ClaudeChildWorkDecoder; other providers keep their own trackers.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Security: no change.
Cross-platform: no platform-specific code.
Remote SSH: shared path, benefits equally.
Mobile: no change to the wire; the same child-work evidence is what mobile already reads.
Backwards compatibility: none affected; the lease is in-memory.
Performance: one map entry and one timer per held wake.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
…y working
A finished subagent's row is shown working again when a task it launched ends, on the
guess that the provider resumes it. It does not resume an owner whose remaining
descendants end later, nor one whose worktree is gone, so nothing settles that row and
the chat reads as working until it is closed.
Hold each wake under a 60s lease and restore the owner's recorded ending when no frame
for it arrives inside it; any frame naming the owner releases the lease at once.
Restate the row from a timer at expiry, since no further frame will arrive.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The decoder now tracks child-owner relationships and temporary wake leases. When a lease expires, it can restore the owner’s prior ended record and queue ended evidence. Roster entries and admitted task frames can confirm that an owner is running. The structured session adapter delegates evidence publication to a publisher, which schedules session restates for wake expiries and clears timers when sessions close.
Severity of issue fixed: Medium
Merge Risk: Low · previous review f61cf
A subagent that is genuinely resumed can still be shown as finished after the 60-second lease if its resumption arrives as a running update patch or a progress frame. The effect is a temporarily wrong status row that later events correct. The fix is small and localized, so address it before merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a subagent wake now expires so a settled row cannot stay in the working state. The changeset adds a 60-second lease per woken owner that restores the recorded ended ou…
Description check
The description follows the repository template: ELI5, What Changed, Why, Linked Issue (Fixes #47715), Visual Proof (N/A with reason), Testing, Performance, Risk (level Low, with a revert note), AI Di…
Linked Issues check
Directly linked issue #47715 requires that a finished agent owner not stay shown as working after a child task ends and Claude Code does not resume it. The chat must then read as done.
At head f61cf3…
Out of Scope Changes check
The new modules support the lease behaviour. ClaudeChildOwnerIndex maintains the owner-to-children relation used by the wake. ClaudeChildWake holds the lease, the expired set and the ended evidence. C…
Full details: Title check
Explanation
The title names the main change: a subagent wake now expires so a settled row cannot stay in the working state. The changeset adds a 60-second lease per woken owner that restores the recorded ended outcome when it expires, which matches the title. The title uses the conventional fix(scope) prefix and is a single sentence of 12 words.
Full details: Description check
Explanation
The description follows the repository template: ELI5, What Changed, Why, Linked Issue (Fixes #47715), Visual Proof (N/A with reason), Testing, Performance, Risk (level Low, with a revert note), AI Disclosure, Review, the upstream boundary checkbox, Notes, and Checklist. It explains the mechanism and the alternatives considered. Gaps: the Performance line ends with 'None, because' followed by an explanation, which is acceptable. The Testing checklist leaves 'I manually tested these changes locally' unchecked, and the final checklist item for pnpm lint/build is unchecked. The author explains the manual testing gap in Visual Proof. The 'Risk' section names the riskiest part and gives a revert path. The description is complete enough to pass.
Full details: Linked Issues check
Explanation
Directly linked issue #47715 requires that a finished agent owner not stay shown as working after a child task ends and Claude Code does not resume it. The chat must then read as done.
At head f61cf3c, ClaudeChildWake.owner() in claude-child-wake-lease.ts shows the owner working through showWorking and records a wake with a 60-second deadline (CLAUDE_CHILD_WAKE_LEASE_MS). ClaudeChildWorkDecoder.drain() settles expired wakes before it reads pending edges. settleExpired() calls host.restore(), which puts the owner back to its recorded ended run and outcome. wakeExpiryAt() exposes the earliest deadline, and ClaudeChildWakeExpiryTimers restates the row when no later frame arrives. Both reported cases end with no later owner frame, so the expiry path covers them.
The follow-up changes since 3e6c651 are supported. confirmRunning() releases a wake and revives only an expired owner. The expired set lets a later running report revive the owner through confirmedRunning(). Any other ended task with no wake is still rejected. Revival keeps the owner's saved task details, as the PR states.
Limits: The decoder test file and the decoder's metadata-only gate in updated() were not read in this review. The gate is confirmed only by the PR description and the change summary. Live Claude Code resume timing was not observed. A genuine resume that starts after 60 seconds, and sends no frame before the deadline, shows ended until its next frame. The optional special case for a plain 'finished' notification from the issue is not implemented. The issue lists it as a possible fix, not a requirement.
Full details: Out of Scope Changes check
Explanation
The new modules support the lease behaviour. ClaudeChildOwnerIndex maintains the owner-to-children relation used by the wake. ClaudeChildWake holds the lease, the expired set and the ended evidence. ClaudeChildWakeExpiryTimers and ClaudeChildWorkPublisher schedule the restate and clear it on session close. The decoder change routes ending evidence through childWorkEndedEvidence. The roster helpers claudeRosterEntries and claudeRosterAliasId support lease release and running-roster revival. These are supporting refactors tied to the lease, and the PR states the module split was needed for the max-lines limit.
The adapter edit in acknowledgeSessionRelease, which discards the result of deleting the settled exit error, is not tied to the lease. It has no behaviour change and is minor. The PR description says adapter behaviour is unchanged apart from the lease, so this edit is a small undisclosed item. It does not make the change out of scope.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Test lease release with a progress frame and explicit state assertions.
observe drains and discards the evidence from this completed notification. The next empty drain does not establish that the owner remains working or that the lease was released.
Use a task_progress frame for the owner. Then assert that wakeExpiryAt() is undefined and that the owner remains live and running after the original expiry. This makes the test detect a missing release instead of relying on a terminal frame.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e2f97a20-7a9e-4ab3-ae81-003750b7a54a
Commits
Reviewing files that changed from the base of the PR and between e2c8f47 and 2c43109.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
…unning
A background_tasks_changed roster can list the owner as running after the wake was held. The envelope-level releases miss it, so the lease survives and settleWake later restores the ended record while the provider still runs the owner. Release the lease for every roster entry that reports the owner in a live state, before admission decides.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Accept a running roster entry for an owner whose wake expired. · claude-child-work-decoder.ts:71
src/main/claude/child-work/claude-child-work-decoder.ts:71 Minor · Functional Correctness · Quick win
Accept a running roster entry for an owner whose wake expired.
When the lease expires first, settleWake restores the owner to ended. The !this.ended.has(id) guard in observe then rejects every later background_tasks_changed entry that reports the owner as running. Releasing the lease has no effect because the lease is already gone. The owner stays shown as done until a different accepted event restores it.
Keep enough expired-wake state to accept this later running confirmation for that owner. Roster entries for other ended tasks must remain excluded.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 10c9f667-2874-49e6-9b82-761607bbf506
Commits
Reviewing files that changed from the base of the PR and between 2c43109 and a65ed72.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
The decoder was at the 300-line budget, so moving the roster iteration into claude-child-work-evidence keeps the release and admission order in one place without a max-lines bypass. Behaviour is unchanged: a live entry releases the wake, then admission decides whether to start it.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Release the owner's wake lease only for frames the decoder… · claude-child-work-decoder.ts:59-60
src/main/claude/child-work/claude-child-work-decoder.ts:59-60 Minor · Stability & Availability · Quick win
Release the owner's wake lease only for frames the decoder admits as current.
The release at lines 59-60 runs before the selection gate at lines 82-85. A system frame that names the owner but belongs to an older invocation can therefore clear the wake lease and still be rejected. A historical tool_use_id makes selection(...).current false, so the frame is ignored. The owner then has no lease, and if Claude Code does not resume it, its row can remain in the running state. Keep the release for frames that pass selected.current and that the decoder admits. Move it after that check so rejected historical frames do not clear the lease.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e0eeec47-49d6-4ef2-b9e9-d2f70d94476f
Commits
Reviewing files that changed from the base of the PR and between a65ed72 and 7f79132.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
…t one
The wake lease was released before the currency gate, so a historical frame
that the decoder ignores still cleared it and left the owner working for good.
Move the release after the gate, and keep a spent wake marked so a later
confirmed running report can still restore the owner instead of reading it as
done forever. The wake lifecycle now lives in the child-wake lease module.
Both outside-diff findings are fixed in 3e6c651b, and each has a test that fails without the change.
1. Release only for frames the decoder admits. The release did run before the currency gate, so a historical tool_use_id frame cleared the lease and was then ignored — leaving the owner with no guess and the row working for good. The release now sits after the gate (claude-child-work-decoder.ts:95), so only a frame that passes selection(...).current and admission clears it. Test: keeps the wake when a frame naming the owner is rejected as historical — asserts the expiry survives a stale-alias notification and the row still settles.
2. Accept a running roster entry after the wake expired.settleExpired now records the owner in a spent set (claude-child-wake-lease.ts:28), and a later live roster entry or a running task_updated for that owner is re-admitted instead of being rejected by the !this.ended.has(id) guard (claude-child-work-decoder.ts:237). The marker is cleared as soon as a real start is accepted, and roster entries for ended tasks that never had a wake are still excluded — covered by accepts a running roster entry for the owner after its wake expired and still rejects an ended task that never had a wake.
The wake lifecycle moved into claude-child-wake-lease.ts so the decoder stays under max-lines; its behaviour is unchanged apart from the two fixes. pnpm typecheck passes, and src/main/claude, src/shared/agent-status, src/shared/agent-hook-listener are 22 files / 78 tests passing.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…ts saved task
A frame that is not a start no longer revives an owner whose wake ran out unless it reports
the owner running: a metadata-only `task_updated` described an expired owner but said nothing
about the provider resuming it.
The revival also read a roster-shaped frame that carried only the owner's id and status, so a
revived owner came back as kind `unknown` with no name or description. The frame that proves
the owner running is now what the revival reads, and both revival paths fall back to the task
saved on the ending.
Both are fixed in f61cf3cb, and each has a test that fails without the change.
1. A revive keeps the saved kind, name and description. The revival read rosterStart(id), which carried only the id and status, and started could not recover the rest: the live record was dropped on the ending, and the fallback to existing found nothing, so a revived owner came back as unknown with no name or description. The revival now reads the frame that proved the owner running — the roster entry or the task_updated patch, which carries name/description/task_type — and both revival paths fall back to the task saved on the ending. Test: keeps the saved kind and name when a running report revives the owner — before this change the same sequence reports kind: 'unknown' with no name; it now reports agent / explorer.
2. Only running evidence revives an expired owner.updated released the spent wake and revived without checking the patch, so a metadata-only frame showed the owner running with no deadline until something else ended it. The revive is now gated on liveClaudeTaskRunState(patch.status) !== null, matching what the roster branch already required. Test: does not revive an expired owner from a metadata-only update and its positive twin revives an expired owner from an update that reports it running.
Verified: claude-child-work-decoder.test.ts 14/14, pnpm tc:node green, and the repo's max-lines gate on the touched file.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
A child ending wakes a finished owner and holds the row working for the lease. The
lease was released only when the admitted frame carried status on the envelope, so
the SDK's task_progress frames (which carry no status) never confirmed it, and a
task_updated running patch (status under patch) did not either. The row then
reverted to its recorded ending while the provider kept running the owner;
later progress was ignored because progressed() only reads a live task.
Treat an admitted task_progress frame as running evidence and read a running
task_updated patch's status, passing the patch so a revived owner keeps its
task details. A metadata-only update still proves nothing about a resume.
…ke-lease
The merge pushed claude-child-work-decoder.ts to 319 counted lines, over the 300 max-lines ratchet. Move the roster frame helpers (roster start, lease-confirm frame, roster confirms, the notification's ended report) into claude-child-work-roster.ts, which already owns the decoder's task-frame rules. Behaviour is unchanged; the decoder is back under the limit.
Rebased onto current main in d3bcebd — the branch was 1315 commits behind and had a conflict in claude-child-work-decoder.ts.
The merge itself was mechanical, but it pushed the decoder to 319 counted lines (ratchet is 300). Moved the roster frame helpers into claude-child-work-roster.ts, which already owns this component's task-frame rules: claudeRosterStart, claudeRunningFrame, claudeRosterConfirmations and claudeEndedReport. Behaviour is unchanged.
Verified locally: oxlint clean on both files, tsc -p config/tsconfig.node.json 0 errors, and claude-child-work-decoder.test.ts + claude-child-work-residency.test.ts + claude-forked-command-subagent.test.ts are 42 passed.
…ke-lease
Resolve the import block: main moved event delivery to a namespace import,
this branch replaced drainClaudeChildWork with ClaudeChildWorkPublisher.
Thanks, this is the right shape. We're going to carry it in our own PR, with you credited as co-author, so we can make a few small cleanups (one clock for the lease and the settle, drop two unused helpers) and run the live repro. We'll close this one when that lands.
Sounds good — I'll leave this branch frozen at d3bcebd and won't push to it again, so your carry-over starts from a stable head. Thanks for crediting it.
Two things from my side that may save you time when you run the live repro:
The expiry is anchored on the wake's own dueAt, not on the subagent's last activity, so a settled row cannot be rescued by a stray status write after the lease window.
claude-child-work-roster.ts is where the task-frame helpers landed during the rebase; if your cleanups touch them, that file is the one to look at rather than the decoder.
…me it (#51765)
* fix(agent-status): expire a subagent wake so a settled row cannot stay working
Carried from #47724.
* fix(agent-status): stamp the wake lease on the drain clock and keep the ending's summary
Leaves the task_notification report inline, drops unused helpers, and keeps the decoder tests to the lease invariants.
Co-authored-by: 2SinceJuly <[email protected]>
* fix(agent-status): gate roster confirmations, retire a wake on a real ending, and skip unchanged re-arms
A stale running roster entry no longer cancels a held wake, a real ending inside the lease drops it and leaves nothing to revive, and frames that leave a chat's deadline unchanged no longer reschedule the shared timer.
Co-authored-by: 2SinceJuly <[email protected]>
* fix(agent-status): run the wake lease on the monotonic clock and let real endings stand
The lease deadline now uses the same monotonic clock as its timer, so a wall-clock correction cannot stretch it or make the timer spin. A real ending clears any revival of that run, and roster entries, which carry no run state, no longer cancel or revive a wake.
Co-authored-by: 2SinceJuly <[email protected]>
* perf(agent-status): keep held wakes in deadline order so a frame touches only the due front
Co-authored-by: 2SinceJuly <[email protected]>
* fix(agent-status): take only a running report as proof a woken subagent resumed
Co-authored-by: 2SinceJuly <[email protected]>
---------
Co-authored-by: 2SinceJuly <[email protected]>
Thank you! Your change landed in #51765, with you credited as co-author. We kept your lease design and added a few small adjustments on top (one clock for the lease and the settle, and keeping the subagent's summary when it settles). Closing this one in favor of it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
When a subagent inside a chat finishes, but a job that subagent had started is still running, Orca assumes the subagent will wake up again when that job ends, and shows it as working. Sometimes it never wakes up, and nothing ever clears the "1 agent working" badge — the chat is stuck looking busy until you close it. This makes that guess time out, so the row goes back to finished when the subagent really did not wake.
What Changed
Before: a finished subagent shown working again when one of its launched tasks ended stayed working forever in the cases Claude Code does not resume it. The chat kept reading
workingwithmainAgent.state: done, no live children, and stayed that way until someone closed the chat — the issue reports 50 minutes and 75 minutes.After: the row returns to the subagent's recorded
done / succeededonce the guess expires, and the chat reads as done.Mechanism:
ClaudeChildWork.end()callswakeOwner()for every ending but a stop, which unconditionally re-marks a succeeded agent owner asrunningwith no expiry. That guard now holds a 60-second lease per owner.drain()settles expired leases before it collects evidence, restoring the owner under its own id (ended, with the run and outcome it had). Any frame naming the owner releases the lease at once, so a real resume is never undone. The restored ending is emitted as a normalendededge, so the existing lead-status fold does the rest.A timer restates the row at the next lease deadline, because in the reported cases no further frame arrives. It reuses the same scheduler the owed-notification lease already uses.
The two touched files were both at the 300-line
max-lineslimit, so the ownership index, the lease, the expiry timers and the publish path moved into their own modules; the adapter's and decoder's behaviour is unchanged apart from the lease.Why
This follows the first fix the issue proposes: a wake needs an expiry. The alternative — only showing the owner working from the frame where the provider reports it running again — loses the "restart a moment later" flicker the current comment explicitly avoids, and would show the owner as finished while Claude Code runs it again for a turn.
The lease is keyed on the owner and is released by any frame that names it, so it cannot hold a pane that genuinely resumed. It is in-memory and per-session, and
clear()(session close/retire) drops it.Linked Issue
Fixes #47715
Visual Proof
N/A — this is a status-normalization change with no UI surface of its own. The observable difference is the reported child-work state (owner
working→ended), and it is covered by automated tests. I could not attach a live capture: reproducing it needs a real Claude Code subagent that leaves background work behind, which I could not drive deterministically here.Testing
src/main/claude/child-work/claude-child-work-decoder.test.tsdrives the publicobserve/drainentry with the frames the issue reports: an agent owner starts, its child task starts, the owner notifiescompleted, then the child notifiescompletedfrom that owner.workingat once (today's behaviour is kept);ended / succeededwith its run id once the lease runs out;wakeExpiryAt()reports the deadline, so the host can restate without another frame.Every added test was checked by removing its mechanism and confirming it fails: the three lease tests,
keeps the wake when a frame naming the owner is rejected as historical, andaccepts a running roster entry for the owner after its wake expired. I did not observe a live subagent in this environment; the hook sequence used is the one the issue reports.pnpm testonsrc/main/claude,src/shared/agent-status,src/shared/agent-hook-listener: 22 files, 78 tests passing.pnpm typecheck(tsconfig.node.json): passing.oxlintandoxfmt --checkon the changed files: clean.Performance
None, because a wake adds one map entry per child ending, and the expiry timer only runs while a wake is held.
Risk
Level: Low
The riskiest part is the restored edge acting on a record the provider has moved on from. It only runs when the lease expires and the live record is still the woken, running one; a stop, a failed ending, or a new spawn leaves a different record and is left alone. A real resume always sends a frame naming the owner, which releases the lease — so the failure mode is at worst a 60-second delay before a genuinely resumed owner is shown working again.
Reversible with a plain revert; nothing persisted depends on it.
AI Disclosure
Claude (Anthropic) was used to read the event pipeline, write the change and its tests, and run the checks above. I read the decoder and the admission/fold path it feeds before choosing the approach, and reproduced the current behaviour in the test before changing it.
Review
Self-review summary:
ClaudeChildWorkDecoder; other providers keep their own trackers.Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)