Repository navigation
Conversation
|
🦞👀 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 measures Crabbox warm-image cleanup budgets with a monotonic clock. Example: Two cleanup executables share a 60-second budget, and the wall clock rewinds 90 seconds after the first command takes about one second.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete cleanup-budget defect still present on current main; the previous finding is resolved, and no introduced correctness or security defect remains. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Crabbox plugin receives allocation, teardown, and periodic maintenance requests, tracks checkpoint retirement obligations, and sends bounded deletion commands through OpenClaw's subprocess runner. flowchart LR
A[Worker lifecycle and maintenance] --> B[Warm image manager]
B --> C[Warm image state store]
B --> D[Shared monotonic cleanup budget]
D --> E[Checkpoint command adapter]
E --> F[Subprocess runner]
F --> G[Crabbox executable]
Technical reviewBest possible solution: Land the focused monotonic-clock substitution while preserving epoch timestamps, existing cleanup authority, and retained deletion obligations. Do we have a high-confidence way to reproduce the issue? Current-main source shows wall-clock deadlines flowing into elapsed-time subprocess timeouts; the contributor reports a failing pre-fix regression, but this read-only review ran no target code. Is this the best way to solve the issue? Changing both deadline seeds and remaining-budget reads at the existing owner fixes the mismatch with minimal complexity and preserves persistent timestamp semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f86442809ea6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +61. Total +61 across 3 files. Added test files: 0. View PR surface stats
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 HistoryReview history (2 earlier review cycles)
Reviewed October 12, 2026, 10:18 AM ET / 14:18 UTC (Revision 3). |
…lock Ref: BUG-095-crabbox-warm-image-deadline-wall-clock-budget
c893314 to
214a6ec
Compare
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in c3d6aa1. Thanks @SunnyShu0925, Crabbox cleanup budgets follow elapsed time. |
…oss wall-clock skew (#168731) The Codex inference WebSocket handshake deadline used wall-clock time, so a wall-clock jump failed an admitted handshake almost immediately after a forward jump, or let it hang past its 10-second budget after a backward jump. The handshake deadline and its callback checks now use monotonic elapsed time, matching #168771 and #169908. Persisted state is unchanged. The queued-admission permit deadline still uses wall-clock time; that is noted as a follow-up. Proof: an isolated built Gateway running the native Codex runtime against the repository's fake app-server, with a loopback TLS WebSocket upstream and clock jumps simulated inside the inference and permit code only. Normal open: 12 ms on main, 11 ms with the PR. +2h: HTTP 504 after 6 ms on main, after 10,037 ms with the PR. -2h: still pending at 15,018 ms on main, 504 at 10,075 ms with the PR. A slow upstream with no jump timed out at about 10 s on both. Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…lock (openclaw#169908) Crabbox warm-image cleanup measured its subprocess time budget with wall-clock time, so a wall-clock correction exhausted the budget early after a forward jump, or let cleanup overrun after a backward jump. The budget now follows monotonic elapsed time, matching openclaw#168771, and persisted image timestamps are unchanged. Proof: an isolated Gateway with the Crabbox extension, a fake crabbox CLI and wall-clock jumps simulated inside the process only. Normal cleanup took about 4s on both. With +2h, main's first sweep exhausted its budget after about 2s, while the PR completed in 4.3s. With -2h, main ran 67.2s, while the PR stopped at the 60s budget. A slow no-jump control stopped at about 60s on both. Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…oss wall-clock skew (openclaw#168731) The Codex inference WebSocket handshake deadline used wall-clock time, so a wall-clock jump failed an admitted handshake almost immediately after a forward jump, or let it hang past its 10-second budget after a backward jump. The handshake deadline and its callback checks now use monotonic elapsed time, matching openclaw#168771 and openclaw#169908. Persisted state is unchanged. The queued-admission permit deadline still uses wall-clock time; that is noted as a follow-up. Proof: an isolated built Gateway running the native Codex runtime against the repository's fake app-server, with a loopback TLS WebSocket upstream and clock jumps simulated inside the inference and permit code only. Normal open: 12 ms on main, 11 ms with the PR. +2h: HTTP 504 after 6 ms on main, after 10,037 ms with the PR. -2h: still pending at 15,018 ms on main, 504 at 10,075 ms with the PR. A slow upstream with no jump timed out at about 10 s on both. Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…oss wall-clock skew (openclaw#168731) The Codex inference WebSocket handshake deadline used wall-clock time, so a wall-clock jump failed an admitted handshake almost immediately after a forward jump, or let it hang past its 10-second budget after a backward jump. The handshake deadline and its callback checks now use monotonic elapsed time, matching openclaw#168771 and openclaw#169908. Persisted state is unchanged. The queued-admission permit deadline still uses wall-clock time; that is noted as a follow-up. Proof: an isolated built Gateway running the native Codex runtime against the repository's fake app-server, with a loopback TLS WebSocket upstream and clock jumps simulated inside the inference and permit code only. Normal open: 12 ms on main, 11 ms with the PR. +2h: HTTP 504 after 6 ms on main, after 10,037 ms with the PR. -2h: still pending at 15,018 ms on main, 504 at 10,075 ms with the PR. A slow upstream with no jump timed out at about 10 s on both. Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 805f43b) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Crabbox warm-image cleanup shares a 60-second budget across checkpoint deletion subprocesses. Measuring the deadline with
Date.now()lets clock corrections exhaust the budget early or inflate the remaining subprocess timeout.What Changed
The collection, capacity-reclamation, and release cleanup deadlines now use
performance.now()for both the deadline and remaining allowance. Existing subprocess timeout normalization handles fractional milliseconds. This follows the same clock-domain correction as #168771.Persisted image creation, demand, and refusal timestamps remain wall-clock values. Retention rules, configured durations, cleanup authority, and retry/deletion-obligation handling are unchanged. Thanks @SunnyShu0925 for the report, fix, and regression coverage.
User Impact
Clock corrections no longer shorten or extend an in-flight warm-image cleanup budget. Normal cleanup behavior is unchanged.
Evidence
Built the pinned main baseline (
e3ec1f2eeaf6b3a24b7e17362383b3c3c6b366b3) and this exact head in isolated Linux containers. Exercised the shipped Gateway with the Crabbox extension enabled and two expired warm-image records. A fakecrabboxexecutable on PATH performs real, deliberately slow subprocess work; no cloud service or credentials are involved. A preload changes only the Gateway process'sDate.now(), never the system clock.The forward-jump baseline was additionally traced at the actual Gateway cleanup deadline: its next remaining-budget read moved forward by two hours and stopped the sweep. A clock jump can also make the Gateway scheduler run a subsequent maintenance sweep promptly; one initial run observed that retry clear the remaining image. The defect is the prematurely exhausted original budget, not a claim that cleanup can never retry.
Focused checks: both affected test files passed (29 tests; 37.76s wrapper wall time). Changed-file oxfmt and oxlint passed. A separate bounded real OpenAI
gpt-5-miniCLI smoke returned the requested marker with one provider request.No overlap with Pash/Sarah changes. #169886 touches only
crabbox-worker-node-enrollment.ts, not this PR's three files.Merge Risk
Two-way door: reverting restores the former deadline calculation without a migration. No schema, persisted timestamp format, public API, permissions, or configuration changes. Blast radius is limited to Crabbox warm-image cleanup timing during allocation, maintenance, and teardown.