Repository navigation
fix: native Codex turns fail with "settlement is closed" when they finish after 6 minutes - #185180
Conversation
…window A native Codex turn holds a runtime_owned watchdog wait while it owns liveness. When the turn completed after more than six minutes without OpenClaw-visible semantic progress, the release made the protected interval count as stalled on the next tick. The watchdog stopped the finished run, and the lane failed with "session placement turn settlement is closed". The native turn's wait now opts in to starting a fresh semantic window when it releases. A run that then makes no progress is still stopped after that window. Other runtime_owned waits, such as the agents_wait collector, keep losing protection immediately.
|
🦞👀 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 maintainer review before merge. What this changesThis PR preserves the semantic stall allowance when native Codex releases liveness so completed answers can finish settling. Example: A native Codex turn completes after 422,336 ms without OpenClaw-visible semantic progress.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a current native-completion defect, and the previous line-cap finding is resolved; the remaining inherited test-line budget failure needs CI disposition. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe embedded runner registers native liveness with the session controller, whose watchdog combines progress and deadlines to allow settlement or request recovery. flowchart LR
A[Gateway turn] --> B[Session controller]
B --> C[Embedded runner]
C --> D[Native Codex]
C --> E[Watchdog]
D --> F[Terminal receipt]
F --> G[Answer settlement]
E --> G
Technical reviewBest possible solution: Land the native-specific handoff repair through the existing watchdog after resolving the inherited test-line gate. Do we have a high-confidence way to reproduce the issue? Current-main registration, terminal-receipt handling, and watchdog policy establish the false-stall transition; this read-only review executed no target code. Is this the best way to solve the issue? The patch restores the documented native-completion contract with one native-specific distinction, preserves other wait policies, and resolves the previous finding without another module or increased allowance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e4333415f4e6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +18, Tests +32, Docs +5, Other +2. Total +57 across 7 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 5, 2026, 2:51 AM ET / 07:51 UTC (Revision 4). |
|
@clawsweeper re-review The PR body now includes a successful real Gateway/native Codex after-fix run: 422,336 ms (7m02.336s) without semantic progress before the native completed receipt, followed by successful settlement, exact local final delivery, and persisted history. It includes raw-clock methodology, exact-head/source equivalence, and redacted receipts. Reviewed head remains The session-controller maintainer's decision on the full six-minute grace after native liveness ends, including unexplained liveness loss, is still requested. The successful live run does not replace that decision. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…nish after 6 minutes (openclaw#185180) Advance the semantic horizon while the native runtime owns liveness so a completed native turn can settle instead of being stopped immediately. Preserve ordinary collector behavior, explicit deadlines and bounded stalled finalization. The release-tick stop reproduces on base. Secretless proof passes 123 watchdog/liveness/question/collector tests and 39 follow-up attachment tests; lint, format and source line cap pass. Related: openclaw#185121 Co-authored-by: Stronggenetics <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Release adaptation: retain the existing watchdog and native admission owners; carry only the runtime-owned release horizon and focused regressions. Current-authority checks, execution deadlines and bounded finalization remain unchanged. Scoped self-review found no additional owner or policy changes. Proof: standalone production-watchdog regression fails on the base (stop rather than observe) and passes with the fix, including bounded eventual stall. Focused Vitest qualification still pending; earlier attempts stopped in cold compilation. Targeted lint blocked by declaration input escaping this shared-dependency checkout, not by a source finding. No gate waiver claimed. (cherry picked from commit 4d2081f) Co-authored-by: Stronggenetics <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Related: #185121
What Problem This Solves
Fixes: a native Codex turn finishing after more than six minutes without OpenClaw-visible progress can lose its completed answer when the reply watchdog immediately stops settlement.
User Impact
Long native turns can finish, deliver, and persist their answers. A run that stays stuck after native ownership ends still stops after the existing six-minute semantic window. Explicit execution deadlines, the two-minute native settlement deadline, and Stop remain in effect. Ordinary collectors retain their existing revocation and stalled-read behavior.
Why This Change Was Made
The native runtime owns liveness while its turn is active. Previously the watchdog resumed its old semantic clock when that ownership ended, retroactively charging the whole native wait as inactivity. Only the native-turn wait now advances the observed semantic horizon while it is live; release lets finalization use the existing window. The integrated version preserves current main's pending backend-assessment logic.
This is the existing semantic budget applied at the ownership handoff, not a new timeout setting. An unexplained native liveness loss can consequently take up to one additional window to be reclaimed; the bounded stalled-finalization regression covers that tradeoff. No independent timer or recovery registry is introduced.
Production delta: +18 lines (47 added, 29 removed). The native wait uses its existing registration directly; wait and execution type declarations move beside the existing state types to keep the controller within its size limit. The remaining growth distinguishes native handoff from ordinary runtime-owned waits and records the observed horizon. Tests add 32 net lines, allocated separately without changing the shared baseline; documentation adds five lines.
Evidence
Independent secretless Linux proof restored current-main production beneath the regression and reproduced the erroneous stop on the release tick. The repaired runtime passes all 123 tests across the watchdog, run-attachment, collector, and question-recovery suites (124.62 s runner; compilation dominates). AWS Crabbox runs
run_d71e02e754f7b5010dc4d2e5d7d05b94andrun_8a05738a83bb2c52297496b41a51fa4f; no credentials were forwarded. The follow-up cleanup stores the returned wait-close callback directly, removing the redundant temporary and wrapper; it preserves native opt-in and keeps runs.ts at its inherited size. The wait-close type now explicitly describes a standalone callback; both cleanup follow-up reviews found no actionable P0–P2 finding. A secretless follow-up run passes 39 run-attachment and liveness tests (66.89 s runner), with the line-cap check red before this cleanup. The final type-only correction passes targeted oxlint, oxfmt, and the line-cap check inrun_ab74d82905678b896b8a100f5580607f.Exact-head CI 41989298534 completes with only the test-line check and aggregate gate failing. Job 127118138846 reports 6,484,063 lines / ceiling 6,484,042, a 21-line deficit. Its merge base is
e4333415f4e68198ede8c6d9501dd8fe933a3bf9; this PR adds exactly 32 lines and 32 allocation credit, so that base has the same deficit (6,484,031 / 6,484,010). All other jobs pass, including the repaired source line-cap gate. The classifier compares an older passing main run41981222775and explicitly does not compare scope; no unrelated test deletion or baseline increase was made.The contributor's live Gateway/native-turn proof is retained with attribution: a 390,001 ms synthetic workload completed after 422,336 ms of raw semantic quiet, returned
agent.wait: ok, delivered the exact final marker, and persisted it in history. The installed variant's relevant source hashes matched the submitted files; its full repository head differed. This lane does not independently repeat that credentialed native-model run; its secretless proof exercises the owning watchdog and production run-attachment boundary.The native contract was checked against Codex source at
be2951ea34f0d295ed0becf97079f92fa5f6950e:codex-rs/app-server/src/thread_status.rs:156clears active state on completion, andthread_state.rs:195records terminal events. OpenClaw receives the terminal event before asynchronous projection, starts its separate settlement deadline, and releases native liveness.Four independent diff-scoped reviews found no actionable P0–P2 defect across the integration and cleanup. ClawSweeper re-review 41989366175 reviewed final head
3f5ce3476a3afbc0892041e04953d9af7daa1a59, reports zero findings, and confirms that the previous line-cap finding is resolved. Final main integration is43d09522a4bb9b9f19bc8d730077631654ae5168; the changed runtime and tests are unchanged by that integration.Thanks @Stronggenetics for the fix, regression coverage, and live Gateway evidence.