Repository navigation
Conversation
Route host restart events through the existing bounded recovery lane. Preserve cron execution budget across explicit lane waits while retaining setup and execution watchdogs. Add real-process restart and timeout regressions with a synthetic performance harness.
|
🦞👀 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 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR separates restart recovery from cron capacity and preserves job runtime budgets across explicit lane waits. Example: Forty conversations resume after a Gateway restart while 12 new cron runs arrive.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a source-confirmed scheduling defect with a focused implementation and no definite introduced bugs found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe reply runner selects execution lanes for conversation and automation turns; the cron watchdog consumes admission and execution callbacks to enforce job timeouts and cancellation. flowchart TD
A[Restart resume inputs] --> B[Reply runner]
C[Scheduled jobs] --> B
B --> D[Restart recovery lane]
B --> E[Cron lane]
E --> F[Agent execution]
F --> G[Cron watchdog]
Technical reviewBest possible solution: Use the existing recovery lane and watchdog to isolate recovery capacity while charging only active runtime against cron budgets. Do we have a high-confidence way to reproduce the issue? Current-main source establishes both paths; the author also reports intended baseline failures for the real-Gateway and watchdog regressions, which were not rerun during this read-only review. Is this the best way to solve the issue? The implementation fixes classification and accounting at their existing owners, preserves admission checks, and introduces no competing scheduler or configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b0c014629908. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +9, Tests +419, Docs +24, Other +109. Total +561 across 11 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 Reviewed November 3, 2026, 2:31 PM ET / 19:31 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
) * fix: keep restart recovery from starving scheduled jobs Route host restart events through the existing bounded recovery lane. Preserve cron execution budget across explicit lane waits while retaining setup and execution watchdogs. Add real-process restart and timeout regressions with a synthetic performance harness. * test: allow large restart fixtures to drain during shutdown * test: prepare usage projection before large restart measurements * test: capture restart profiles before fixture cleanup
Release adaptation: backport only the Socket Mode reconnect waiter owner and focused regression tests; omit the performance harness and main-only transport documentation addition. Add listener-count assertions for timer settlement and disconnect cancellation; adjust the test allocation to 41. Companion dispositions: #198007 is specific to SDK 3.2 callback/abort semantics and is not applicable to this line pinned to socket-mode 3.1.0. #197657 retires main allocations; other audit hits (#200523, #197009, #194964, #184507, #192197, #192051, #190003, #189850) only overlap the excluded shared perf README. No later #188745 mention through bd692e9. (cherry picked from commit a1d1da7) Co-authored-by: RomneyDa <[email protected]>
) * fix: keep restart recovery from starving scheduled jobs Route host restart events through the existing bounded recovery lane. Preserve cron execution budget across explicit lane waits while retaining setup and execution watchdogs. Add real-process restart and timeout regressions with a synthetic performance harness. * test: allow large restart fixtures to drain during shutdown * test: prepare usage projection before large restart measurements * test: capture restart profiles before fixture cleanup (cherry picked from commit ad524e6) Release adaptation: Keep restart-recovery lane routing and pause cron execution budget during explicit restart-recovery admission. Exclude performance harness and large restart-lane E2E expansion; focused watchdog regression retained. No schema change. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Restart-resumed dashboard turns were classified as cron work, flooding the eight-wide cron-nested lane ahead of new jobs. Cron jobs also spent their runtime budgets during explicit capacity waits.
User Impact
Host restart events use the existing bounded restart-recovery lane, configured by agents.defaults.maxConcurrent. New cron runs can proceed while recovery drains; scheduled automation retains its cron lane and per-session ordering remains intact. The scheduler preserves remaining runtime across reported lane waits, including waits after execution begins. Silent setup and teardown stalls remain bounded. No new config, cache, or schema.
Measured fairness tradeoff: new cron queue p99 falls 8.47 s→1ms, while recovery queue p99 rises 8.93 s→10.11s and median peak RSS rises 2.98→3.22GiB. Owner-accepted worse metrics: on 2026-11-03, the lead explicitly accepted recovery p99 +13%, worst-trial recovery wait +25%, and peak RSS +8% in exchange for new cron queue p99 8.47 s → 1 ms, with all 40 recoveries completing.
Why This Change Was Made
The reply runner routed every internal event to cron-nested even though restart events retain sourceTool restart provenance. The existing restart-recovery capacity owner was already configured but this dispatch did not select it. Selecting that lane fixes the classification at its owner with no new admission machinery.
The watchdog now pauses explicit lane waits and resumes the remaining budget. It retains the silent-startup protection introduced in #188982. cron.maxConcurrentRuns was deliberately retired/rejected in #111382; current docs do not advertise it, so no option is restored.
Production delta: +9 lines (+3 lane selection, +6 remaining-budget accounting). Net tests/helper: +455; measurement tooling: +114. Documentation explains runtime-budget and recovery-lane behavior.
Evidence
The committed real-Gateway harness interrupts 40 dashboard turns via SIGTERM, requires graceful exit and 40 durable markers, restarts at width 8, and submits 12 public cron runs 100 ms apart. All 40 unique recoveries and 12 persisted successful cron outcomes settle. The regression fails at its intended lane assertion on exact baseline 37f6f4e. The watchdog regression also fails before the fix: two 20-minute lane waits preserve a 1-second budget; 250 ms spent leaves 750 ms.
Final campaign: synthetic 35.13GiB DB, 10,000 sessions / 1 million events, 62,000 workspace files / 1.116 GB, APFS clones. Two A/A controls plus five counterbalanced baseline/candidate pairs, serial fresh state/ports. Identical profiling; source/build/apparatus hashes pinned. Existing usage projection warms through public usage.cost before workload, with warmup recorded separately. Every trial has 2 profiles and 52 queue observations. Local deterministic Responses service uses 1-second recovery service; this proves real Gateway/storage/queue behavior, not production provider or btrfs latency.
Each table cell is the median across five trial statistics, followed by the trial range. Within-trial p99 is nearest-rank maximum with 12/40 samples; no production-tail extrapolation.
A/A changes: process CPU +5.3%, main CPU +9.2%, sampled allocation +3.2%, cron queue p99 +0.04%, recovery queue p99 −2.5%. Candidate median process CPU +1.3%, allocation +2.1%; these are smaller than A/A movement, not a statistical no-regression claim. Host load rose later; all samples are retained. First cron model call began after 33–38 completed recoveries on baseline and before any completed recovery in every candidate.
Recovery tail and memory worsen: median recovery queue p99 +13.2%, worst trial +25.0%, median RSS+8.0%. The worst candidate tail occurred at lower recorded host load than its paired baseline; noise alone is not an adequate explanation. Profiles show similar totalCPU and additional concurrent cron preparation/GC work; they do not prove one exclusive cause. Existing independent lanes allow cron to overlap eight recoveries. The lead explicitly accepted this bounded fairness/resource tradeoff on 2026-11-03. Landing is authorized under the inherited-red exception for the sole CI root failure: #191459 test-budget debt, reproduced on the exact CI main parent. Failed CI remains recorded as failed; security and review gates are not waived.
ProcessCPU includes Gateway workers, excludes child processes/local model server; sampled allocation and CPU profiles cover the main isolate. Profiles end after settled workload before cleanup. Initial restart still requires SIGTERM exit 0. Earlier cold-fixture shutdown-grace failures and one missing beforeExit-only profile were excluded as setup/capture failures; final explicit checkpoints passed all 12 trials.
Focused proof: 115 tests across 8 files / 5 shards, including real N40 restart (47.27 s); cron/session-model/command consumers, lane limits, session events, prefix stability. Targeted type/lint/format and diff checks pass. Independent full Codex autoreview and each fixture-only delta are scoped-clean through P2. Hosted Codex review completed on current head cffe3cc with no findings. No changed production module is UI-imported.
Current-head CI 41711052126, attempt 2: all selected jobs/security pass except test-line ratchet and its aggregate. Attempt1 checkout exhausted 3 fetch timeouts; one diagnosed infrastructure rerun succeeded at checkout. The remaining failure is reproduced on exact CI main parent 8e68dcc: 6,442,159 test LF versus 6,441,800 ceiling, 359 over, exit 1, comparing against pre-introducer parent e016b63. Introducer dde161a / #191459 added 405 test LF without allocation against 46 slack. Our 455 LF have 455 allocation. Native inherited-failure evidence pins actual tested merge a5b5aebabf1773dafdfddba8292afc9afa44c89d and unchanged failure-owner inputs. No CI-green claim.
pnpm check:changed separately found inherited unused export ui/src/pages/systems/systems-sidebar.tsx: systemKind, reproduced on exact original baseline 37f6f4e. Introducer 9ce5ba1 / #192070 removed its final external consumer. All change-specific findings were fixed and focused checks passed. Both inherited defects are recorded as main regressions for follow-up; no unrelated UI changes or allocation inflation.