Repository navigation
fix(cli): restore lightweight help and cleanup test startup - #197936
Conversation
Match the real CLI child startup before exercising retained cleanup custody. Preserve the documented one-second signal settlement policy and original deadlines; remove parent-only database seeding and the temporary diagnostics that identified the missing setup.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR loads TLS diagnostics only when the exit watchdog fires and gives cleanup-test children the Gateway’s existing boot lifecycle. Example: Run openclaw --help.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — suspected predecessor, not a causality claim: source commit Possible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR makes focused, useful repairs to CLI import loading and cleanup-test startup; no actionable defects were found, and exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCLI entrypoints share exit finalization and its residual-handle watchdog; Gateway process tests exercise boot, signal handling, and cleanup custody. flowchart TD
A[CLI invocation] --> B[Help or command]
B --> C[Exit finalization]
C --> D[Watchdog fires]
D --> E[Load TLS diagnostics]
F[Cleanup test child] --> G[Gateway boot lifecycle]
G --> H[Signal and cleanup custody]
Technical reviewBest possible solution: Keep the existing watchdog and boot-lifecycle owners, with TLS deferred to diagnostics and child-owned boot publication before cleanup signals. Do we have a high-confidence way to reproduce the issue? Current-main source unconditionally imports TLS through exit finalization, and the existing help guard directly detects it; the cleanup fixture also demonstrably omits the production boot hooks, although its timing failure was not independently replayed. Is this the best way to solve the issue? The patch repairs both boundaries through existing owners, removes obsolete diagnostic scaffolding, and preserves the accepted timeout and cleanup contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4efd662cc2c6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests -34. Total -34 across 3 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. 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 HistoryReview history (1 earlier review cycle)
Reviewed November 12, 2026, 5:47 PM ET / 22:47 UTC (Revision 2). |
Keep the precomputed help path free of TLS initialization introduced by #197382. Acquire the same constructor synchronously inside the existing watchdog callback; preserve its diagnostics, timer, finalization and exit behavior.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…#197936) * test(gateway): run boot lifecycle before cleanup signal proof Match the real CLI child startup before exercising retained cleanup custody. Preserve the documented one-second signal settlement policy and original deadlines; remove parent-only database seeding and the temporary diagnostics that identified the missing setup. * fix(cli): load TLS diagnostics only when the exit watchdog fires Keep the precomputed help path free of TLS initialization introduced by openclaw#197382. Acquire the same constructor synchronously inside the existing watchdog callback; preserve its diagnostics, timer, finalization and exit behavior.
Backport only the cleanup-fixture portion of d30e45c, adapting the existing release boot lifecycle signature. Preserve signal deadlines and custody assertions; do not take the unrelated TLS change. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
What Problem This Solves
Two CLI boundaries were broken: precomputed root help loaded TLS solely for delayed watchdog diagnostics, and the retained-cleanup fixture skipped the child’s real boot lifecycle before sending SIGUSR2. On a cold worker, that missing setup could consume the accepted one-second intent-settlement budget before cleanup began.
User Impact
Root help avoids unnecessary TLS initialization. Cleanup tests reach the intended retained-resource behavior. CLI output, watchdog diagnostics, shutdown ordering, signal policy, and deadlines remain unchanged.
Why This Change Was Made
Resolve the exact TLS constructor synchronously only when the existing watchdog fires, replacing the unconditional import introduced by #197382. Run the cleanup-test child through the same begin/complete boot hooks as the Gateway CLI, replacing parent-only database seeding and removing the temporary diagnostics that identified the missing setup. Keep real OS signals, durable restart intent, cleanup-custody assertions, and the prohibition on reusing a retained runtime. Production LOC is net zero; test LOC is net −34.
Evidence
The original cleanup failure is full run 43299098210, small10: cold worker open 979.867 ms plus intent execution 39.378 ms crossed the documented one-second limit. A local original replay passed below that threshold; it is a non-reproduction, not flake evidence. refactor: resume running sessions after graceful restarts #185730 introduced the incomplete fixture; fix(gateway): preserve graceful shutdown when restart intent stalls #188047 documents the deliberately accepted timeout policy. The recent latency-threshold introducer is unknown.
The fixture-only head
41ea5595d78aapassed all three cases on Linux, changed2 job 131525849696, using pinned Bun1.4.4-canary.1+191755ec1. SIGTERM / SIGUSR2 / historical SIGTERM took 3.770 s / 3.303 s / 27.664 s with unchanged deadlines. This is prior-head evidence because the combined patch changes an imported cleanup owner; new exact-head CI must run it again.The same PR run exposed the root-help TLS import failure. Exact parent
097e6484contains the same owner introduced by chore: identify slow database shutdown owners #197382 /32c839b6f0b55. The existing help test establishes the regression without weakening its import guard.Exact-parent help regression: red before the TLS move, green afterward using the unchanged test. All 43 help/finalization and 12 cleanup/watchdog cases passed, including the real Node 24.22.1 TLS/child diagnostic path and pinned-Bun watchdog paths. Required owner
pnpm check:changedpassed.Combined-source cleanup replay: 3/3 passed locally (3.137 s / 2.123 s / 19.928 s) with unchanged deadlines. The earlier full fixture changed-check and canonical config-cli typecheck also passed; unchanged owner checks are reused with exact source qualification. Fresh combined Codex review of the complete three-file range from
097e6484through the final local snapshot is P0–P2 scoped-clean, with no findings. Final combined-head CI 43322340111 passed; final-head ClawSweeper has zero findings and zero open items. No performance improvement or infrastructure/flaky-failure claim; no inherited-red merge exemption.Final
336a0ce0f78dactual Linux proof: cleanup changed2 passed all three cases (SIGTERM 4.595 s / SIGUSR2 3.897 s / historical SIGTERM 32.437 s); help changed3 passed all 25 cases, including the unchanged precomputed-root import guard. Both ran on the exact PR merge source094514eeafc0with pinned Bun1.4.4-canary.1+191755ec1and Node 24.22.1. The existing deadlines and signal policy remain unchanged.