fix(agents): reconcile child output before lost-context sweep failure#90492
fix(agents): reconcile child output before lost-context sweep failure#90492LiuwqGit wants to merge 1 commit into
Conversation
When a subagent run loses live execution context, treat readable child assistant output as terminal evidence and complete as ok instead of always emitting lost-context error. Closes openclaw#90299. Co-authored-by: Cursor <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded by the canonical open bug and later maintainer decision: the useful problem remains real, but this branch is not a safe landing candidate because it uses display-oriented child output as a terminal success predicate and has not addressed the existing review blockers. Canonical path: Keep the canonical bug open and redesign the recovery around the current run's private transcript/status boundary with an explicitly successful terminal child turn; do not land this display-helper recovery branch. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Keep the canonical bug open and redesign the recovery around the current run's private transcript/status boundary with an explicitly successful terminal child turn; do not land this display-helper recovery branch. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current main can fall from unresolved session-store reconciliation into the lost-context fallback while the announce path can still read child output, matching the linked bug's failed-status plus result shape. Is this the best way to solve the issue? No. This branch is not the best way to solve the issue because it uses readSubagentOutput/chat.history as a terminal success predicate; the safer path is the maintainer-directed current-run transcript/status boundary with an explicitly successful terminal turn. Security review: Security review cleared: The diff changes agent lifecycle source and tests only; I found no concrete dependency, workflow, secret-handling, permissions, or package execution change. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against a02813164dd5. |
|
Hi @LiuwqGit — friendly ping: are you still planning to finish this one? ClawSweeper has been waiting on a real-behavior proof since June 5 and I don't see any follow-up, so I wanted to check before duplicating effort. I'd like to help get #90299 landed. If you've moved on, I'm happy to take this over or open an alternative PR — whatever you prefer. Either way a quick word would help. Thanks! |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
What problem does this PR solve?
failed: subagent run lost active execution contextwhile the same completion event still contained readable child assistant output, so parents treated successful work as a plain failure.Why does this matter now?
sessions_spawn/sessions_yieldorchestration depends on terminal status matching delivered child results; a false failed status breaks multi-agent trust and can trigger unnecessary retries or stalled workflows.What is the intended outcome?
okinstead of emitting a plain lost-context failure.What is intentionally out of scope?
What does success look like?
outcome.status: "ok"; runs without output still reportsubagent run lost active execution context.What should reviewers focus on?
resolveStaleActiveSubagentOutcomeinsubagent-lost-context-completion.tsand the sweeper branch insubagent-registry.tsthat calls it beforesweeper-lost-contextcompletion.Linked context
Which issue does this close?
Closes #90299
Which issues, PRs, or discussions are related?
clawsweeper:queueable-fix,clawsweeper:fix-shape-clear)Was this requested by a maintainer or owner?
Real behavior proof (required for external PRs)
E:\Projects\skills\work\openclawon branchfix/issue-90299-lost-context-with-output, Node vianode scripts/run-vitest.mjs.node scripts/run-vitest.mjs src/agents/subagent-lost-context-completion.test.tsnode scripts/run-vitest.mjs src/agents/subagent-registry.test.ts -t "completes stale active runs as ok when child session has readable output"resolveStaleActiveSubagentOutcomereturnsokwhenreadSubagentOutputyields text, and the registry sweep test completesrun-lost-context-with-outputwithoutcome.status: "ok"(no lost-context error) whenchat.historycontains assistant output.sessions_spawn+sessions_yieldend-to-end on a gateway host (read-only review path per ClawSweeper).chat.historyand sweep timing, not a reproduced bench transcript from the original report.outcome.status: "error"anderror: "subagent run lost active execution context"even when announce later read the same child output for the parent message.Tests and validation
Which commands did you run?
node scripts/run-vitest.mjs src/agents/subagent-lost-context-completion.test.tsnode scripts/run-vitest.mjs src/agents/subagent-registry.test.ts -t "completes stale active runs as ok when child session has readable output"What regression coverage was added or updated?
subagent-lost-context-completion.test.ts— outcome resolver with/without output.subagent-registry.test.ts— sweep completes stale active run asokwhenchat.historyhas assistant text.What failed before this fix, if known?
sweeper-lost-contextpath emitted error outcome regardless of readable child transcript.If no test was added, why not?
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes.
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No.
What is the highest-risk area?
okcompletion if stale transcript output is unrelated to the current run.How is that risk mitigated?
childSessionKey; session-store terminal reconciliation andnotBeforeMsfreshness checks still run first; empty/non-readable output keeps the existing lost-context error.Current review state
What is the next action?
What is still waiting on author, maintainer, CI, or external proof?
Which bot or reviewer comments were addressed?