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. |
`runBrowserProxyCommand` seeded the request deadline with `Date.now()` and derived the dispatch budget from the same wall-clock epoch (`deadlineAt - Date.now()`), while `withTimeout` consumes that budget on a monotonic `setTimeout`. A forward clock step shrank the budget to zero and fenced a healthy proxy request as `browser proxy timed out`; a rollback inflated it and let an expired request outlive the configured timeout. The deadline is process-local — never serialized, persisted, or compared to a wall-clock epoch by another process — so the monotonic clock is the only correct source. Two reads now use `performance.now()`; no signature, config, or timeout-text change.
9b98f90 to
c8ea4b5
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR measures the browser node’s proxy deadline with performance.now() so wall-clock changes cannot resize its remaining budget. Example: The node’s wall clock advances one hour while staging an upload with a 3000 ms proxy budget.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current browser-node timeout defect with a minimal change, relevant regressions, and sufficient exact-head runtime proof; no blocking findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe browser plugin receives node commands from the Gateway, stages upload bytes, dispatches browser routes with the remaining request budget, and returns a serialized result or timeout. flowchart LR
A[Nodes invoke CLI] --> B[Gateway]
B --> C[Paired browser node]
C --> D[Upload staging]
D --> E[Monotonic remaining budget]
E --> F[Browser route dispatcher]
F --> G[Chromium file input]
Technical reviewBest possible solution: Merge the focused monotonic-clock repair while retaining the existing timeout owner, defaults, cancellation, and upload lifecycle. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the clock-domain mismatch, and supplied built-runtime A/B evidence reproduces both directions through the shipped CLI and node path; this read-only review ran no target code. Is this the best way to solve the issue? Replacing both process-local deadline reads is the smallest complete repair: elapsed request time must remain independent of wall-clock adjustments, and no new state or abstraction is needed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 94d8f428691a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests +48. Total +48 across 2 files. Added test files: 0. View PR surface stats
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 HistoryReviewed October 27, 2026, 10:55 AM ET / 14:55 UTC (Revision 3). |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
Independent built Gateway + node-host + Chromium proofExact candidate The operator used shipped Clock simulation: only the task-owned node-host process has a preload wrapping
Whole-CLI elapsed times (include CLI startup, Gateway transport and status diagnostics; these are not pure proxy execution timings): forward main 973/659 ms, candidate 1432/957 ms; rollback main 3198/3080 ms, candidate 1210/1052 ms; no-step main 936 ms, candidate 926 ms. Each case has exactly one recorded staging-edge trigger; the no-step trigger applies offset zero. Native requests, error text and browser file-selection readback support the deadline distinction independently of these startup-inclusive timings. The initial setup used an unsupported browser-profile Current exact-head |
|
@clawsweeper re-review Independent exact-head built Gateway/paired-node/native-Chromium clock-step A/B evidence is linked in the body: two forward jumps per ref, two rollback cases per ref and no-step controls. Product source head unchanged. |
|
🦞👀 Re-review progress:
|
|
Landed in 67ad5ac. Thanks @SunnyShu0925. Browser proxy uploads no longer fail after a clock jump. |
|
@obviyus Thanks! |
openclaw#185753) fix(browser): keep the node-host proxy deadline on the monotonic clock The browser node-host proxy deadline was measured with the wall clock, so a forward clock jump during a proxied browser upload made it fail early. The deadline now uses monotonic time. Evidence: a built Gateway with a paired node host and native Chromium, with Date.now jumped forward one hour in the node process only during staging. On main the upload failed early (twice); with this change it succeeded, confirmed by reading the file selection back from the DOM (twice). Backward steps keep the 400 ms timeout, and runs without a step succeed on both refs. Production 4 lines. Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]>
#185753) fix(browser): keep the node-host proxy deadline on the monotonic clock The browser node-host proxy deadline was measured with the wall clock, so a forward clock jump during a proxied browser upload made it fail early. The deadline now uses monotonic time. Evidence: a built Gateway with a paired node host and native Chromium, with Date.now jumped forward one hour in the node process only during staging. On main the upload failed early (twice); with this change it succeeded, confirmed by reading the file selection back from the DOM (twice). Backward steps keep the 400 ms timeout, and runs without a step succeed on both refs. Production 4 lines. Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 67ad5ac) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 8c4e2126269950ccd21cad66f8ebe3d049d6bea9)
#185753) fix(browser): keep the node-host proxy deadline on the monotonic clock The browser node-host proxy deadline was measured with the wall clock, so a forward clock jump during a proxied browser upload made it fail early. The deadline now uses monotonic time. Evidence: a built Gateway with a paired node host and native Chromium, with Date.now jumped forward one hour in the node process only during staging. On main the upload failed early (twice); with this change it succeeded, confirmed by reading the file selection back from the DOM (twice). Backward steps keep the 400 ms timeout, and runs without a step succeed on both refs. Production 4 lines. Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]> Beta.5 baseline adaptation: Retain the native beta.5 owners, fixtures and public contracts; add focused regression controls and bounded fixture extraction; apply checkout formatting. (cherry picked from commit 67ad5ac) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit a88e3d7ea90072dff2d975dfead1778c97ecfeea)
What Problem This Solves
A browser node running
openclaw node runfences a healthybrowser.proxyrequest withbrowser proxy timed outright after the node clock steps forward, and lets an already-expired request keep running for the length of a backward step. Each request gets a 20-second budget thatrunBrowserProxyCommandmeasured on the wall clock whilesetTimeoutconsumed it on the monotonic clock.deadlineAtis seeded withDate.now()and the dispatch budget isdeadlineAt - Date.now(), then handed towithTimeout, which arms a monotonicsetTimeout. Any step between the seed and the read resizes the budget.performance.now()).extensions/browser/src/node-host/invoke-browser.ts; two existing clock-sensitive tests repointed at the clock that now owns the budget; two regression tests (forward jump, rollback) during upload staging.withTimeoutrelative-duration contract, the 20-second default,resolveBrowserProxyTimeoutMs, the timeout message and diagnostics, staging/discard behavior, and the constant-duration status-probe and staging budgets.Why This Change Was Made
deadlineAtis process-local - created and read inside one call, never serialized or compared with another process's epoch - so monotonic time is the only correct source and no dual-clock bridge is needed. The module already seeds and readsperformance.now()for its ARIA capture deadline, so this follows the local pattern.withTimeoutstays a relative-duration consumer: it is shared by every timeout in the extension. Deliberately left alone:browser-proxy-upload.tsstill usesDate.now()for temp-file mtime staleness (file times are wall-clock), andwithTimeout's pause/resume accounting still usesDate.now(); a dispatch that pauses inwaitForBrowserStartupcan reach the latter, but that is pre-existing, shared by all extension timeouts, and a named follow-up.Risk is one behavior change: an in-flight request keeps the budget it was created with. No config, API, message, or persistence surface changes; production lines are +2/-2.
User Impact
Browser nodes no longer fail healthy proxy requests right after a clock correction, and no longer let an exhausted request keep running after a rollback. The default stays 20 seconds, the timeout still names method, path, profile and value, and a staged upload is still discarded when the deadline wins.
Evidence
Before/after on the same shipped entry point: a real Gateway plus a real browser node (
openclaw node run), invoked throughopenclaw nodes invoke. Every request stages a real 64 KiB upload and dispatchesPOST /hooks/file-chooserto a live Chromeinput[type=file]; the only injected part is the clock step - a proof-only preload that offsetsDate.nowonce, right after the staged file write, neverperformance.now, and logs the delayswithTimeoutarms.3be098d+ regressions)c8ea4b5)browser proxy timed out for POST /hooks/file-chooser after 5000ms; the step lands on the remaining-budget read (invoke-browser.ts:413){"result":{"ok":true}}; staging arm5000then dispatch arm4984(budget intact)changehandler blocks ~3 s{"result":{"ok":true}}after the 3 s handler; dispatch arm3601970(about a 1 h budget)browser proxy timed out ... after 2000ms;arm delay=1982,timer-fired delay=1982Unit runs, base tree with the regression tests applied, then this head:
Supporting checks on this head:
oxlinton both changed files reports 0 warnings and 0 errors,oxfmt --checkandgit diff --checkare clean, and CIopenclaw/ci-gatepassed. Collision check: no open PR changesextensions/browser/src/node-host/- open PRs matchingbrowser proxy,invoke-browserandnode-hostwere compared by changed files.Not covered: a local
tsgotypecheck (this checkout's sharednode_modulesguard rejects declaration inputs), which the CIcheck-prod-typesandcheck-test-typesjobs cover, and the Codex autoreview engine, whose provider returned HTTP 403 in this environment.Independent runtime verification
#185753 (comment) — real built Gateway, paired node host and native Chromium: +1h staging jumps fail on main twice but upload successfully on the candidate twice; rollback cases retain the 400ms candidate budget, and no-step controls succeed. Process-local Date.now simulation and external staging-write trigger are disclosed; no system clock changes.