Repository navigation
Conversation
Bound shutdown preparation, signal roots before joining subagents, and retain resume intent in the existing terminal write. Recover exact-predecessor unfinished runs after partial marking or a forced stop without reviving older orphans.
Contributor
|
🦞👀 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. |
steipete
marked this pull request as ready for review
November 4, 2026 02:56
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
steipete
deleted the
steipete/perf-micro-shutdown-session-abort-overrun-loses-resumes-20260919
branch
November 4, 2026 03:27
Contributor
Author
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes interrupted conversations losing their automatic resume when shutdown exhausts its preparation budget after writing only some restart markers.
User Impact
Interrupted root conversations retain one ordinary resume input after a partial or forced shutdown. Older abandoned runs, user-stopped work, resets, archived sessions, cron, subagents, and external harnesses retain their existing recovery rules. No configuration, schema migration, or operator action is required.
Why This Change Was Made
The
session-aborttrace includes marker persistence. Marker stores were processed serially, subagent settlement preceded root cancellation, partial markers disabled recovery across all stores, and a forced-stop boot record disabled unfinished-run adoption. A restart cancellation could also clear the only remaining run identity without repairing a missing marker.Write independent store batches in parallel, bound each preparation phase to ten seconds within the existing shutdown deadline, and signal captured work before joining subagent settlement. Keep actual finalizer custody joined. A terminal lifecycle write during committed Gateway shutdown now preserves the existing resume marker or supplies it if the initial marker write failed. The existing boot ledger bounds fallback to the immediately preceding crashed/forced-stop lifetime; partial markers no longer veto other unfinished roots.
Required received-connection persistence joins are unchanged. A genuinely stuck finalizer can still reach the process watchdog. The historical long-running writer/finalizer and GC contribution have not been identified; this change addresses reproduced ordering and recovery defects, not a claim to have reproduced every production stall.
Evidence
Acceptance: all 60 captured roots retain markers; cancellation-dependent child settlement must release without consuming the shutdown deadline; partial shutdown must resume current predecessor work once while rejecting stale work; healthy marker work and CPU must not regress.
Synthetic owner workload: 35.13 GiB agent SQLite DB, 10,000 sessions, one million transcript events, 62,000 workspace files (1.116 GB), approximately 2.92 GB retained heap. APFS; btrfs and production GC churn remain unproven. Existing
scripts/perf/restart-resume-measure.tsnow supports--mark --heap-mib 2600, plus pinned shutdown sources and--cancel-dependent --shutdown-budget-ms 1000. A/A controls, counterbalanced A/B samples, and separate allocation/profile runs were used.Percentiles are empirical maxima with five observations; healthy observations are batch means, not per-call tail latency. Healthy wall ranges were 52.299–56.932 / 52.030–54.734 ms; cycle ranges were 999.399–1002.091 / 58.832–78.418 ms. Marker A/A medians were 53.93/54.76 ms; cancellation-cycle A/A was 1001.24/1001.12 ms with every baseline call exhausting the budget. Cold first marker preparation was 6.77 s, ruling out a five-second cap for this fixture. One cycle pass had higher process CPU (84.40→106.09 ms); the separate instrumented pass measured 101.91→89.25 ms and healthy A/B remained flat. No CPU speedup claim. The cancellation-cycle measurement is owner proof, not whole-Gateway exit time.
87 focused tests passed (65.20 s wrapper), including real worker persistence, queued-marker preservation, partial recovery, forced-stop boot eligibility, and bounded shutdown. Missing-marker, partial-recovery, and abort-order regressions failed pre-fix. The relocated shutdown test passed with all 44 sibling tests (18.05 s wrapper). Chromium history-settlement browser proof passed (1/1), and bundled chat lifecycle E2E passed (14/14; 93.74 s including UI build). The real Gateway partial-shutdown regression fails on the exact parent and passes on this candidate (38.4 s test), recovering marked and unmarked predecessor work while settling the stale orphan. The forced-stop boot regression also fails on the exact parent. The runtime build passed (89.7 s). The public Gateway 60-turn run on the 35.13 GiB fixture exited cleanly on SIGTERM, verified 60/60 durable markers, then completed exactly 60 unique resumptions and 12 cron jobs. This process run used real agent execution against a deterministic local HTTP model fixture; the retained-heap owner measurement is separate. The harness does not expose whole-process stop duration.
pnpm check:changedandgit diff --checkpassed. The first changed-check attempt found a test-file growth cap and a benchmark resolver typing error; both were fixed before the successful full pass. Exact-head PR CI is run41763931721; the inherited ratchet failure is detailed below. Other required gates remain enforced.Codex autoreview of the local candidate against
852933492df9, through P1, was scoped-clean with no accepted/actionable findings. Production growth is 39 lines: the terminal-write recovery fact, bounded ordering, forced-stop eligibility, and stage diagnostics; eligibility is shared and the global marker veto is removed. The separate 107-line test allocation covers missing-marker persistence and cancellation ordering; existing recovery/budget tests are extended rather than duplicated.Exact-head inherited CI failure
CI run 41763931721, head
ff842b0a69306d84378e605e88ff5791f78fd589, tested merge4aee1c1302c0fb245b4be88272b613d655e5bd0aover main parent6a4638c30ec168b3d52221159d86a1dfcc7ffa29, fails the test-line ratchet by 23 lines. This PR adds 107 test lines and exactly 107 allocation; it does not increase the inherited deficit.The native checker reproduces on that exact main parent: total 6,450,637, ceiling 6,450,614, over 23, exit 1, using
node scripts/check-test-lines-ratchet.mts --base 466da81cce53000d5320ff9a24568d73d112c8d4 --no-merge-base. The comparison base is the actual immediately preceding good commit: it passes with 67 spare lines. #192435,92d2dfcbb6fb5c017d190df35312254a511ac8b7, adds 100 unallocated lines inui/src/e2e/new-session-page.details-motion.e2e.test.tsand fails by 33; subsequent deletions of nine and one lines leave 23. Its commit recorded a per-PR budget bypass. This is an attributable main ratchet regression for its owner to resolve, not CI noise. The failing source, checker, and scalar baseline are unchanged by this PR.Scoped landing authorization permits an admin merge at the pinned head only with this exact-parent reproduction, introducing commit attribution, passing local proof, and no other unexplained failures. The failed CI is retained as failed; required security and review gates remain enforced.