Repository navigation
fix(agents): preserve recovered child failure diagnostics - #166454
Conversation
Carry the session owner's stored failure or timeout diagnosis into recovered subagent completion. The old mapping replaced useful failure details with a synchronization message, or discarded timeout details altogether. Preserve existing freshness, ownership, terminal classification, and missing diagnosis behavior. Cover both outcomes through the isolated durable store and worker-backed reconciliation path. (cherry picked from commit 39e441a4f1d4103beb30ef5ba42138154083f875)
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed October 7, 2026, 12:38 AM ET / 04:38 UTC. ClawSweeper reviewWhat this changesPreserve stored child failure and timeout diagnostics when rebuilding subagent completion, with SQLite-backed regression coverage and announcement documentation. Merge readiness⛔ Needs changes before merge - 1 item remains The fix remains useful: current main still discards recovered failure and timeout diagnostics. No introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherSubagent recovery reads a child's stored session and reconstructs its terminal outcome. Completion delivery then presents that outcome and its diagnosis to the parent agent. flowchart LR
A[Stored child session] --> B[Recovery reconciliation]
B --> C[Fresh terminal outcome]
C --> D[Stored diagnosis or fallback]
D --> E[Completion delivery]
E --> F[Parent agent]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +20, Docs +2. Total +25 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the session owner’s bounded diagnosis authoritative throughout recovery and parent completion delivery. Do we have a high-confidence way to reproduce the issue? Yes, from source: a fresh failed or timed-out session containing lastRunError loses that diagnosis during current-main reconciliation. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. Forwarding the existing diagnostic at the reconciliation owner is the narrowest repair, and existing announcement consumers already support it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 078ca8950dbc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…66454) Carry the session owner's stored failure or timeout diagnosis into recovered subagent completion. The old mapping replaced useful failure details with a synchronization message, or discarded timeout details altogether. Preserve existing freshness, ownership, terminal classification, and missing diagnosis behavior. Cover both outcomes through the isolated durable store and worker-backed reconciliation path. (cherry picked from commit 39e441a4f1d4103beb30ef5ba42138154083f875) Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
When a subagent's session finished before the registry settled, for example across a Gateway restart, recovery reconciliation rebuilt the child's completion from the durable session row. It dropped the diagnosis that the session owner had already recorded.
session completed before registry settledinstead of the storedlastRunError.The parent agent and operator therefore saw a vague or empty reason for a real failure.
Why This Change Was Made
src/agents/subagents/registry/subagent-session-reconciliation.tsnow forwards the session's existinglastRunErrorinto the recovered failure and timeout outcomes. It still falls back to the generic message when no diagnosis was recorded. Freshness, ownership, and terminal classification are unchanged.Production change: +5/-2, which only forwards an existing field.
docs/tools/subagents/announce.mdnotes the behavior.User Impact
Recovered child failures and timeouts keep their real cause in the completion announced to the parent, instead of a synchronization placeholder.
Evidence
subagent-session-reconciliation.test.ts, one failed and one timed out. Both fail on pre-fix code and pass after.node scripts/check-changed.mjsgreen.