Skip to content

fix(browser): keep the action navigation grace on the monotonic clock - #186885

Merged
obviyus merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/browser-interaction-navigation-grace-elapsed-wall-clock-254
Nov 8, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/browser-interaction-navigation-grace-elapsed-wall-clock-254

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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 full pnpm 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 /first page. It then schedules a delayed navigation to reserved synthetic denied.test, mapped by Chromium back to the same local fixture server. Existing strict policy allows 127.0.0.1 and explicitly blocks denied.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.

Real click / forward step Main, twice Candidate, twice
Click result Incorrect success (exit 0), returns 44.49 / 40.93 ms after seed Existing policy-blocked error (exit 1); source remains /first
Denied document reaches network inside 250 ms Yes: 131.46 / 198.52 ms after seed No: 0 requests
Actual delayed navigation intent Inside the grace 125.34 / 127.21 ms after seed, after the logged wall step

Candidate 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 /first source, 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.

@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Interception ends early, the click reports success, and the denied document request reaches the server.
  • After: Interception remains active, the request is blocked, and the source page remains usable.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal contract-restoring repair with shipped-entry-point proof, a reported red/green regression, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Obviyus’s linked receipt exercises the compiled navigation owner through the shipped Gateway and browser CLI with real Chromium in isolated Linux Docker: a process-local wall-clock step permits denied-host network I/O on main, while the candidate blocks actual delayed navigation attempts and preserves the source; no-step controls behave equivalently.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A clock correction can let a page’s delayed navigation reach a policy-denied destination while the browser action incorrectly reports success.
Reason: The change restores the previously documented 250 ms interception contract, and the current collaborator proof demonstrates its practical effect.

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
Reviewed head: 82f340ad7b9cf66b0e8fa689abda804d5776fa87

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • LLagoon3: Raw commit c3aeedf adds extensions/browser/src/browser/pw-tools-core.interactions.navigation.ts:493 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: c3aeedf0b4ed; files: extensions/browser/src/browser/pw-tools-core.interactions.navigation.ts)

PR surface

Source 0, Tests -3. Total -3 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 1 26 29 -3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 28 31 -3

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A forward wall-clock correction can prematurely release the existing navigation guard; the trigger is narrow and the repair preserves the established policy.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-28T16:25:08.450Z sha 37b23ff05bd843176503cf2747b25c26c50fd02f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-28T17:53:01.788Z sha d323d9e5a7f9de29d760adbefcf1e16080602785 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-29T09:47:29.310Z sha a54436e :: needs maintainer review before merge. :: none

Reviewed November 8, 2026, 1:52 AM ET / 06:52 UTC (Revision 4).

@SunnyShu0925
SunnyShu0925 force-pushed the fix/browser-interaction-navigation-grace-elapsed-wall-clock-254 branch from 37b23ff to d323d9e Compare October 28, 2026 17:47
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 28, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/browser-interaction-navigation-grace-elapsed-wall-clock-254 branch from d323d9e to a54436e Compare October 28, 2026 18:12
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 29, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 29, 2026
@roboclaw-bot roboclaw-bot added the clawtributors PR from a clawtributor label Nov 5, 2026
@obviyus

obviyus commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Maintainer built Gateway + real Chromium clock proof

Frozen main 53f6c216645bb56f3a30e568f9fa09d52fac70e8, contributor a54436ee78da72caaaf5ca541ecf8d72f92d6c7f retained. The navigation owner has no upstream changes since the contributor's parent (git log <parent>..origin/main -- <owner> and the corresponding diff are empty). The old PR was nevertheless integrated with current main as requested; the production delta remains only the two clock reads.

Both snapshots received frozen installs and full pnpm build (only declaration generation skipped) inside secretless Linux Node 24.22.1 Docker. Browser: real managed headless Chromium 156.0.8078.79. The shipped openclaw.mjs gateway run loaded the browser plugin; the shipped openclaw.mjs browser CLI performed start/open/snapshot/click/tabs/close/stop. No private navigation helper was called as the proof.

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 /task-state/186885/ tree. Gateway used loopback/token auth with a synthetic token. No host browser or real credentials were mounted.

Page and clock control

A real loopback HTTP page has a Continue link to /first. That allowed page schedules a navigation after 120 ms, recording a same-origin /attempt first, then navigating to http://denied.test:<fixture-port>/denied. Chromium's host-resolver rule maps that reserved synthetic host back to the same fixture server, so a policy escape produces actual network I/O with Host: denied.test. Existing policy is strict: allowedHostnames ["127.0.0.1"], blockedHostnames ["denied.test"].

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 (dist/pw-tools-core.interactions.navigation-*.mjs:3157, corresponding to source line 506). Its performance.now observer returns the original native reading unchanged; it never advances, freezes or substitutes monotonic values. Native timers, Chromium, CLI/fixture processes and the system clock are unchanged. The same controller runs on both versions, logging the +1000 ms Date.now change, whether the owner seed used Date.now or performance.now, and monotonic event timestamps.

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 twice

Times 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.

Variant / repeat Wall step CLI click result Seed → CLI return Real denied document request
main / 1 +1000 ms success (exit 0) 44.49 ms Reached network at 131.46 ms, inside 250 ms
main / 2 +1000 ms success (exit 0) 40.93 ms Reached network at 198.52 ms, inside 250 ms
candidate / 1 +1000 ms existing policy-blocked error (exit 1) 398.39 ms 0 requests; source remains /first
candidate / 2 +1000 ms existing policy-blocked error (exit 1) 308.74 ms 0 requests; source remains /first

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 browser navigation blocked by policy error, no denied request reaches the network, and each source stays on /first. CLI return is after the full minimum grace (main 306.58 / 345.03 ms; candidate 416.84 / 432.70 ms, including transport/cleanup).

Initial control-only setup probes matched a source-map location instead of the emitted .mjs callsite and recorded no clock step; they are excluded from the measured matrix. The completed proof uses the actual compiled seed frame on both versions. There was no system-clock change, fake browser, injected guard failure, or real external blocked host.

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.

@obviyus

obviyus commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@obviyus
obviyus merged commit eb269c0 into openclaw:main Nov 8, 2026
102 of 103 checks passed
@obviyus

obviyus commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Landed in eb269c0. Thanks @SunnyShu0925. Browser navigation grace now uses a monotonic clock.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawtributors PR from a clawtributor extensions: browser P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants