Repository navigation
feat(native-chat): Claude sessions write their subagents into the host status store - #22536
Conversation
There was a problem hiding this comment.
Important
The reducer drops a task_updated-driven resume. The tracker revives a settled background child on an edge-only task_updated patch and queues a plain live edge, but the reducer treats it as late evidence and leaves the record settled — the legacy row and the record disagree on the same frame. It is conditional (only reachable before the first background_tasks_changed), so I have flagged it rather than blocked, but C5 will read these records and this reintroduces exactly the stale-settled class of bug this stack exists to remove.
Reviewed changes
- Claude producer —
claude-child-work-evidence.tsdecodes task frames into live / ended / inventory / turn-ended / session-ended / restart edges; the tracker queues one at each decision it already makes and drains them after the journal and the legacy republish. The journal translator gains read-onlychildToolOwner/childActivity. - Host delivery — a subject-gated
ingestStructuredChildWorkon a new server class link, reached through the feed'spublishChildWorkand the ownershiplandedgate from bothmain-process-runtime-service.tsandorcad-entry.ts. - Reducer —
reconcileAgentChildWorkEvidencefolds the edges into the canonical store through C2 admission, with 256-live / 32-settled caps and per-producer ownership. - Tests — 8 files; the producer test shadow-checks the parent state folded from records against the legacy
backgroundTasksDTO frame by frame.
ℹ️ The unproven-exit window has no child-record consequence
session-ended is only ever produced from backgroundTasks.clear(), which the close ladder reaches only after connection.close() proves the child gone. On an unexpected exit whose tree proof fails, no ended event is emitted, so no edge reaches the store and the run's children stay live under the session's subject. If a replacement is then acquired under the same session id, those records outlive the dead provider session until the replacement ends and removes them with its own session-ended. This may be the intended reading of "loss of contact is never evidence of process death", but C5 will render these records, so it is worth an explicit decision plus a test.
Technical details
# Children of an unproven-exit session stay live across a same-id reacquire
## Affected sites
- `src/main/claude/claude-structured-session-adapter.ts:130-161` — `settleUnexpectedExit` emits the `ended` event (and therefore `session-ended`) only after `close()` returns true.
- `src/main/claude/claude-structured-session-close.ts:100-115` — `finalizeClaudePublishedSession` calls `backgroundTasks.clear()` only when `connectionClosed === true`.
- `src/main/claude/claude-structured-session-recovery.test.ts:402-418` — pins that an unproven exit produces no `ended` event.
## Required outcome
A decision (and a test) on what the child records of an unproven-exit session should read once a replacement is acquired under the same session id: remain `live` until the replacement ends, or settle to `unknown`/be removed when the old provider session is superseded.
## Open questions for the human
- Is a stale-`live` record under a reacquired session id acceptable until the replacement ends, or should the host settle the old subject's children when the provider session is proven gone?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const existing = resolution.child | ||
| const request = { parent: ctx.parent, provider: ctx.provider } | ||
| const aliases = agentChildWorkHandleAliases(handle) | ||
| if (!existing) { |
There was a problem hiding this comment.
This is the only check of STRUCTURED_CHILD_WORK_MAX_LIVE, so the advertised 256-live bound holds only for brand-new children. The resume branch below (a new spawn call, or an inventory re-listing a settled child) moves a settled record back to live with no capacity check, so a session can run past 256 live records — e.g. settle 32 of 256 live children, admit 32 fresh ids, then resume the settled 32 under new spawn calls. The provider trackers never carry those resumed runs, so nothing else bounds the live count. Computing the live count before both branches, rather than only the create path, keeps the documented bound honest.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The restarted-run fix is correct and its tests pass, but two findings from the previous review remain open and unaddressed, so this is not an approval.
Reviewed changes
Only fc7fd5d8ab ("a Claude child restarted under a new spawn call keeps reporting to its record") landed since the prior pullfrog review — 6 files.
- New
ClaudeTaskRestartsstore — a task that ended under one spawn call and starts again under another is held in a bounded (256-entry) map, withtake/get/clearwired into the tracker'sfinish,clear, roster replacement,task_progress, and spawn-result lookups. - Restarted-run evidence —
task_progressresolves a restarted run throughthis.restarts.get(id), and a foreground restart's own spawntool_resultresolves throughrestarts.tasks, so that run's operation, usage, and ending reach the record before any roster lists it. - Roster hand-back —
replaceClaudeAggregateRostertakes the restarted task so a listing resumes it under the new spawn call instead of the stale settled one. - Tests — two tracker tests (restart progress before a roster; a restarted foreground run ends on its own spawn result) and a producer run-count parity test asserting the record's
invocation.generationmatches the journal roster'sattempt.
I traced the restart path through task_progress, its own spawn result, repeated restarts, roster hand-back, and turn boundaries; the record tracks the legacy row as the PR body documents (the record hears the restart at once, the legacy row waits for a roster — a deliberate divergence). The two earlier inline findings live in code this delta does not touch and remain open.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
d5ad80a to
7cfb048
Compare
fc7fd5d to
6818421
Compare
3bb417f to
6de7f20
Compare
d5ffa7f to
eada18c
Compare
There was a problem hiding this comment.
ℹ️ No critical issues. The new commit is a retention refactor; one edge case is worth a decision inline. The two findings from the earlier review are in code this commit does not touch and remain open.
Reviewed changes
Only eada18c2 landed since the prior pullfrog review (the branch was replayed onto a newer c2-child-record-contract, so the earlier commits are unchanged in content).
- Retention moved into admission —
liveFieldsandsettleAgentChildWorknow send only the facts the edge observed, delegating labels, model, owner, residency, last message and monotonic tokens toretainedFacts. Verified equivalent on the announce, adopt and resume paths, each of which passes the stored record asprior. - Token source narrowed —
claudeTaskObservationnow reads onlyfacts.totalTokens, dropping the tracked task'stask.totalTokensfallback.
Verified locally: claude-child-work-evidence (8), agent-status-child-work-reconciliation (16) and claude-structured-child-work-producer (3) all pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| // The published row names a task's type as both its name and its agent type. | ||
| ...(task.name ? { name: task.name, agentType: task.name } : {}), | ||
| ...(task.description ? { description: task.description } : {}), | ||
| ...(facts.totalTokens !== undefined ? { totalTokens: facts.totalTokens } : {}), |
There was a problem hiding this comment.
With the task.totalTokens fallback gone, a child's token count survives only while its record does — retainedFacts can retain from a prior record but cannot recreate one. The 32-settled cap in trimSettled can evict a settled record while the tracker still holds the task, so a child re-listed by a roster or restarted under a new spawn call is admitted proven-new with no prior and loses the count (these edges pass no facts). The tracked task still carries it here, so the legacy row and the record diverge until the next task_progress. Worth a decision: accept the gap, or carry the task's count on those edges.
Technical details
# An evicted-then-revived child loses its token count
## Affected sites
- `src/main/claude/claude-child-work-evidence.ts:80` — only `facts.totalTokens` is read now; the inventory, `upsert` and restart edges pass no `facts`.
- `src/shared/agent-status-child-work-reconciliation.ts:129-148` — `trimSettled` removes settled records past 32, leaving the tracker's task in `ClaudeSettledBackgroundTasks` / `ClaudeTaskRestarts`.
- `src/shared/agent-status-child-work-evidence-admission.ts:156-177` — a handle whose record is gone is admitted `proven-new`, calling `liveFields(..., null, null)`, so no prior exists to retain from.
## Required outcome
A revived child carries the same token count the legacy row does. Either keep the tracked task's `totalTokens` on the inventory / restart edge, or record a decision that the count may read absent until the next `task_progress`.
## Open question for the human
Is losing the count acceptable here, given #22614 renders tokens from these records?6de7f20 to
41d814b
Compare
eada18c to
503eb83
Compare
…bscriptions as they are subscribeStatus and subscribeTurnCompletions wrapped client delivery's bound methods in forwarding lambdas; they are now the same members, the way waitForSendSettlement already is. The host is at its size limit, and the next channel it hands out needs the line.
…t status store The Claude background-task tracker queues child-work evidence at each decision it already makes (start, update, progress, terminal frame, roster replacement, turn end, session end), plus the two facts its legacy row ignores: a foreground child's progress and a foreground spawn call's result. The adapter drains that evidence after the journal handled the frame and the parent row was republished, and the host folds it into one record per child in its canonical store. Nothing reads the records yet; the strip and sidebar keep their current sources.
…child record The adapter delivers evidence after the frame's journal rows and the parent's republished row; the frame script keeps the parent state today reads while the records add outcome and activity; the runtime hands the evidence to the status sink under the session's own address; both entry points wire the sink to the ingest.
…its record says it is doing A child's tool traffic reaches the parent stream only for a foreground child. Read after the journal handled the frame, the child's newest call still awaiting a result becomes its open operation, previewed the way a hook-reported row previews its own tool; the result closes it. The open call is derived from the journal's own bookkeeping, not held a second time.
…ps reporting to its record A task that ended and starts again stays hidden from the legacy row until a roster lists it, so the tracker held no run for it: the new run's progress reached nothing and a foreground re-run's own spawn result settled nothing. The run is now held beside the live map, where the legacy row never reads it, until a roster hands it back or it ends. A parity test pins the record's run count to the journal roster's attempt on a new spawn call, the one event both count.
…ontract get their own homes The translator's child-tool queries move into claude-child-tool-queries.ts and its contract type into claude-journal-translator-contract.ts. Brings the translator back under the size limit.
…e's facts Admission now keeps what a child's record already knows: labels, model, owner, residency, the last message within an invocation, and a token count that never shrinks. The evidence side copied all of those forward itself, a second owner of the same rule. It now sends only what this edge observed, and a task's token count comes from the frame that reported it.
…labels Admission now folds provider text to one line and drops a malformed fact instead of refusing the record, so the evidence side no longer folds labels itself. The description keeps admission's longer bound.
503eb83 to
fa71175
Compare
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change adds structured child-work evidence types, reconciliation, and bounded record retention. Claude task events produce live, operation, terminal, and inventory evidence, which the structured-session runtime forwards through status ownership to canonical ingestion. Ingestion requires a valid structured-session subject and stored parent. Store helpers support alias and tombstone lookup. Tests cover event handling, reconciliation, forwarding, and session isolation. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to The child-work path may become slower as alias history grows. Resolve or explicitly accept that risk before merging; also strengthen the new test to verify settlement before notification enrichment. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to A delayed tool event from an earlier run may be recorded as the current run’s activity after a child restarts. The effect is limited to status data for that child and session, but it weakens the accuracy of records intended for later display. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/shared/agent-status-child-work-evidence-resolution.ts (1)
155-157: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoffAvoid full alias scans for child lookups.
getAliasesForChildscans every stored alias before filtering bychildWorkId. The lookup atsrc/shared/agent-status-child-work-evidence-resolution.ts:155-157therefore has linear cost in the alias count. If this path is hot, maintain an index keyed bychildWorkId.The alias-retention claim is not valid: removing a child also removes its aliases, and
AGENT_STATUS_STORE_LIMITS.aliasesbounds the total alias count.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b2049632-a4c3-4743-961e-35f553080726
📒 Files selected for processing (32)
src/main/agent-hooks/server-ingest-structured-children.test.tssrc/main/agent-hooks/server/server-ingest-remote.tssrc/main/agent-hooks/server/server-ingest-structured-children.tssrc/main/claude/claude-background-task-aggregate-roster.tssrc/main/claude/claude-background-task-restarts.tssrc/main/claude/claude-background-task-tracker.tssrc/main/claude/claude-child-tool-queries.tssrc/main/claude/claude-child-work-evidence.test.tssrc/main/claude/claude-child-work-evidence.tssrc/main/claude/claude-journal-translator-contract.tssrc/main/claude/claude-settled-background-tasks.tssrc/main/claude/claude-structured-child-work-producer.test.tssrc/main/claude/claude-structured-journal-translation.tssrc/main/claude/claude-structured-session-adapter.tssrc/main/claude/claude-structured-session-state.tssrc/main/native-chat/agent-session-wire/structured-agent-session-client-delivery.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-feed-child-work.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-feed.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-ownership.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-ownership.tssrc/main/orcad/orcad-entry.tssrc/main/runtime/claude-structured-session-integration.test.tssrc/main/runtime/orca-runtime-structured-status-sink-wiring.test.tssrc/main/runtime/structured-agent-session-runtime.tssrc/main/runtime/structured-claude-runtime-adapter.tssrc/main/startup/main-process-runtime-service.tssrc/shared/agent-status-child-work-evidence-admission.tssrc/shared/agent-status-child-work-evidence-resolution.tssrc/shared/agent-status-child-work-evidence.tssrc/shared/agent-status-child-work-reconciliation.test.tssrc/shared/agent-status-child-work-reconciliation.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The one new commit is a behavior-preserving refactor; the three earlier findings remain open, so this is not an approval.
Reviewed changes
Only fa71175a68 ("Claude child evidence hands admission its raw labels") landed since the prior pullfrog review — 2 files, +6/-27.
- Label folding moved into admission —
liveFieldsnow passeschild.name/description/agentTypethrough raw;parseObservationFactsfolds them withnormalizeChildWorkText(control chars and line separators to spaces, trimmed) before the codec sees them, so the producer no longer owns that rule. - Description keeps admission's longer bound — the removed
childWorkLabelcapped every label at 512;descriptionnow usesAGENT_CHILD_WORK_DESCRIPTION_MAX_LENGTH(8,000), whilename/agentTypestay at 512. - Dead helper removed —
childWorkLabel, itsnormalizeOptionalFieldimport, and the label-bound constants are gone. - Test renamed — the reconciliation test now states that admission owns the folding.
This also closes a latent edge the old helper left open: childWorkLabel folded only C0/DEL, so a label containing U+0085/U+2028/U+2029 would have failed the codec's isChildWorkText check and refused the whole record. Delegating to normalizeChildWorkText folds those too, so the value always satisfies the codec. Verified pnpm test on the reconciliation (16) and evidence (8) files and pnpm tc:node, all green.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…nding The reconciliation returned before admission whenever a record had already settled with a definite outcome. That dropped the evidence an `unknown` ending carries (its last message and tokens), which admission's refine-only rule keeps, so that rule never ran for the structured producers. The latch goes. Admission keeps the definite outcome, lands the late evidence, and refuses a conflicting definite ending as `stale-invocation`, which the host ingest already counts as the fence doing its job, not a fault. Pinned through the real Claude producer and the host's own ingest.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The new commit is a small behavioral fix whose tests can fail; the three earlier findings remain open, so this is not an approval.
Reviewed changes
Only bf82728df6 ("admission alone decides a settled child's second ending") landed since the prior pullfrog review — 2 files.
- Second-ending ownership moved into admission —
applyEndedno longer returns early once a settled child has a definite outcome. Every current ending now reachessettleAgentChildWork, and admission'sconflictsWithSettleddecides: anunknownending keeps the stored definite outcome while still landing its last message and monotonic tokens, and a conflicting definite ending is refused asstale-invocation. - Tests — the producer harness can now route evidence through a real
AgentHookServer. A settled foreground child is sent an unclassifiedtask_notification(asserts its summary and usage land while the outcome stayssucceeded) and a conflictingfailednotification (assertssettled: 0, astale-invocationrefusal, and noconsole.warn/error).
I traced the removed latch through settleAgentChildWork → updateExistingAgentChildWork → conflictsWithSettled and mergeObservationFacts: the new comment matches the code, server-ingest-structured-children.ts already treats stale-invocation as an expected fence refusal, and both new tests would fail under the old early return. The three earlier inline findings (agent-status-child-work-evidence-admission.ts revive/cap and the claude-child-work-evidence.ts token gap) sit in files this commit does not touch and remain open.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: c506d7e3-3703-41b4-88cf-f4ab9b02e077
📒 Files selected for processing (2)
src/main/claude/claude-structured-child-work-producer.test.tssrc/shared/agent-status-child-work-reconciliation.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| if (agentChildWorkRunVerdict(ctx, existing, edge.handle.runId) !== 'current') { | ||
| return | ||
| } | ||
| // Admission owns what a second ending may change: an `unknown` one keeps a definite outcome and | ||
| // lands its evidence; a conflicting definite one is refused as `stale-invocation`. | ||
| settleAgentChildWork(ctx, existing, edge.outcome, edge.observedAt, { | ||
| ...(edge.lastMessage !== undefined ? { lastMessage: edge.lastMessage } : {}), | ||
| ...(edge.totalTokens !== undefined ? { totalTokens: edge.totalTokens } : {}) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '130,235p' src/main/claude/claude-background-task-tracker.ts
sed -n '185,230p' src/shared/agent-status-child-work-evidence-admission.ts
sed -n '240,270p' src/main/claude/claude-child-work-evidence.test.tsRepository: stablyai/orca
Length of output: 6991
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- tracker symbols and notification construction ---'
rg -n -C 8 'pendingClaudeNotification|restarts|terminalTaskIds|task_notification|observeSystemFrame|finish\(|spawnResult|runId' src/main/claude/claude-background-task-tracker.ts src/main/claude src/shared
printf '%s\n' '--- reconciliation implementation and classifier ---'
rg -n -C 12 'agentChildWorkRunVerdict|runId|settleAgentChildWork|reconcileAgentChildWorkEvidence|task_notification|unknown|current|stale-invocation' src/shared/agent-status-child-work-reconciliation.ts src/shared/agent-status-child-work-evidence-admission.ts
printf '%s\n' '--- relevant tests ---'
rg -n -C 12 'status-less|notification|restarted|restart|runId|toolu_fg|agent-fg|lastMessage|totalTokens' src/main/claude/claude-child-work-evidence.test.ts src/main/claude src/shared --glob '*test*'Repository: stablyai/orca
Length of output: 45659
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- tracker core ---'
sed -n '1,125p' src/main/claude/claude-background-task-tracker.ts
sed -n '175,325p' src/main/claude/claude-background-task-tracker.ts
printf '%s\n' '--- restart implementation ---'
cat -n src/main/claude/claude-background-task-restarts.ts
printf '%s\n' '--- notification producer ---'
rg -n -C 20 'function pendingClaudeNotification|pendingClaudeNotification|runId|invocation' src/main/claude/claude-child-work-evidence.ts
printf '%s\n' '--- reconciliation implementation ---'
rg -n -C 18 'agentChildWorkRunVerdict|reconcileAgentChildWorkEvidence|settleAgentChildWork|runId' src/shared/agent-status-child-work-reconciliation.ts
printf '%s\n' '--- producer restart test ---'
sed -n '330,430p' src/main/claude/claude-structured-child-work-producer.test.tsRepository: stablyai/orca
Length of output: 29223
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- run verdict and admission ---'
rg -n -C 25 'function agentChildWorkRunVerdict|agentChildWorkRunVerdict|lifetime|stale-invocation|outcome|lastMessage|totalTokens' src/shared/agent-status-child-work-evidence-admission.ts
printf '%s\n' '--- second-ending tests ---'
sed -n '400,560p' src/main/claude/claude-structured-child-work-producer.test.ts
printf '%s\n' '--- notification and run-id tests ---'
rg -n -C 18 'task_notification|pendingClaudeNotification|runId.*undefined|undefined.*current|second ending|stale-invocation|lastMessage.*totalTokens' src/main/claude/*test.ts src/shared/*test.tsRepository: stablyai/orca
Length of output: 45663
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- spawn result and handle construction ---'
sed -n '90,220p' src/main/claude/claude-child-work-evidence.ts
printf '%s\n' '--- tracker ordering tests ---'
rg -n -C 20 'task_started|task_notification|tool_use_id|delayed|late|notification' src/main/claude/claude-background-task-tracker.test.ts src/main/claude/claude-child-work-evidence.test.ts src/main/claude/claude-structured-child-work-producer.test.ts
printf '%s\n' '--- changed reconciliation diff ---'
git diff 58ba75b5a5fc762e64073b51e481f1832242aa09 bf82728df66ed17e1b0ebab9ae3f43de42ef7a80 -- src/shared/agent-status-child-work-reconciliation.ts src/shared/agent-status-child-work-evidence-admission.ts src/main/claude/claude-child-work-evidence.ts src/main/claude/claude-background-task-tracker.ts
printf '%s\n' '--- notification payload/tool-use fields ---'
rg -n -C 8 \"task_notification|tool_use_id|task_id.*summary|summary.*usage\" src/main/claude src/shared --glob '*.ts' --glob '*.json'Repository: stablyai/orca
Length of output: 40402
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- notification payloads with tool-use fields ---'
rg -n -C 5 'task_notification' src/main/claude src/shared --glob '*.ts' | rg -n -C 3 'task_notification|tool_use_id|summary|usage'
printf '%s\n' '--- tracker update path ---'
sed -n '140,215p' src/main/claude/claude-background-task-tracker.ts
printf '%s\n' '--- task-id/run-id helpers ---'
rg -n -C 10 'function taskId|function taskAliasId|const taskId|const taskAliasId' src/main/claude/claude-background-task-frames.tsRepository: stablyai/orca
Length of output: 41867
🏁 Script executed:
#!/bin/bash
set -e
sed -n '1,70p' src/main/claude/claude-child-work-evidence.ts
sed -n '136,150p' src/main/claude/claude-child-work-evidence.tsRepository: stablyai/orca
Length of output: 3540
Preserve the notification run ID.
Real Claude notifications can include tool_use_id, but pendingClaudeNotification drops it. A delayed notification from toolu_old is then classified as current and can overwrite the newer run's lastMessage and totalTokens.
Suggested fix
-import { record, taskText, taskUsageTotalTokens } from './claude-background-task-frames'
+import { record, taskAliasId, taskText, taskUsageTotalTokens } from './claude-background-task-frames'
...
return pendingClaudeTaskEnded(id, claudeChildWorkOutcome(message.status), {
lastMessage: taskText(message.summary),
- totalTokens: taskUsageTotalTokens(message)
+ totalTokens: taskUsageTotalTokens(message),
+ toolUseId: taskAliasId(message.tool_use_id)
})Notifications without tool_use_id remain unclassified and retain the existing same-run behavior.
Child records made every store write and every status notification scale with the whole store. Each Claude child progress frame cost about 2 ms with 5 chats holding ~200 child records (about 14 ms at ~1,400), and every status change on any lane re-parsed every child record just to list parent rows. - The store derives each frozen record's key once instead of re-parsing it on every mutation's validation and every alias lookup. - Settled history is trimmed only when a batch settles something. - Parent listing and the structured row's revision stamp read the parents and the revision directly instead of building a full snapshot. A progress frame now costs about 0.3 ms at the same size, and listing parent rows no longer depends on how many child records the store holds.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The performance commit is behavior-preserving; three earlier findings remain open in code it does not touch, so this is not an approval.
Reviewed changes
Only 4f4885a0d8 ("perf(agent-status): keep child records off the status hot paths") landed since the prior pullfrog review — 8 files, +107/-22, no tests. The motivation is that child records made every store write and every status listing scale with the entire store.
- Frozen-record key memoization — a new
agent-status-store-record-keys.tscaches each frozen record's derived key in moduleWeakMaps (storedAliasKey,storedBindingKey,storedRetiredAlias,storedTombstoneKeyIsValid), and store validation plus alias lookup now use it. Stored records are deep-frozen at insertion, so the cache premise holds; each site is otherwise byte-equivalent to its former inline derivation. - Subject serialization memoized —
serializeAgentStatusSubjectcaches by frozen-subject identity and only for frozen inputs. - Direct parent listing and revision stamp —
getParents()/getRevision()avoid materializing a full snapshot; the listener's listing and the structured row's revision stamp use them. - Gated settled trim —
trimSettledruns only when a batch actually settled something; only an accepted settle raises that counter, so the 32-settled cap still holds on every batch.
I traced the new fast paths against the prior behavior: the memoized keys are only cached for immutable records, getParents() returns the same frozen records the snapshot parsed, getRevision() supplies exactly the epoch/revision the stamp consumed, and no other AgentStatusStore implementor needed the new methods. Verified pnpm test on the six store/ingest suites (50 passed, 1 expected fail).
ℹ️ Nitpicks
server-ingest-structured.ts:64—const snapshot = …getRevision()now holds a{ epoch, revision }pair, not a snapshot. Renaming it (revision) would keep the code honest about what the perf change intentionally avoided building.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…w the child ended Interrupting a foreground Claude agent while it runs a tool delivers the spawn call's errored result before the child's own killed/stopped frames. The spawn result settled the record `failed` first, and admission then refused the later `cancelled` as a conflicting ending, so an interrupted child read as a failure. An errored spawn result now settles the child `unknown`; the child's own terminal frame refines it to `cancelled` or `failed`. A successful spawn result still settles `succeeded`. The test replays both frame orders the real CLI produced when interrupted.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The new commit corrects an interrupted foreground child's ending; the three earlier findings remain open, so this is not an approval.
Reviewed changes
Only a366ecca ("an errored Claude spawn result no longer decides how the child ended") landed since the prior pullfrog review — 3 files, +56/-5.
- Errored spawn results settle
unknown—claudeSpawnResultsnow maps a foreground spawn call's erroredtool_resulttounknowninstead offailed.is_errorcannot separate an interrupt (the user's stop is delivered as an errored result, the same conflationclaude-result-outcome.tsdocuments) from a genuine fault, so the child's own terminal frame is left to say which. - Tests — the evidence test's expectations move to
unknown; the producer test sends atask_notification status: failedafter an errored spawn result to prove refinement tofailed, and a newit.eachreplays both frame orders the real CLI produces when interrupting a foreground agent, assertingcancelled.
The bug: the errored spawn result settled the record failed first, and admission's conflictsWithSettled refuses a definite ending that conflicts with a stored definite one, so the later cancelled was rejected as stale-invocation and an interrupted child read as a failure. An unknown ending is refine-only in mergeObservationFacts (keeps a definite outcome while landing last message/tokens) and conflictsWithSettled never rejects it, so the terminal frame now lands the right outcome. applyEnded's agentChildWorkRunVerdict !== 'current' guard still drops a previous run's spawn result, so this does not reach across runs.
Verified: pnpm test on claude-structured-child-work-producer.test.ts and claude-child-work-evidence.test.ts — 15 passed.
ℹ️ Nitpicks
- The PR description's "What the producer writes" table still documents the spawn-result row as "
succeeded, orfailedwhenis_error", which this commit changes tounknown. Worth updating so the stack's contract description matches the code.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The real CLI ends a foreground agent with its own completed update, then a notification carrying the final summary and usage, and only then the spawn call's result. Existing tests modeled the spawn result arriving first, so nothing checked that the notification's summary and tokens still land on a record the update already settled.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/claude/claude-structured-child-work-producer.test.ts (1)
550-550: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAssert settlement before the notification.
task_updatedqueues a successful terminal edge, but the latertask_notificationalso queues a successful terminal edge with the final summary and usage. If the first edge is ignored, the final assertion can still pass. Add the intermediate assertion.Suggested assertion
send(system('task_updated', { task_id: 'agent-fg', patch: { status: 'completed' } })) + expect(byDescription('Run echo hi command')).toMatchObject({ + membership: 'settled', + outcome: 'succeeded' + })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 70062209-7cdb-45c5-b8e6-9ba8ec582291
📒 Files selected for processing (1)
src/main/claude/claude-structured-child-work-producer.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
…e store With child records on the host, every mutation copied all five store maps and re-validated every record, and reads scanned every child and alias. A parent status publish cost about 10 ms with 4,000 child records in the store, and a child update about 13 ms. - A mutation writes into drafts over the committed maps and lands in place; a refused one is dropped with nothing to undo. The drafts keep the exact map order a copy would have. - Only what a mutation touched is re-validated: touched parents, children, aliases, facts and tombstones, plus every alias of a touched child and whatever a removed parent owned. The full validation stays for snapshot restore. - The snapshot byte budget is a running total instead of a re-measure. - Children by parent, facts by parent, aliases by child, aliases by identity and retired aliases are indexed, so reads return stored records without scanning or re-parsing. - The memoized alias identity and tombstone-key checks are gone: indexes derive them once. A parent publish now costs about 0.015 ms and a child update about 0.06 ms at 40, 1,000 and 4,000 children alike. A seeded fuzz holds the store to the copy-and-validate-everything path decision for decision, snapshot for snapshot and read for read, and a replica fed the envelopes ends identical.
The child records were fed from the legacy background-task tracker's display decisions, so they inherited rules that are not truth: a turn ending swept foreground children, a roster omitting a background child settled it, a foreground spawn call's result ended the child, and a new background start after any roster produced no record. Captured from the real CLI, an agent moved to the background keeps its own shell running for 40 s after the parent's turn ends, and that shell was settled `unknown` at the parent's `result`. Replayed with the spawn result ahead of the roster, the same agent settled as a false success and was then revived as a spurious second run. A new decoder reads the task frames directly. `task_started` opens a child (a start for an ended task id is a restart, the way messaging a finished agent resumes it), progress and a live `task_updated` update it, and a terminal `task_updated` or `task_notification` ends it. Rosters, turn ends and spawn results say nothing about a child. Every child in every capture gets its own terminal frame, so no evidenced ending is lost. The notification's `tool_use_id` names the run that ended (captured on a resumed agent's second run), so an ending from a run that is already over no longer ends the current one; a run id the record never saw still ends it, so nothing strands. The tracker, its settled-task retention and the frame readers are back to exactly what main has: the aggregate-roster split and the restart holding map are deleted, and the legacy row is unchanged by construction.
…of erasing them When a structured session ended, the reducer removed every child record it held, finished or not, so a reader could no longer tell how the session's work had ended. Now a child still live when its session ends settles `unknown` (nothing reported how it ended), and a child that had already ended keeps its outcome. The records still die with their parent: closing or releasing the session drops the parent row, and the store drops its children with it. A child's own outcome arriving after the session ended still refines the `unknown`. The `inventory` and `turn-ended` edges, and the rules that settled children on a roster omission or at a turn boundary, are deleted: no producer sends them any more. A restart is now its own flag on a live edge, which is what a producer reports when a finished child starts again under the same run handle.
…eal host Scrubbed cuts of five Claude CLI 2.1.280 stream-json captures (ids, paths and prompts replaced, frame order and relative clock kept), replayed through the adapter into a hook server: - an agent moved to the background keeps its own shell live past the parent's turn, and the shell settles at its own notification's time; - the same capture with the spawn result ahead of the move ends the agent once, from its own notification, with no second run; - a roster that omits a background child without its own ending leaves it live; - a session that ends settles what still runs `unknown` and keeps every record; - messaging a finished background agent opens its second run, which ends from its own frame; - interrupts in both captured orders end `cancelled`, and a finished foreground agent keeps its summary and usage.
There was a problem hiding this comment.
ℹ️ No new code issues in this incremental delta. The producer rearchitecture and the in-place store rewrite are coherent and strongly tested; two earlier findings remain open in code this delta does not touch, and the PR description no longer matches the producer it now ships.
Reviewed changes
Since the prior review baseline (7efdd97), four commits landed:
- Producer rearchitecture — the tracker no longer feeds child records. A standalone
ClaudeChildWorkDecoderreads task frames and queueslive/ended/session-endededges; a child is live fromtask_starteduntil its own terminal frame, so a roster, a turn ending, or a spawn call's result no longer settles one.inventoryandturn-endededges are deleted from the contract, replaced by arestartflag for a start reported on an ended child.ClaudeBackgroundTaskTrackerreverts to its base legacy-only shape, and the restarts / aggregate-roster modules are removed. - Session end settles instead of erasing —
session-endednow settles the session's still-live childrenunknown(a later definite ending still refines it) and keeps them under the 32-settled cap; the reducer'ssettleLivereplaces the old removal. - Store writes in place — mutations draft over the committed maps, revalidate only touched records and their dependents, enforce the byte budget from tracked per-record sizes, then commit drafts and indexes.
getChildren/getAliasesForChild/ alias resolution read the new indexes. A copying-store oracle holds the in-place store to the prior decisions and snapshots, decision for decision. - Tests — real Claude CLI 2.1.280 captured frame orders replayed through the adapter into a real hook server (interrupt orders, foreground success, moved-to-background, message-resumed agent, session close), plus decoder, reducer, and store equivalence / bounds / scaling suites.
ℹ️ The PR description still documents the removed producer
The body's "What Changed" producer sections and Testing tables describe code that no longer exists at this head: tracker-queued evidence, the inventory and turn-ended edges, claude-background-task-restarts.ts, "the session's records are removed" on ended, and the frame-by-frame shadow check with its ablation table. Downstream PRs (#22553, #22614) read this description as the producer contract, so it should be refreshed.
Technical details
# PR description no longer matches the shipped producer
## Affected sites
- PR body `### The path from a Claude frame to a record, hop by hop` — still routes evidence through the tracker's `drainClaudeChildWork`; it now comes from `ClaudeChildWorkDecoder`.
- PR body `### What the producer writes` table — lists `inventory` (`background_tasks_changed`) and `turn-ended` (`result` / new turn) rows and "session `ended` / close → the session's records are removed". Both edge types were deleted; a restart is now a `restart: true` live edge, and session end settles live children `unknown` and keeps them.
- PR body `### The tracker (legacy row unchanged)` / `### Ported from #21279` — describes `claude-background-task-restarts.ts` and `claude-background-task-aggregate-roster.ts`, both deleted; the tracker is back to its base shape and carries no `toolUseId`.
- PR body `## Testing` — the shadow check and the per-ablation table reference `foldAgentLeadStatus` parity and inventory/turn-ended ablations; that harness was replaced by the captured-frame replay tests.
## Required outcome
The description's mechanism, edge vocabulary, and testing sections reflect the decoder model: own-frame endings only, no inventory/turn-ended edges, session-end settles, one decoder state, and the captured-frame replay tests.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…o a rebuild The copying-store fuzz never reaches the snapshot byte budget, so a drift in the running byte total (or any index the public reads do not surface) passed it. After every fuzzed step, including refusals, compare every index with one rebuilt from the committed maps.
There was a problem hiding this comment.
ℹ️ No new issues in this incremental delta. The one commit since the prior review is test-only and the added test is discriminating; two earlier findings remain open in code it does not touch, so this is not an approval.
Reviewed changes
Since the prior review baseline (ed592e8a83), one commit landed: 94e5159f52 (test-only, +53/-1).
- Index-equivalence fuzz test —
src/shared/agent-status-store-in-place.test.tsnow drivescommitAgentStatusStoreMutationover 1,500 mutations at seeds 3 and 99 and, after every step, asserts the runningAgentStatusStoreIndexes(the per-parent / per-child / per-identity sets, each table's map order, andrecordBytes) equalsindexAgentStatusStoreStaterebuilt from the committed maps. Both committed and refused mutations are exercised.
I ran pnpm test src/shared/agent-status-store-in-place.test.ts: 7 passed (45s). The new case is not vacuous — the sibling oracle case on the same mutations() builder asserts accepted > 300 of 1,500 at its seeds, so commits reach the index path under check.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review status: ready for review at
|
Resolve conflicts with the terminal-handoff removal (#22783): take main's runtime wiring and integration test, and re-apply this branch's Claude child-work evidence wiring and the status-sink child-work test.
There was a problem hiding this comment.
ℹ️ No new issues in this merge-only delta — two earlier findings remain open, so this is not an approval.
Reviewed changes
Only 1a9c5ee42e (a merge of origin/main into the branch) landed since the prior pullfrog review (94e5159f52). main had meanwhile removed the unused terminal handoff and advanced the model-catalog work, so the merge reconciles this PR against that base.
- Claude integration test realigned — the suite dropped its
handoffTransportscaffolding for a hoststatusSink;publishChildWorknow collects intochildWork, and the assertion proves atask_startedframe reaches the sink under the session's own address. - Adapter deps merged —
structured-claude-runtime-adapter.tsnow carriesmain'smodelCatalogalongside this PR'sonChildWorkEvidence, andstructured-agent-session-runtime.tskeeps theonChildWorkEvidencewiring. - Base alignment — 686 files of
maincontent brought in; no conflict-resolution bug found in the files this PR owns.
Verified at this head: pnpm tc:node exits 0, and 6 focused suites (Claude integration, status-feed child work, ownership, sink wiring, runtime, host) — 77 tests — pass.
The two open findings from earlier reviews live in code the merge does not touch: the 256-live cap is still enforced only on the create path in agent-status-child-work-evidence-admission.ts, and an evicted-then-revived child can still lose its token count until the next task_progress.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
When a Claude chat starts a subagent or a background shell, Orca now keeps one record for it on the machine running the chat. The record says what kind of work it is, whether it is still running, what tool it is using right now, how it ended (finished, failed, stopped, or "ended, reason not reported"), and when. A record ends only when that piece of work itself says it ended: not when the chat's own turn ends, not when Claude's list of background work stops mentioning it, and not when the call that started it returns. Nothing on screen reads these records yet, so this PR changes nothing you can see. The switch is #22614, at the top of this stack (this PR → #22553, the Codex producer → #22565, the shared row → #22614), which points the sidebar and the chat strip at these records and deletes the legacy background-task path. Because the sidebar will read these records directly, a record that ended early would show Done while work still runs; this PR makes sure that cannot happen.
Supersedes #21279. #22521 (the child-record contract) has merged, so this PR's base is now
main.Merge order
What Changed
The path from a Claude frame to a record, hop by hop
emit(claude-structured-session-adapter.ts). A new per-session decoder (claude-child-work-decoder.ts) reads the frame's task fields. The background-task tracker observes the frame exactly as onmain. The journal translator writes the frame's rows. The legacy background-task state is republished (so the parent's own status row lands first). Only after all of that,drainClaudeChildWork(claude-child-work-evidence.ts) collects the decoder's edges, names each child's owner, adds the child's own open tool call, and callsonChildWorkEvidence(sessionId, evidence). A close clears the decoder outsideemit, socloseSessionandreleaseAcquisitiondrain it afterwards too.structured-agent-session-runtime.ts→structured-claude-runtime-adapter.ts) routes it tohost.publishChildWorkEvidence.publishChildWork) looks up the session's provider.structured-agent-session-status-ownership.ts) forwards it only under the subject the session's parent row actually landed under. If that publish threw, it forwards nothing.orcad-entry.ts,main-process-runtime-service.ts):publishChildWork→agentHookServer.ingestStructuredChildWork.server-ingest-structured-children.ts, in the server class chain) refuses a subject whose parent row the store does not hold. Otherwise it runs the reducer against the host's canonical store.agent-status-child-work-reconciliation.ts, plus…-evidence-admission.tsand…-evidence-resolution.ts) turns each edge into feat(agent-status): child work records say what the child is doing, how it ended, and when #22521's admission calls (announce/adopt/resume). Records live in memory only and are never persisted or transmitted.What the producer writes, and from which frame
task_started(not ambient, not hidden from the transcript)live(task id + spawn call, kind, residency fromis_backgrounded, name/agent type, description){spawn call, 1}, aliasestask_id+tool_use_idtask_startedfor a task id that already ended, under a different spawn calllivewithrestart: trueand the new spawn callchildWorkId, generation + 1, the prior run's outcome kept inpreviousInvocations. This is how Claude resumes a finished background agent that is sent a message (captured)task_startedfor an ended task id under the spawn call it ended withtask_updatedwith live content (is_backgrounded: true, a name, a description, a running status, a known type)liveadopt). An agent the user moves to the background becomesbackgroundheretask_progress(foreground or background)livewithoperation {toolName: last_tool_name, basis: 'reported'},summaryas last message, usage as tokenstool_use(frames carrying itsparent_tool_use_id)operation {toolName, input: hook-lane preview, basis: 'open'}tool_resultoperation: nulltask_notificationended(completed→succeeded,failed→failed,killed/stopped→cancelled, unreadable→unknown), summary, usage, and itstool_use_idas the run that endedunknownending refined to the reported outcome. An ending from a run that is already over is ignored; a run id the record never saw still ends the current runtask_updatedendedwith the same mapping;patch.erroras last messagebackground_tasks_changedresult, or a new turn startingtool_resultended/ closesession-endedunknown; settled records keep their outcome. The records go when the host drops the parent row on close or releaseOwner (
parentChildWorkId). A child-launched shell or a nested agent is owned by the agent whose own traffic made the launching call. The journal translator's read-onlychildToolOwner(toolUseId)query answers through the same tool-origin registry and linkage that stamp journal rows.Only a child's own frame ends it. In every captured run (a foreground agent that finishes, two interrupts in different orders, an agent moved to the background with its own shell still running, a background agent resumed by a message), every child gets its own terminal frame: a terminal
task_updated, atask_notification, or both. So the roster, the turn boundary and the spawn result are never needed to end a child, and each of them ends one too early in a real capture:resultarrives at +12.6 s; the shell's own notification arrives at +51.3 s. The turn-end sweep settled the shellunknown39 s early.background_tasks_changedbefore its outcome frame. Settling on that omission only ever produced anunknownthat the outcome frame refined, and it would settle a child the roster forgot while it still ran.The tracker (legacy row unchanged)
ClaudeBackgroundTaskTracker,claude-settled-background-tasks.tsand the frame readers are exactly whatmainhas:git diff origin/main -- src/main/claude/claude-background-task-tracker.ts src/main/claude/claude-settled-background-tasks.ts src/main/claude/claude-background-task-frames.tsis empty, and the earlier aggregate-roster split and restart holding map are deleted. The legacy row is unchanged by construction, and every existing tracker test passes unmodified. The evidence path differs from the legacy row in these deliberate ways:resultand drops background work a roster omits.task_progress. The legacy row still keeps usage only for background tasks.failed→blockedandkilled/stopped→idle.The store: a write costs what it touches
Child records share the host store with every parent status row, and before this PR each mutation copied all five store maps and re-validated every record, and reads scanned every child and alias. With child records on the host, every child edge and every unrelated parent status publish paid for every child in the store. This PR changes the store's internals and keeps its existing API (it adds two reads,
getParents()andgetRevision(), so parent listing and the structured row's revision stamp no longer build a snapshot of every child):Bounds
At most 256 live children per session, in both the decoder and the reducer. The decoder remembers at most 256 ended task ids (oldest first) to recognise a restart. At most 32 settled children per session: the oldest are removed first, never one that owns live work. Labels go to admission raw: admission owns label clean-up (the one-line fold, the length bounds, dropping a malformed label).
Ported from #21279 (pin
0565294472)Tests for each are included.
Dropped:
invocationId;Why
A child is materialised three times today: the tracker's DTO, a renderer-side conversion, and the hook roster. Each hop loses a fact. This PR gives the host the one record per child that #22614 (the reader switch at the top of this stack) will make every surface read. The record is fed from provider frames, not from the lossy summary, so it keeps what the DTO drops: foreground progress, the tool a child is running, and
failedas distinct fromblocked. Once the sidebar reads these records, a record that settles early is a sidebar that says Done while work runs, so liveness comes only from each child's own frames.Alternatives considered:
task_startedfor the same task id under the message call (captured with the real CLI), which the restart rule covers.Linked Issue
None — part of the structured chat status/orchestration program.
Visual Proof
Nothing on screen reads the records yet, so the expected visible result is no change: the chat's tool rows, the background-task strip and the sidebar behave as on
main. Checked live in a background-launched dev build of this head (94e5159f52) with a fresh profile, a real structured Claude chat in a folder workspace, and the host's child records read from the running main process after each step:live, current toolBash: sleep 8 && echo done-fg; its shelllive, owned by the agent. Bothsucceededafter the turnlive. Both settledsucceededon their own frames about 30 s laterlivecancelled(notfailed); a follow-up message got a normal replylive, agentsucceeded; shellsucceeded20 s later, nothing left liveEvery child got exactly one record and nothing settled early. The main-process log had no child-work, ingest or status errors. The interrupted turn's tool row reads "Ran 1 subagent failed": that row comes from the journal translator, which this PR does not change, and it reads the same on
main.Testing
pnpm tc:node,pnpm tc:webandpnpm tc:cliall exit 0.claude-structured-child-work-captures.test.ts(8): scrubbed cuts of five real Claude CLI 2.1.280 stream-json captures (ids, paths and prompts replaced; frame order and relative clock kept), replayed through the real adapter into a realAgentHookServer.claude-child-work-decoder.test.ts(9): the decoder frame by frame.agent-status-store-in-place.test.ts(7 cases): two seeded cases hold every running index and the byte total equal to a rebuild from the maps after every step, refusals included (breaking the byte math turns both red; the fuzz alone stays green); a seeded, deterministic fuzz of 1,500 mixed mutations for each of four seeds, held to the old copy-and-validate-everything path (kept as a test oracle): the same accept/reject decision, the same snapshot, the samegetChildren,getAliasesForChildandresolveChildAliasesresults, and a full validation passing after every step; a replica fed the envelopes ends identical. A 5,000-step run past the tombstone retention window checks compaction.agent-status-store-scaling.test.ts(2): a parent publish and a child update at 4,000 children each cost under 4x their cost at 40 (interleaved medians of 350 repeats, so load slows both).agent-status-child-work-reconciliation.test.ts: restart edge, ending under an unseen run id, session end settling instead of removing, and a removed lifetime's fence, replacing the inventory and turn-end cases.result, roster eviction before the outcome, notification, kill, restart under a message call, close) now asserts literal record expectations at each frame and for the whole record set after close. The earlier check that the parent state folded from the records equals the one folded from the legacy row is retired: feat(native-chat): the chat strip and the sidebar read the host's child records #22614 folds the parent from the records and deletes the legacy row, so matching the legacy fold is no longer the contract, and it pinned the roster-omission settle this PR removes.task_startedframe, every journal row and the legacy republish precede the evidence delivery.HEAD:task_updated.is_backgroundedbackground; decoder moveBash: npm testopen operation)Regression. Every test file under
src/shared/agent-status*,src/main/agent-hooks,src/main/native-chat/agent-session-wire,src/main/orcad, the Claude structured, background-task and child-work files, the runtime structured and Claude files, the relay store context and the renderer agent-status IPC files: 407 files, 3,823 tests: 3,808 passed, 1 expected-fail, 12 skipped, 2 failed. Both failures (refusal-retryhost oracle's 90-second timeout, and one renderer SSH-authority snapshot test) pass when rerun alone (9/9). Real-binary suites (*real-cli*,*real-binary*) were excluded.pnpm run check:code-quality:changed: 0 new findings.oxlinton all changed files: clean.pnpm-lock.yamlis absent from the branch range, and there are no new docs.Platforms: tests ran on macOS; the code is platform-independent (host-clock stamps, no paths, no shell).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Not verified:
task_notification.tool_use_idnames the current run is captured (the resumed run's notification carries the message call's id). Not captured: a workflow or monitor task, a nested agent inside an agent, a message sent to a background agent that is still running, and a restart under the same spawn call (the restart flag covers it, unevidenced).task_updated.patch.erroron a live child is not mapped toblocked. Both readworking. Producing them belongs to this producer lane, not to the reader switch (feat(native-chat): the chat strip and the sidebar read the host's child records #22614), and is deferred to a follow-up PR at the top of the stack: the state will be produced only once a captured transcript proves the attribution (the query it would use,childToolOwner(toolUseId), already ships here). Until then the child row reads working while the pane-level permission prompt, an untouched separate path, still surfaces.observedAt/firstObservedAtuse the adapter's host clock at drain, not the tracker'sstartedAt. The two differ by microseconds.Decisions and deviations from the plan:
invocationIdis the first run's spawn call, or the task id when the child is named before its spawn call is known.task_progress.descriptionactivity sentence ("Running Bash") is not stored. It restates the tool, the contract has no activity field, andoperation.inputis the tool-argument preview.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
inventoryandturn-endedevidence edges are deleted, with their settle rules.session-endedsettles every live recordunknownand keeps settled ones, instead of removing the session's records.liveedge may carryrestart: true.endededge under a run id the record never saw now ends the current run (only a known previous run is fenced).getParents()andgetRevision().getChildrenandgetAliasesForChildreturn the stored frozen records.orcad), under the parent's full execution scope. The ingest test uses an SSH host and a folder workspace.subagentsis unchanged.structured-agent-session-agent-status.ts, the fold and the renderer bridge are not touched.server-ingest-structured.ts(the row's revision stamp) andserver-listeners.ts(parent listing) each change one line to read the newgetRevision()/getParents()instead of building a full snapshot that would include every child record.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)