Repository navigation
Conversation
Preserve failed cleanup for its original run and scope, but warn instead of replaying that terminal failure as live ownership at a later shutdown. Keep current-run cleanup rejection and use the existing complete admission join once. Prove the deadline failure with a real Linux subreaper and background descendants, then verify native retirement before clean shutdown. Correct the related realtime-signal fixture for Node runtimes that ignore signal 34.
|
🦞👀 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 Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab83dc12d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review Please review final head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR warns about historical process-cleanup failures while preserving original run errors and failures encountered during shutdown. Example: A Linux command exceeds a 100ms cleanup deadline, then its owner and descendant disappear before Gateway shutdown.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current shutdown failure, and the final head addresses the earlier consumer-test findings without introducing a new actionable defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe process supervisor owns subprocess admissions, cancellation, and extinction joins; Gateway lifecycle cleanup consumes its shutdown result. flowchart TD
A[Gateway lifecycle] --> B[Process supervisor]
B --> C[Admission fence and cancellation]
C --> D[Current process extinction joins]
D --> E[Shutdown result]
B --> F[Historical cleanup diagnostic]
F --> G[Warning log]
Technical reviewBest possible solution: Keep historical errors with their originating owners, warn during later shutdown, and continue rejecting cleanup failures observed by the active shutdown join. Do we have a high-confidence way to reproduce the issue? Current main retains and rethrows a terminal cleanup failure after removing its admission; the supplied Linux regression reports base failure and fixed success, but no target code was executed during this read-only review. Is this the best way to solve the issue? The patch uses the existing supervisor and complete admission join, preserves original failure ownership, and removes redundant shutdown looping without adding another cleanup mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 474b4cebd95f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -3, Tests +81, Docs +3, Other +2. Total +83 across 16 files. Added test files: 1. 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
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 Reviewed November 10, 2026, 2:48 PM ET / 19:48 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
openclaw#196823) * fix(process): keep old cleanup failures from blocking Gateway shutdown Preserve failed cleanup for its original run and scope, but warn instead of replaying that terminal failure as live ownership at a later shutdown. Keep current-run cleanup rejection and use the existing complete admission join once. Prove the deadline failure with a real Linux subreaper and background descendants, then verify native retirement before clean shutdown. Correct the related realtime-signal fixture for Node runtimes that ignore signal 34. * test(process): account for formatted cleanup regression lines * test(process): retain cleanup errors on their originating owners
…penclaw#196823) Backport of 22b29a7. Release adaptation: supervisor current-owner join, historical warning and affected consumer regressions only; omit docs and allocation. Preserve current cleanup rejection and native identity proof. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 8595eacf8932bea50351ee2f4ade74617c1647ea)
What Problem This Solves
Fixes Gateway shutdown rejecting an old service-child cleanup error after the originating run has already finished, even when its native process tree has subsequently disappeared.
User Impact
Later shutdown reports the earlier cleanup failure as a warning and can finish draining current work. The original run and scope still receive their failed cleanup result. A failure while shutdown is joining a current run still rejects shutdown.
Why This Change Was Made
The supervisor already removes terminal cleanup attempts from its owned-run set, but its process-wide first-error latch was rethrown on every later shutdown. That historical diagnostic was therefore reported as live plugin-runtime ownership. Keep the diagnostic without replaying it as a new shutdown failure. Native signaling, descendant reaping, receipts, output drainage, and deadlines are unchanged; runtime production LOC is -3. Shutdown now calls the existing complete admission join once instead of wrapping it in a redundant outer retry loop.
The deadline's
pendingfields are negated conditions:stdoutEnd:falsemeans stdout already ended. Linux descendant extinction is established by the subreaper's kernel wait returning ECHILD, independently of pipe EOF. Backgroundsleep,setsid, andnohupremain owned and are reaped on cancellation.Evidence
The new real Linux regression fails on base
6d811790acb43c46e3a7c950f22c3bed22b17f17: pause only the fixture's native owner after root output, expire a 100ms cleanup budget, resume it, verify both owner and descendant disappear in/proc, then observe the old error incorrectly reject shutdown. The fixed code passes. Three additional real background-process controls pass (sleep, setsid, nohup).The existing supervisor regression also fails before the production change and passes afterward, preserving original run/scope errors and checking the historical shutdown warning. Existing tests still reject failures occurring during an active shutdown join.
104 focused tests pass across six supervisor, service-lifecycle, relay-host, and spawn-broker files on macOS. Four real Linux fixture cases pass in 1.55s of test time (4.46s shard wall time after shared worker preparation). The macOS combined run takes 139.73s including 87% worker compilation; no per-test timeout increase.
Before/after owner probe: one warm-up, two A/A controls, three measured samples per side on isolated Linux aarch64 / Node 24.22.1. Median cancellation-through-retirement-and-shutdown: 162.047 → 155.379ms; maximum 163.213 → 164.438ms. Parent CPU 4.243 → 4.084ms; sampled JavaScript allocations 56,184 → 49,848B. Stale shutdown rejection 3/3 → 0/3. Final warm shutdown itself 0.02675 → 0.02713ms. These noisy measurements support a correctness fix, not a speedup claim.
A/A elapsed controls 158.294/161.483 → 154.224/160.339ms; CPU 4.194/4.491 → 3.659/3.757ms; sampled allocation 44,136/40,400 → 55,320/40,744B. The fixed cold diagnostic import costs 6.83ms in the warm-up. The measured slice includes the intentional 100ms deadline and polling observation; CPU excludes descendant CPU. This owner does no database or workspace traversal.
Test-line allocation grants exactly the 81 net added test lines for the real process-tree regression/controls and historical warning assertion; the shared baseline is unchanged.
Final Linux validation passes all five cases, including the existing subreaper fixture; final supervisor/readiness and relay-host reruns pass 43 + 41 cases. Targeted type-aware lint, formatting, the line cap, core production typecheck, and all core test typecheck shards pass. A provisional local rerun was invalidated when the signal fixture changed during compilation; its frozen-source relay rerun passes all 41 cases.
The additional native fixture failure reproduced on the exact main parent: Node 24.22.1 Linux ARM64 ignores signal 34 (confirmed from the child's SigIgn mask), so the fixture from refactor: replace Koffi with fs-safe and proc-safe native packages #168942 (
698cac4c78b806) never killed its child. The minimal correction uses signal 35 and keeps the timeout and extinction assertions. It passes in 1.55s on the final source.pnpm check:changedreports unrelated dead exports: 34 production / 10 full-tree / 0 script. An independent clean checkout of exact parent6d811790acb43c46e3a7c950f22c3bed22b17f17reproduces identical normalized lists, with no resolution errors. The initial line-count finding in the changed supervisor was corrected and its lint/line-cap gates pass. The full changed-file command is recorded as failed, not relabeled green.The additional main unused-export regression is
projectLeaseDiagnosticFrames, introduced by chore(sessions): add bounded delivery generation refusal diagnostics #196724 /2c4e34a72f490: the new helper is exported but only tests import it externally. Prior 33/10 findings trace to feat(compaction): make compaction summary char cap configurable via maxSummaryChars #196207, fix(gateway): avoid unnecessary cold-start initialization #192552, improve(tools): let models call listed MCP tools without searching first #196252, fix(config): config writes switch models to API-key billing without a warning #191326, refactor(plugins): forward auth and catalog to their owners #190205, feat(test): compile subprocesses once per invocation #132716, fix(gateway): reduce cold model-runtime request stalls #139911, refactor(agents): move live model policy to test owner #129184, direct commita7436c8b4a93, refactor(auth): isolate provider auth data contracts #190544, feat(pairing): pair a browser with a short code approved on the host #191513, and fix(openclaw-id): linked claw no longer mints new keys when its key files are lost #196380; their established causal cutovers were reused. None involves this change's exports.Final Codex autoreview of the full local diff against
6d811790acb43is scoped-clean through P2, with complete supervisor context and no accepted/actionable findings. The originating production native stall is not established by this fixture. No production deployment or live-data copying occurred.The initial PR CI exposed five stale historical-shutdown assertions. Commit
192617895f7d0updates the CLI construction, one-shot tools, forced settlement, and source-loaded matrix consumers to retain failure on the original run/scope and let later shutdown finish. The awaited-output fixture now starts shutdown before injecting failure, preserving active-join rejection coverage. All five files pass locally on Linux (16 tests); final awaited-output also passes all eight tests on macOS. Focused lint, formatting, tooling typecheck, and fresh Codex autoreview through P2 pass. This follow-up adds zero test lines and changes no production code.Initial CI run
42884793648also fails the test-line ratchet by 128 lines on merge656842736defbeab7a3351a3672c5e465e586bad. This is independently reproduced on exact main parent924a3bc9ffb3d359fc3a8709768ef0e2fa305d91(6,635,176 total / 6,635,048 ceiling). Causal proof: #196346 /b91520c16b620adf2222b6f9aa245d61b3e0d139adds 138 test lines without allocation; its parente2c3702f6758760842dc649232188873e273b100passes with ten lines slack, and the introducing commit fails by 128. This PR adds exactly 81 lines and 81 allocation, preserving that debt. This is a main regression for follow-up, not a passing broad gate.Final-head status at
192617895f7d0065115abe7f4c95683f8ffc75bc: CI run42887726734 is complete. All test, lint, and security-fast jobs pass; only test-lines in baseline-ratchets and its downstream CI gate fail. Final CI checkout5da4f97bfc79bce785d66b782a64f9f29a1bf75fmerges this head into exact main0c5c4754c33dd9a9e7f4eb4493d4472d458a4609; the canonical ratchet reproduces the same128 debt on that exact main parent (6,635,176 /6,635,048), with the green-to-red introducing commit above. The pinned-head inherited-failure exception is selected; failed CI is not represented as green. ClawSweeper final-head review reports zero findings/open items and no before-merge requirements. Full deployed Gateway stop/restart remains production follow-through.