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 changesMeasure total model-probe duration with a monotonic clock while preserving epoch timestamps and request-only latency. Example: The clock moves backward 60 seconds during an OpenAI model probe.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a concrete diagnostic bug still present on current main, with a minimal implementation and no identified defects. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCLI model-status checks and Gateway model probes call runAuthProbes, which plans credential checks, dispatches isolated completions, and returns diagnostic results. flowchart TD
A[Models status CLI] --> C[runAuthProbes]
B[Gateway model probe] --> C
C --> D[Credential target planner]
D --> E[Isolated completion]
E --> F[Provider HTTP transport]
F --> G[Probe results and elapsed summary]
Technical reviewBest possible solution: Use the existing probe owner’s monotonic clock for aggregate elapsed time, as this PR does. Do we have a high-confidence way to reproduce the issue? Current-main source directly exposes wall-clock subtraction, and the contributor’s built-CLI base traces demonstrate negative and inflated durations; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete fix: elapsed duration becomes independent of clock corrections without changing timestamps, target selection, credential handling, cleanup, or request latency. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a967a625464a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1, Tests +17, Other +2. Total +18 across 3 files. Added test files: 0. View PR surface stats
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 1, 2026, 11:17 PM ET / November 2, 2026, 04:17 UTC. |
|
@clawsweeper Thanks for the review! |
…ions (#190894) fix: measure durations, timeouts and cache ages with the monotonic clock Several timeouts, cache TTLs and retry backoffs measured elapsed time with the wall clock. When the system clock jumped (NTP correction, sleep and resume, manual change), they fired too early, never fired, or ignored server backoff. These callers now use the monotonic clock (`src/shared/monotonic-time.ts` in core, `performance.now()` in extensions). Stored and displayed timestamps stay on the wall clock, and SDK signatures and public epochs are unchanged. This sweep includes #190846, #190852, #190853, #187703, #187689, #187782, #187765, #189161, #189160 and #190098, with the contributors' commits kept for credit. Evidence: built Gateway, CLI and real Chromium, main twice and candidate twice, stepping only the process wall clock (`Date.now`); no system clock change. On main, a Discord deployment timeout aborted or overran after a 60-second step, the Chromium context popover retried after about 100 ms despite server backoff, and the `sessions.usage`, Pi session catalog and GitHub project caches refreshed too early or too late. With this change, each followed real elapsed time. Ordinary controls passed, and epoch timestamps were unchanged. Details: #190894 (comment). Thanks @Alix-007, @chengzhichao-xydt, @huwei-xydt. Co-authored-by: Alix-007 <[email protected]> Co-authored-by: chengzhichao-xydt <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: 胡伟0668000622 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…ions (openclaw#190894) fix: measure durations, timeouts and cache ages with the monotonic clock Several timeouts, cache TTLs and retry backoffs measured elapsed time with the wall clock. When the system clock jumped (NTP correction, sleep and resume, manual change), they fired too early, never fired, or ignored server backoff. These callers now use the monotonic clock (`src/shared/monotonic-time.ts` in core, `performance.now()` in extensions). Stored and displayed timestamps stay on the wall clock, and SDK signatures and public epochs are unchanged. This sweep includes openclaw#190846, openclaw#190852, openclaw#190853, openclaw#187703, openclaw#187689, openclaw#187782, openclaw#187765, openclaw#189161, openclaw#189160 and openclaw#190098, with the contributors' commits kept for credit. Evidence: built Gateway, CLI and real Chromium, main twice and candidate twice, stepping only the process wall clock (`Date.now`); no system clock change. On main, a Discord deployment timeout aborted or overran after a 60-second step, the Chromium context popover retried after about 100 ms despite server backoff, and the `sessions.usage`, Pi session catalog and GitHub project caches refreshed too early or too late. With this change, each followed real elapsed time. Ordinary controls passed, and epoch timestamps were unchanged. Details: openclaw#190894 (comment). Thanks @Alix-007, @chengzhichao-xydt, @huwei-xydt. Co-authored-by: Alix-007 <[email protected]> Co-authored-by: chengzhichao-xydt <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: 胡伟0668000622 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: models status --probe reports negative or inflated total check time when the system clock changes during the check.
User Impact
User impact: operators receive a meaningful total check duration, while start/finish timestamps retain their wall-clock meaning and request-only latency remains a separate measurement.
Why This Change Was Made
Measure the existing probe batch interval with the monotonic clock. Keep the public startedAt and finishedAt fields as epoch timestamps.
Evidence
Base
bc097bf6404f34be1e57cdee8bd0b2d7f59a3070→ product headca10aa766851cde88622485a1a1d9a99f338879f. Linux, Node v26.12.1, pnpm 12.15.0; normally built openclaw.mjs, isolated HOME/config/state for every CLI invocation. Clock correction is injected only after the independent receiver sees the request. Product owners, transport, provider dispatch, and JSON rendering are not replaced. Ordinary, -60 s, +60 s, and -60 s/refusal cases use the same collector on both frozen revisions.All 4 cases reach the independent receiver; 3 successful cases and 1 explicit refusal retain correct classification; all CLI exits are 0, all watchdog flags false, all configs unchanged, all peers closed.
node openclaw.mjs models status --probe --probe-provider openai --probe-timeout 10000 --probe-max-tokens 8 --json.src/commands/models/list.probe.ts (runAuthProbes aggregate summary).node proof-probes.mjs "$CHECKOUT" "$OUTPUT" models "$EXPECT".node --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup, exit 0 (264.36 s on head); clean build stamp matches the product commit.Actual stdout/RPC readbacks and cleanup records (fixture paths normalized)
{ "base": { "head": "bc097bf6404f34be1e57cdee8bd0b2d7f59a3070", "cleanBuild": true, "cases": [ { "case": "ordinary", "command": [ "node", "--import", "$TASK/proof-models-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": 0, "summary": { "startedAt": 1793590781274, "finishedAt": 1793590782922, "durationMs": 1648, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "ok", "latencyMs": 244 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 0, "at": 8741.079557 } ] }, { "case": "backward", "command": [ "node", "--import", "$TASK/proof-models-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": -60000, "summary": { "startedAt": 1793590788665, "finishedAt": 1793590730045, "durationMs": -58620, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "ok", "latencyMs": 242 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 6912.525447 } ] }, { "case": "forward", "command": [ "node", "--import", "$TASK/proof-models-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": 60000, "summary": { "startedAt": 1793590795769, "finishedAt": 1793590857182, "durationMs": 61413, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "ok", "latencyMs": 249 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 60000, "at": 6858.84733 } ] }, { "case": "failure-control", "command": [ "node", "--import", "$TASK/proof-models-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": -60000, "summary": { "startedAt": 1793590803188, "finishedAt": 1793590744714, "durationMs": -58474, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "auth", "error": "403 Synthetic provider refusal", "latencyMs": 242 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 7302.507479 } ] } ] }, "head": { "head": "ca10aa766851cde88622485a1a1d9a99f338879f", "cleanBuild": true, "cases": [ { "case": "ordinary", "command": [ "node", "--import", "$TASK/proof-models-publish-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": 0, "summary": { "startedAt": 1793590598706, "finishedAt": 1793590600423, "durationMs": 1717, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "ok", "latencyMs": 248 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 0, "at": 8593.243019 } ] }, { "case": "backward", "command": [ "node", "--import", "$TASK/proof-models-publish-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": -60000, "summary": { "startedAt": 1793590606059, "finishedAt": 1793590547488, "durationMs": 1429, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "ok", "latencyMs": 251 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 6826.630406 } ] }, { "case": "forward", "command": [ "node", "--import", "$TASK/proof-models-publish-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": 60000, "summary": { "startedAt": 1793590613142, "finishedAt": 1793590674607, "durationMs": 1465, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "ok", "latencyMs": 264 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 60000, "at": 6914.380174 } ] }, { "case": "failure-control", "command": [ "node", "--import", "$TASK/proof-models-publish-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "models", "status", "--probe", "--probe-provider", "openai", "--probe-timeout", "10000", "--probe-max-tokens", "8", "--json" ], "offsetMs": -60000, "summary": { "startedAt": 1793590620186, "finishedAt": 1793590561709, "durationMs": 1523, "totalTargets": 1, "options": { "provider": "openai", "profileIds": [], "timeoutMs": 10000, "concurrency": 2, "maxTokens": 8 }, "results": [ { "provider": "openai", "model": "openai/fixture", "label": "models.json", "source": "models.json", "mode": "api_key", "status": "auth", "error": "403 Synthetic provider refusal", "latencyMs": 244 } ] }, "receiverRequests": [ { "method": "POST", "path": "/v1/chat/completions", "model": "fixture", "stream": true, "authorizationIsFixture": true } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 6856.843075 } ] } ] } }Complete proof collector source
proof-probes.mjs(sha256731dd989365d840db4ffd98deb9bae030342e4fa01c6a3231953cc66dca5c889):