Repository navigation
fix(browser): keep the action navigation grace on the monotonic clock - #186885
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 uses monotonic time to preserve the browser action’s 250 ms navigation interception grace across wall-clock corrections. Example: After clicking Continue, the Gateway clock advances by 1000 ms and the page attempts navigation to blocked denied.test within 250 ms.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR narrowly fixes a navigation-policy timing defect still present on current main, with convincing real-browser proof and no actionable findings; hosted CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe browser plugin’s shared interaction owner wraps Playwright actions with document-request interception, post-action observation, and final URL validation before returning success or a policy error. flowchart LR
A[Browser CLI action] --> B[Shared interaction owner]
B --> C[Playwright action]
C --> D[Monotonic navigation grace]
D --> E[Document request policy]
E --> F[Allowed network request]
E --> G[Blocked request and preserved source]
Technical reviewBest possible solution: Merge the focused two-read clock correction and retained regression once the existing exact-head CI gate passes. Do we have a high-confidence way to reproduce the issue? The collaborator’s real Gateway/Chromium receipt reproduces premature guard release on frozen main, and source comparison confirms the same responsible code remains on fetched main; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete fix: both elapsed-time readings use the same monotonic clock in the existing owner, preserving the intended grace without adding state, wrappers, options, or competing paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9b8aa392679f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests -3. Total -3 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (3 earlier review cycles)
Reviewed November 8, 2026, 1:52 AM ET / 06:52 UTC (Revision 4). |
37b23ff to
d323d9e
Compare
|
🦞👀 Re-review progress:
|
d323d9e to
a54436e
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Maintainer built Gateway + real Chromium clock proofFrozen main Both snapshots received frozen installs and full Every Gateway had its own profile, config, HOME, state/database and managed browser data. The same binary printed its resolved config and database paths before launch, all inside that case's Page and clock controlA real loopback HTTP page has a Continue link to The only shifted clock is Date.now in the Gateway process executing the interaction, by +1000 ms immediately after the actual raw-action grace seed is read. A preload recognizes the real compiled callsite ( Each fresh Gateway first runs an otherwise identical zero-step control, then the forward-step case. The page really attempts its delayed navigation within the intended 250 ms grace in every measured run. No routes, guard decisions, CDP methods or network errors are mocked. Observed results — main twice, candidate twiceTimes below are from the observed raw-action seed using the same Linux monotonic clock. CLI-return time includes transport and process cleanup; it is not presented as the exact internal sleep duration.
Candidate's attempted navigations were at 125.34 / 127.21 ms after the seed, after the logged wall step and inside the real grace. Thus absence of network I/O is paired with actual navigation intent and the policy-denial receipt, not an inactive page. No-clock-step controls, twice per variant: all four clicks report the same existing Initial control-only setup probes matched a source-map location instead of the emitted Focused native Node suite: 24/24 passed, with no unhandled errors on the candidate. Reverting only the navigation owner to exact main gives 1 failed / 23 passed: the guard-settled assertion fires before the intended grace (the deliberately broken baseline also produces the expected secondary promise rejection from its premature final-URL check). Oxfmt and scoped typed Oxlint passed, with zero lint warnings/errors. Final merge-base deltas remain contributor-sized: production +2/-2 (net 0); tests +26/-29 (net -3). No allocation file, new dependency, schema/auth/policy-order change, or new model-facing text. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in eb269c0. Thanks @SunnyShu0925. Browser navigation grace now uses a monotonic clock. |
…openclaw#186885) fix(browser): keep navigation grace on the monotonic clock The browser navigation guard measured its 250 ms grace window with Date.now(). If the wall clock stepped forward, the guard settled early and let requests through that it should have blocked. The window now uses performance.now(). Evidence: rebuilt Gateway and browser CLI with managed Chromium. With the Gateway's process-local Date.now stepped forward by 1000 ms, main returned after 41 to 44 ms and allowed denied requests at 131 and 199 ms, inside the grace window. With this change both requests are blocked and /first is kept. Two runs each, four no-step controls are equivalent, and the system and browser clocks were not changed. Details: openclaw#186885 (comment). Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A forward wall-clock correction can collapse the browser action's intended 250 ms navigation grace. The raw-action settlement timestamp and subsequent elapsed calculation use Date.now, while the wait itself is a monotonic timer. A step between those reads overstates elapsed time and releases request interception early, letting a delayed document request inside the grace escape the existing navigation policy.
Use performance.now() for both process-local elapsed-time readings. The timestamp is never persisted or exchanged. The grace constant, native sleep, policy order, authority checks, public API and error text remain unchanged. This follows the extension clock rule without importing a core clock helper.
Preserves @SunnyShu0925's contributor commit
a54436ee78da72caaaf5ca541ecf8d72f92d6c7f. Main was checked: the navigation owner has no upstream drift since the contributor's parent and still has the defect. The stale branch was merged with current main before proof. Production +2/-2 (net 0); existing regression tests +26/-29 (net -3). No allocation file.Evidence
Maintainer built Gateway + real Chromium + process-local clock receipt.
Frozen main
53f6c216645bb56f3a30e568f9fa09d52fac70e8, secretless Linux Node 24.22.1 Docker. Both versions received frozen installs and fullpnpm build(declarations only skipped). Actual shipped Gateway/browser-plugin and browser CLI commands drove a managed headless Chromium 156.0.8078.79, not private helpers. Every Gateway's resolved config and database path was checked inside its task-owned profile/state tree.A real page's Continue link navigates to an allowed
/firstpage. It then schedules a delayed navigation to reserved syntheticdenied.test, mapped by Chromium back to the same local fixture server. Existing strict policy allows127.0.0.1and explicitly blocksdenied.test. The server records actual denied-host network requests.Each fresh Gateway runs a zero-step control followed by one +1000 ms process-local Date.now step immediately after the actual compiled raw-action grace seed. A pass-through observer records performance.now calls but returns their original native values unchanged. Native timers, Chromium/client/fixture clocks and the system clock are not shifted or frozen.
/firstCandidate CLI returns after the full minimum grace (398.39 / 308.74 ms, including transport/process cleanup, not claimed as exact internal sleep time). No-step controls, twice per version, are equivalent: existing policy-blocked error, zero denied network requests, preserved
/firstsource, return after the minimum grace.Focused native Node suite: 24/24 passed, no unhandled candidate errors. The existing fake-timer regression checks the guard remains installed at 249 ms and settles at 250 ms despite a wall-clock jump. Exact-main owner revert gives 1 failed / 23 passed on premature guard settlement (with a secondary rejection from its too-early final-URL check). Scoped typed Oxlint (zero warnings/errors) and Oxfmt passed. Fresh exact-head ClawSweeper and hosted CI are the final gates.
Merge Risk / Blast Radius
Two clock reads in the shared browser interaction-navigation owner. No guard duration, SSRF decision/order, configuration/schema, auth, retry/deadline policy, stored data, dependency, new model-facing text, or Control UI asset change. Proof uses only an owned local page and reserved synthetic blocked host; no real external/private destination or live browser profile.