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 Gateway probe duration and connection latency with a monotonic clock while preserving epoch timestamps. Example: The clock moves backward 60 seconds during a successful Gateway probe.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current diagnostic bug with a focused change and credible CLI evidence; no introduced correctness defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway probe command discovers targets, invokes the shared WebSocket probe, and renders reachability, capabilities, and timing diagnostics. flowchart LR
A[Gateway probe CLI] --> B[Target discovery]
B --> C[Shared Gateway probe]
C --> D[WebSocket client]
D --> E[Gateway endpoint]
C --> F[Timing and reachability output]
Technical reviewBest possible solution: Retain the existing probe owners and use rounded monotonic differences for elapsed milliseconds. Do we have a high-confidence way to reproduce the issue? Current-main wall-clock subtraction directly explains the failure, and the contributor supplies matching built-CLI base/head observations; this review executed no target code. Is this the best way to solve the issue? This is the smallest complete fix: replace the elapsed-time clock at both existing owners, preserve integer milliseconds and epoch timestamps, and cover aggregate, success, and refusal paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c43f8d0937ff. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +51, Other +2. Total +53 across 5 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:19 PM ET / November 2, 2026, 04:19 UTC. |
|
@clawsweeper re-review Thanks for the review! Fixed the test lint failure; the updated exact-head CLI proof and required CI are green. |
|
🦞👀 Re-review progress:
|
…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: gateway probe duration and connection latency become negative or inflate by a minute when the system clock changes during a probe.
User Impact
User impact: gateway diagnostics report actual elapsed probe and connection time through successful and refused connections, so automation receives meaningful timing values.
Why This Change Was Made
Measure the command aggregate and both handshake-result timing paths with the monotonic clock, keeping the JSON ts field as an epoch timestamp.
Evidence
Base
bc097bf6404f34be1e57cdee8bd0b2d7f59a3070→ product headea7829917718dcaded9d9c449081d1647ec9ab36. 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; successful cases exit 0 and the explicit refusal exits 1; all signals are null, all watchdog flags false, all configs unchanged, all peers closed.
node openclaw.mjs gateway probe --url ws://127.0.0.1:$PORT --token clock-fixture --timeout 5000 --json.src/commands/gateway-status.ts and src/gateway/probe.ts.node proof-probes.mjs "$CHECKOUT" "$OUTPUT" gateway "$EXPECT".node --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup, exit 0 (217.14 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-gateway-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:41329", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": 0, "summary": { "ok": true, "ts": 1793590812251, "durationMs": 1929, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:41329", "active": true, "tunnel": null, "connect": { "ok": true, "rpcOk": true, "scopeLimited": false, "latencyMs": 720, "error": null, "close": null }, "auth": { "role": "operator", "scopes": [ "operator.admin" ], "capability": "admin_capable" }, "server": { "version": "fixture", "connId": "fixture" }, "self": { "host": "fixture" }, "config": { "path": "fixture.json", "exists": true, "valid": true, "issues": [], "legacyIssues": [], "gateway": { "mode": "local", "bind": null, "port": null, "controlUiEnabled": null, "controlUiBasePath": null, "authMode": null, "authTokenConfigured": false, "authPasswordConfigured": false, "remoteUrl": null, "remoteTokenConfigured": false, "remotePasswordConfigured": false, "tailscaleMode": null }, "discovery": { "wideAreaEnabled": null } }, "health": { "ok": true }, "summary": { "ok": true }, "presence": [ { "mode": "gateway", "reason": "self", "host": "fixture", "text": "Synthetic Gateway", "ts": 1793590812246 } ] } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true }, { "method": "health" }, { "method": "status" }, { "method": "system-presence" }, { "method": "config.get" } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 0, "at": 7032.621448 } ] }, { "case": "backward", "command": [ "node", "--import", "$TASK/proof-gateway-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:35077", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": -60000, "summary": { "ok": true, "ts": 1793590759267, "durationMs": -57961, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:35077", "active": true, "tunnel": null, "connect": { "ok": true, "rpcOk": true, "scopeLimited": false, "latencyMs": -59181, "error": null, "close": null }, "auth": { "role": "operator", "scopes": [ "operator.admin" ], "capability": "admin_capable" }, "server": { "version": "fixture", "connId": "fixture" }, "self": { "host": "fixture" }, "config": { "path": "fixture.json", "exists": true, "valid": true, "issues": [], "legacyIssues": [], "gateway": { "mode": "local", "bind": null, "port": null, "controlUiEnabled": null, "controlUiBasePath": null, "authMode": null, "authTokenConfigured": false, "authPasswordConfigured": false, "remoteUrl": null, "remoteTokenConfigured": false, "remotePasswordConfigured": false, "tailscaleMode": null }, "discovery": { "wideAreaEnabled": null } }, "health": { "ok": true }, "summary": { "ok": true }, "presence": [ { "mode": "gateway", "reason": "self", "host": "fixture", "text": "Synthetic Gateway", "ts": 1793590819262 } ] } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true }, { "method": "health" }, { "method": "status" }, { "method": "system-presence" }, { "method": "config.get" } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 6833.463267 } ] }, { "case": "forward", "command": [ "node", "--import", "$TASK/proof-gateway-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:37245", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": 60000, "summary": { "ok": true, "ts": 1793590886369, "durationMs": 62122, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:37245", "active": true, "tunnel": null, "connect": { "ok": true, "rpcOk": true, "scopeLimited": false, "latencyMs": 60849, "error": null, "close": null }, "auth": { "role": "operator", "scopes": [ "operator.admin" ], "capability": "admin_capable" }, "server": { "version": "fixture", "connId": "fixture" }, "self": { "host": "fixture" }, "config": { "path": "fixture.json", "exists": true, "valid": true, "issues": [], "legacyIssues": [], "gateway": { "mode": "local", "bind": null, "port": null, "controlUiEnabled": null, "controlUiBasePath": null, "authMode": null, "authTokenConfigured": false, "authPasswordConfigured": false, "remoteUrl": null, "remoteTokenConfigured": false, "remotePasswordConfigured": false, "tailscaleMode": null }, "discovery": { "wideAreaEnabled": null } }, "health": { "ok": true }, "summary": { "ok": true }, "presence": [ { "mode": "gateway", "reason": "self", "host": "fixture", "text": "Synthetic Gateway", "ts": 1793590826364 } ] } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true }, { "method": "health" }, { "method": "status" }, { "method": "system-presence" }, { "method": "config.get" } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 60000, "at": 6920.991176 } ] }, { "case": "failure-control", "command": [ "node", "--import", "$TASK/proof-gateway-publish-base/clock-step.mjs", "$BASE_CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:35563", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": -60000, "summary": { "ok": false, "ts": 1793590773934, "durationMs": -57959, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:35563", "active": true, "tunnel": null, "connect": { "ok": false, "rpcOk": false, "scopeLimited": false, "latencyMs": -59241, "error": "gateway closed (1008): Synthetic refusal", "close": { "code": 1008, "reason": "Synthetic refusal" } }, "auth": { "role": null, "scopes": [], "capability": "unknown" }, "server": { "version": null, "connId": null }, "self": null, "config": null, "health": null, "summary": null, "presence": null } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true } ], "terminal": { "code": 1, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 7364.2323 } ] } ] }, "head": { "head": "ea7829917718dcaded9d9c449081d1647ec9ab36", "cleanBuild": true, "cases": [ { "case": "ordinary", "command": [ "node", "--import", "$TASK/proof-gateway-repair-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:37541", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": 0, "summary": { "ok": true, "ts": 1793593996226, "durationMs": 1986, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:37541", "active": true, "tunnel": null, "connect": { "ok": true, "rpcOk": true, "scopeLimited": false, "latencyMs": 743, "error": null, "close": null }, "auth": { "role": "operator", "scopes": [ "operator.admin" ], "capability": "admin_capable" }, "server": { "version": "fixture", "connId": "fixture" }, "self": { "host": "fixture" }, "config": { "path": "fixture.json", "exists": true, "valid": true, "issues": [], "legacyIssues": [], "gateway": { "mode": "local", "bind": null, "port": null, "controlUiEnabled": null, "controlUiBasePath": null, "authMode": null, "authTokenConfigured": false, "authPasswordConfigured": false, "remoteUrl": null, "remoteTokenConfigured": false, "remotePasswordConfigured": false, "tailscaleMode": null }, "discovery": { "wideAreaEnabled": null } }, "health": { "ok": true }, "summary": { "ok": true }, "presence": [ { "mode": "gateway", "reason": "self", "host": "fixture", "text": "Synthetic Gateway", "ts": 1793593996221 } ] } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true }, { "method": "health" }, { "method": "status" }, { "method": "system-presence" }, { "method": "config.get" } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 0, "at": 6650.723809 } ] }, { "case": "backward", "command": [ "node", "--import", "$TASK/proof-gateway-repair-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:41039", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": -60000, "summary": { "ok": true, "ts": 1793593942499, "durationMs": 1839, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:41039", "active": true, "tunnel": null, "connect": { "ok": true, "rpcOk": true, "scopeLimited": false, "latencyMs": 761, "error": null, "close": null }, "auth": { "role": "operator", "scopes": [ "operator.admin" ], "capability": "admin_capable" }, "server": { "version": "fixture", "connId": "fixture" }, "self": { "host": "fixture" }, "config": { "path": "fixture.json", "exists": true, "valid": true, "issues": [], "legacyIssues": [], "gateway": { "mode": "local", "bind": null, "port": null, "controlUiEnabled": null, "controlUiBasePath": null, "authMode": null, "authTokenConfigured": false, "authPasswordConfigured": false, "remoteUrl": null, "remoteTokenConfigured": false, "remotePasswordConfigured": false, "tailscaleMode": null }, "discovery": { "wideAreaEnabled": null } }, "health": { "ok": true }, "summary": { "ok": true }, "presence": [ { "mode": "gateway", "reason": "self", "host": "fixture", "text": "Synthetic Gateway", "ts": 1793594002494 } ] } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true }, { "method": "health" }, { "method": "status" }, { "method": "system-presence" }, { "method": "config.get" } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 6075.060292 } ] }, { "case": "forward", "command": [ "node", "--import", "$TASK/proof-gateway-repair-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:39199", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": 60000, "summary": { "ok": true, "ts": 1793594068927, "durationMs": 1803, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:39199", "active": true, "tunnel": null, "connect": { "ok": true, "rpcOk": true, "scopeLimited": false, "latencyMs": 773, "error": null, "close": null }, "auth": { "role": "operator", "scopes": [ "operator.admin" ], "capability": "admin_capable" }, "server": { "version": "fixture", "connId": "fixture" }, "self": { "host": "fixture" }, "config": { "path": "fixture.json", "exists": true, "valid": true, "issues": [], "legacyIssues": [], "gateway": { "mode": "local", "bind": null, "port": null, "controlUiEnabled": null, "controlUiBasePath": null, "authMode": null, "authTokenConfigured": false, "authPasswordConfigured": false, "remoteUrl": null, "remoteTokenConfigured": false, "remotePasswordConfigured": false, "tailscaleMode": null }, "discovery": { "wideAreaEnabled": null } }, "health": { "ok": true }, "summary": { "ok": true }, "presence": [ { "mode": "gateway", "reason": "self", "host": "fixture", "text": "Synthetic Gateway", "ts": 1793594008923 } ] } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true }, { "method": "health" }, { "method": "status" }, { "method": "system-presence" }, { "method": "config.get" } ], "terminal": { "code": 0, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": 60000, "at": 6237.999998 } ] }, { "case": "failure-control", "command": [ "node", "--import", "$TASK/proof-gateway-repair-head/clock-step.mjs", "$CHECKOUT/openclaw.mjs", "gateway", "probe", "--url", "ws://127.0.0.1:42297", "--token", "clock-fixture", "--timeout", "5000", "--json" ], "offsetMs": -60000, "summary": { "ok": false, "ts": 1793593955474, "durationMs": 1796, "targets": [ { "id": "explicit", "kind": "explicit", "url": "ws://127.0.0.1:42297", "active": true, "tunnel": null, "connect": { "ok": false, "rpcOk": false, "scopeLimited": false, "latencyMs": 757, "error": "gateway closed (1008): Synthetic refusal", "close": { "code": 1008, "reason": "Synthetic refusal" } }, "auth": { "role": null, "scopes": [], "capability": "unknown" }, "server": { "version": null, "connId": null }, "self": null, "config": null, "health": null, "summary": null, "presence": null } ] }, "receiverRequests": [ { "method": "connect", "tokenIsFixture": true } ], "terminal": { "code": 1, "signal": null }, "watchdog": false, "configUnchanged": true, "peerClosed": true, "clock": [ { "offsetMs": -60000, "at": 6352.40918 } ] } ] } }Complete proof collector source
proof-probes.mjs(sha256731dd989365d840db4ffd98deb9bae030342e4fa01c6a3231953cc66dca5c889):