fix: keep yielded parent turns nonterminal#95996
Conversation
9c722dd to
a8aa8bf
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 9:30 PM ET / July 14, 2026, 01:30 UTC. Summary Reproducibility: no. not yet with high confidence against current main and the exact PR head. Source inspection and the older redacted live cron run strongly support the failure mode, but exact-head Discord, best-effort delivery, final-synthesis, and upgrade paths remain unproven. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Use one canonical internal parent lifecycle state across cron, subagent, and channel projections; expose Do we have a high-confidence way to reproduce the issue? No, not yet with high confidence against current main and the exact PR head. Source inspection and the older redacted live cron run strongly support the failure mode, but exact-head Discord, best-effort delivery, final-synthesis, and upgrade paths remain unproven. Is this the best way to solve the issue? Unclear. A shared parent lifecycle classifier and descendant-settlement reuse are the right structural direction, but the public AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b9c48154034f. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (42 earlier review cycles; latest 8 shown)
|
4dbd552 to
31d2476
Compare
31d2476 to
8e3dcf8
Compare
e9d864b to
378f9f0
Compare
378f9f0 to
097fa6e
Compare
|
Maintainer preparation is rebuilding this branch on current The refreshed PR will:
Scope note: this contract applies to correctly registered |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
Summary
sessions_yieldwhile its parent task is still waiting.running, project an additiveyielded: truechat final, and let Control UI clear the completed model turn without announcingDone.end_turncompletion behavior.This replaces the former broad cron/Discord/public-
deferredproposal with the narrow shared invariant needed by Gateway session state and Control UI. It does not introduce a public status or Plugin SDK contract.What Problem This Solves
A Codex model turn can emit
final_answerandturn/completedafter explicitly registering continuation work throughsessions_yield. Before this patch, Gateway and Control UI treated that transport-level turn completion as user-task completion, moved the session todone, and announcedDoneeven though OpenClaw still owned pending work.The July 14, 2026 Wilfred sequence demonstrated the false completion projection:
final_answerarrived at 17:28:11 MDT andtask_completefollowed 29 ms later while activation was still staging and live browser QA remained pending. The raw incident used detached scripts rather thansessions_yield; this PR fixes the same projection bug only for continuation work registered through the supported lifecycle contract.Evidence
runningwithout aDoneannouncement.pnpm build,pnpm check, focused Vitest shards, exact-head GitHub CI, and autoreview provide the implementation gates described below.Behavior
turn/completedandfinal_answerend a Codex model turn. They complete the OpenClaw parent task only when no registered continuation remains.The nonterminal parent state requires the clean internal tuple:
Cancellation, timeout, error, or contradictory status metadata remains terminal.
Scope
This fixes the Control UI/Gateway projection for correctly registered
sessions_yieldcontinuation work.The July 14, 2026 Wilfred session exposed the false-
Donesymptom: a Codex final answer and task-complete projection arrived while activation and browser verification were still pending. That raw incident launched detachedscreen/wake scripts and did not callsessions_yield, so arbitrary detached process ownership remains outside this PR. The patch deliberately does not infer pending work from prose, shell processes, or promises in assistant text.Related lifecycle ownership:
Verification
Focused lifecycle, protocol, Gateway, Codex, and Control UI tests:
Also run:
pnpm buildandpnpm checkpassed. The focused non-browser suitespassed again after the final patch-identical rebase; the Playwright
Control UI regression passed on the same patch before the rebase.
Final autoreview: clean, no accepted/actionable findings. Exact-head
GitHub CI is the authoritative broad gate. A local exploratory
pnpm testrun was not used as a gate because unrelated macOSresource/path failures eventually exhausted the temporary volume.
Behavior addressed: Control UI must not announce
Donewhen an explicitly yielded parent is still waiting on registered continuation work.Real environment tested: Playwright Control UI browser flow against a mocked Gateway WebSocket; exact-head GitHub CI on the published PR branch.
Exact steps or command run after this patch: Start a chat run, publish an active session row, send a final chat event with
yielded: trueandstopReason: "end_turn", then inspect the transcript, composer, session activity, and live status announcement.Evidence after fix: The final assistant text remains visible, the completed model-run Stop control and spinner clear, the parent session remains
running, and.agent-chat__run-status-announcementstays empty instead of sayingDone.Observed result after fix: Registered yielded work is represented as a waiting parent task; ordinary
end_turnwithout yielded metadata still publishesDone, stale cancellation/error metadata stays terminal, and overlapping active run IDs are preserved.What was not tested: This PR does not claim ownership or detection of arbitrary detached
screenjobs, wake scripts, or other background processes that were not registered throughsessions_yield. No live model-provider call was required for the deterministic projection fix. The local full-suite attempt was not a passing gate; exact-head hosted checks own broad verification.Co-authored concept and original report/fix direction by @kklouzal.