Skip to content

fix(agents): preserve recovered child failure diagnostics - #166454

Merged
steipete merged 1 commit into
mainfrom
fix/w10-l3-agents
Oct 7, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/w10-l3-agents

Conversation

@steipete

@steipete steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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.

  • Failed children reported the generic session completed before registry settled instead of the stored lastRunError.
  • Timed-out children lost their timeout details entirely.

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.ts now forwards the session's existing lastRunError into 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.md notes 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

  • Two new worker-backed SQLite cases in subagent-session-reconciliation.test.ts, one failed and one timed out. Both fail on pre-fix code and pass after.
  • 12/12 reconciliation tests pass, including the absent-diagnostic fallbacks.
  • On the final head, remotely (Hetzner Crabbox): 202/202 backend tests across nine files, and node scripts/check-changed.mjs green.
  • Real-Gateway flow with loopback provider stubs: a parent with failed and successful children across an owned Gateway restart received the interruption context and the sibling results.

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)
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 7, 2026 04:33
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 7, 2026, 12:38 AM ET / 04:38 UTC.

ClawSweeper review

What this changes

Preserve 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
Reviewed head: 6b22627203d48f6d4c7f886361ed20d3c2446fb5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with meaningful regression coverage and one required validation-reporting follow-up.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER author classification exempts ordinary contributor proof, and this patch does not materially change authority. The reported Gateway restart scenario is supplemental; the exact diagnosis handoff is covered by inspected SQLite-backed tests. No stored format or schema changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER author classification exempts ordinary contributor proof, and this patch does not materially change authority. The reported Gateway restart scenario is supplemental; the exact diagnosis handoff is covered by inspected SQLite-backed tests. No stored format or schema changes.
Evidence reviewed 7 items Pinned introduced change: The introduced delta forwards the existing lastRunError field for failed and timeout outcomes; freshness, ownership, terminal classification, and delivery routing are unchanged.
Still necessary on fetched main: The complete fetched-main module still substitutes the synchronization placeholder for failed sessions and constructs timeout outcomes without their stored diagnosis.
Meaningful regression boundary: The two table-driven cases write terminal session rows and invoke the production worker-backed reconciliation reader. They check retained diagnoses and the existing missing-diagnosis fallbacks without adding a production seam. Tests were inspected, not executed.
Findings None None.
Security None None.

How this fits together

Subagent 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]
Loading

Before merge

  • Complete next step (P2) - Add the measured wall time for pnpm test src/agents/subagents/registry/subagent-session-reconciliation.test.ts --maxWorkers=1 and the associated CI seconds to the PR body.
Agent review details

Security

None.

PR surface

Source +3, Tests +20, Docs +2. Total +25 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 2 +3
Tests 1 20 0 +20
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 28 3 +25

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This repairs misleading diagnostics in recovered child completions without changing execution or delivery behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER author classification exempts ordinary contributor proof, and this patch does not materially change authority. The reported Gateway restart scenario is supplemental; the exact diagnosis handoff is covered by inspected SQLite-backed tests. No stored format or schema changes.

Label justifications:

  • P2: This repairs misleading diagnostics in recovered child completions without changing execution or delivery behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER author classification exempts ordinary contributor proof, and this patch does not materially change authority. The reported Gateway restart scenario is supplemental; the exact diagnosis handoff is covered by inspected SQLite-backed tests. No stored format or schema changes.

Evidence

What I checked:

  • Pinned introduced change: The introduced delta forwards the existing lastRunError field for failed and timeout outcomes; freshness, ownership, terminal classification, and delivery routing are unchanged. (src/agents/subagents/registry/subagent-session-reconciliation.ts:150, 6b22627203d4)
  • Still necessary on fetched main: The complete fetched-main module still substitutes the synchronization placeholder for failed sessions and constructs timeout outcomes without their stored diagnosis. (src/agents/subagents/registry/subagent-session-reconciliation.ts:150, 078ca8950dbc)
  • Meaningful regression boundary: The two table-driven cases write terminal session rows and invoke the production worker-backed reconciliation reader. They check retained diagnoses and the existing missing-diagnosis fallbacks without adding a production seam. Tests were inspected, not executed. (src/agents/subagents/registry/subagent-session-reconciliation.test.ts:71, 6b22627203d4)
  • Diagnostic producer and consumer: The session-error owner redacts sensitive text and bounds stored diagnoses to 160 characters. Existing announcement consumers already render error details for both failed and timed-out outcomes; the patch restores the missing handoff rather than adding a parallel mechanism. (src/sessions/session-run-error.ts:76, 6b22627203d4)
  • Prior merged area history: Fetched-main history identifies Peter Steinberger across recent reconciliation, ownership, and lifecycle changes, including commit 10334ec. This supports routing, not causal attribution. Deeper blame and parent-blob inspection failed because required promisor objects could not be retrieved. (src/agents/subagents/registry/subagent-session-reconciliation.ts, 10334ec913d7)
  • Provided validation evidence: The captured PR body reports pre-fix failures, 12 passing reconciliation tests, 202 passing backend tests on the final head, and a real-Gateway restart flow with loopback provider stubs. The runtime description covers interruption and sibling delivery but does not explicitly show the exact recovered stored-diagnosis assertion. The supplied Repository State identifies the author as MEMBER, so ordinary external-contributor proof is exempt; no material authority change triggers an additional gate. (6b22627203d4)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the reconciliation test file’s measured wall time and CI seconds in the PR body.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 9a94a23 into main Oct 7, 2026
196 of 198 checks passed
@steipete
steipete deleted the fix/w10-l3-agents branch October 7, 2026 04:56
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant