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 the Pi session discovery cache lifetime with monotonic time so system-clock corrections do not change its refresh interval. Example: Create pi-clock-second after warming the catalog, move the wall clock backward 60 seconds, and wait 33 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this PR open for merging: it fixes a concrete cache-expiry bug still present on current main, with no actionable defects found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe bundled acpx plugin discovers native Pi session files and projects them into catalog responses; its process-local candidate cache bounds directory scanning. flowchart LR
A[Catalog client] --> B[Gateway catalog RPC]
B --> C[Pi catalog provider]
C --> D[Candidate cache]
E[Monotonic clock] --> D
D --> F[Pi session files]
F --> G[Session summaries]
G --> B
Technical reviewBest possible solution: Merge the focused monotonic-clock repair in the existing Pi candidate-cache owner. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the faulty wall-clock comparison, and supplied base/head Gateway readbacks demonstrate the failure and repair; no target code was executed during this review. Is this the best way to solve the issue? Yes: replacing both duration-clock reads fixes the cause without adding state, wrappers, configuration, or another cache owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5396fbf92a3f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests +20, Other +2. Total +22 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 Reviewed November 1, 2026, 11:07 PM ET / November 2, 2026, 04:07 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: new Pi sessions remain missing from the session catalog beyond its 32-second refresh window when the system clock moves backward.
User Impact
User impact: newly created Pi sessions become discoverable after the existing refresh window despite clock corrections, without premature directory rescans after a forward correction.
Why This Change Was Made
Measure the process-local candidate snapshot lifetime with the monotonic clock. File timestamps, catalog rows, the existing 32-second policy, and continuation eligibility keep their existing contracts.
Evidence
Base
bc097bf6404f34be1e57cdee8bd0b2d7f59a3070→ product head2998500fa946349057da3b47820f194ed9ab270e. Ubuntu 24 Linux container, Node v26.12.1, built OpenClaw 2026.10.9. Network disabled at the container boundary; only isolated loopback WebSocket traffic. The published collector uses the pre-existing local test-image name; its exact image ID is sha256:39a6e6f0c5f1fc700b3eab6c19b973f8c01105e2a5efa37c264d0d8130353873. The inner Node collector is included separately and needs only the normal build and isolated HOME/state/workspace directories. At most one authenticated client is active; reconnects avoid the separate Gateway stale-while-revalidate page cache while retaining the same process-local Pi cache.Warm and pre-expiry lists each contain 1 original thread and 0 new threads; restored-clock control contains 2 threads; both source files and config unchanged; Gateway exits 0 and port closes.
Normally built openclaw.mjs gateway run; authenticated sessions.catalog.list with catalogId=pi, agentId=main, hostIds=[gateway], limitPerHost=20, allowPartialResults=false.extensions/acpx/src/pi-session-store.ts (Pi candidate discovery cache).python3 proof-pi.py --checkout "$CHECKOUT" --node-dir "$NODE_DIR" --output "$OUTPUT" --expect "$EXPECT".node --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup, exit 0 (251.74 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, "realCacheAgeMs": 33002.796116, "rpcs": [ { "name": "warm-original", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-base-v3/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793588854439.4705, "recencyAt": 1793588854439.4705, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first" ], "elapsedMs": 418.52101799999946 }, { "name": "within-ttl-control", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-base-v3/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793588854439.4705, "recencyAt": 1793588854439.4705, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first" ], "elapsedMs": 15.459656000002724 }, { "name": "backward-clock-after-real-ttl", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-base-v3/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793588854439.4705, "recencyAt": 1793588854439.4705, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first" ], "elapsedMs": 5.951655999997456 }, { "name": "restored-clock-positive-control", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-second", "name": "Synthetic pi-clock-second", "cwd": "$TASK/proof-pi-base-v3/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793588875852.084, "recencyAt": 1793588875852.084, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false }, { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-base-v3/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793588854439.4705, "recencyAt": 1793588854439.4705, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first", "pi-clock-second" ], "elapsedMs": 6.612996000003477 } ], "sourceFilesUnchanged": true, "configReadsUnchanged": true, "cleanup": { "gateway": { "code": 0, "signal": null }, "forced": false, "offsetRestored": true, "portClosed": true } }, "head": { "head": "2998500fa946349057da3b47820f194ed9ab270e", "cleanBuild": true, "realCacheAgeMs": 33002.30611799999, "rpcs": [ { "name": "warm-original", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-head/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793590156576.611, "recencyAt": 1793590156576.611, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first" ], "elapsedMs": 142.4966740000018 }, { "name": "within-ttl-control", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-head/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793590156576.611, "recencyAt": 1793590156576.611, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first" ], "elapsedMs": 3.6305470000006608 }, { "name": "backward-clock-after-real-ttl", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-second", "name": "Synthetic pi-clock-second", "cwd": "$TASK/proof-pi-head/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793590176602.12, "recencyAt": 1793590176602.12, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false }, { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-head/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793590156576.611, "recencyAt": 1793590156576.611, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first", "pi-clock-second" ], "elapsedMs": 8.912336000001233 }, { "name": "restored-clock-positive-control", "method": "sessions.catalog.list", "params": { "catalogId": "pi", "agentId": "main", "hostIds": [ "gateway" ], "limitPerHost": 20, "allowPartialResults": false }, "value": { "catalogs": [ { "id": "pi", "label": "Pi", "capabilities": { "continueSession": true, "archive": false, "openTerminal": true }, "hosts": [ { "hostId": "gateway", "label": "Local Pi", "kind": "gateway", "connected": true, "sessions": [ { "threadId": "pi-clock-second", "name": "Synthetic pi-clock-second", "cwd": "$TASK/proof-pi-head/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793590176602.12, "recencyAt": 1793590176602.12, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false }, { "threadId": "pi-clock-first", "name": "Synthetic pi-clock-first", "cwd": "$TASK/proof-pi-head/workspace", "status": "stored", "createdAt": 1783936800000, "updatedAt": 1793590156576.611, "recencyAt": 1793590156576.611, "source": "pi-cli", "modelProvider": "pi", "archived": false, "canContinue": false, "canArchive": false, "canOpenTerminal": false } ] } ] } ] }, "ids": [ "pi-clock-first", "pi-clock-second" ], "elapsedMs": 4.4291119999979855 } ], "sourceFilesUnchanged": true, "configReadsUnchanged": true, "cleanup": { "gateway": { "code": 0, "signal": null }, "forced": false, "offsetRestored": true, "portClosed": true } } }Complete proof collector source
proof-pi-inner.mjs(sha256e039b33adcd23d9186a83152fb4ed44249b375d954a327062e425df9faea0e9f):proof-pi.py(sha256d00ce59333544eccc1feb599572cbf66e2070b84d9a0f8d35401a55c88367c26):