Skip to content

fix(browser): keep the download drain quiet window on the monotonic clock - #186850

Merged
obviyus merged 3 commits into
openclaw:mainfrom
SunnyShu0925:fix/browser-download-drain-quiet-window-monotonic
Oct 29, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
SunnyShu0925:fix/browser-download-drain-quiet-window-monotonic

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A wall-clock correction during browser action download collection can end its 250 ms quiet window early and omit sibling downloads from the action result.

What Changed

  • Use performance.now() directly for both the download event timestamp and elapsed-time calculation. No local clock helper or plugin SDK export.
  • Consolidate clock-step coverage into the existing sibling/slow-save ownership test, retaining the assertion that unrelated later downloads do not join the action. Fake performance wherever the affected tests fake Date. Net test-count growth: zero.

Thanks to @SunnyShu0925 for the report and original fix; their commits are preserved.

Evidence

Built Gateway / real Chromium browser HTTP bridge evidence. The targeted process-local clock probe logs the timestamp write, a +10-second Date.now step, and the subsequent elapsed-time read. No system-clock changes.

Focused browser session suite: 27/27 passed in the isolated container. Formatting check passed for all four changed browser files. Production delta against merge base: +3/-2 including the timestamp comment; test lines +9/-6, test count +0.

Merge Danger

Two-way door: reverting fully restores the previous timing behavior. No persisted state, configuration, schema, permissions, or public API changes. Blast radius is the quiet-window collection of sibling downloads started by browser actions.

@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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 timestamps to preserve the browser action download collection window across wall-clock corrections.

Example: Date.now jumps forward 10 seconds while first.txt is saving and second.txt starts within the 250 ms quiet window.

  • Before: The action reports only first.txt.
  • After: The action reports first.txt and second.txt.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, correct owner-level repair with meaningful regression coverage and controlled shipped-entry-point proof.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The corrected evidence from obviyus exercises a built Gateway, its browser HTTP bridge, real Chromium, and managed file saves: a process-local +10-second Date.now step causes main to omit second.txt while the candidate retains both downloads, with matching no-step controls.
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 successful browser action can omit a sibling downloaded file from its result after a wall-clock correction.
Reason: The demonstrated reporting failure has a narrow repair that preserves the existing product contract without adding configuration or public API.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR narrowly fixes a demonstrated download-reporting bug still present on current main, with no actionable findings; exact-head CI remains pending.

Priority: P2
Reviewed head: 929508e4877c6eac34f82be1a5eb36e794aedbbb

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Shipped-entry-point before/after proof is supplied; a separate red-on-base execution of the consolidated unit regression is not recorded.
Agent review details

How this fits together

The browser plugin observes Playwright download events, saves files under managed paths, and returns action-scoped download metadata through the browser HTTP bridge.

flowchart LR
  A[Browser action] --> B[Playwright page]
  B --> C[Download event owner]
  C --> D[Managed file save]
  C --> E[Monotonic quiet window]
  D --> F[Action download metadata]
  E --> F
Loading

Technical review

Best possible solution:

Keep both quiet-window readings on performance.now within the existing capture owner and land after the required exact-head checks pass.

Do we have a high-confidence way to reproduce the issue?

The supplied corrected Gateway/Chromium reproduction demonstrates the failure and successful repair with clock-step and no-step controls; current-main source retains the responsible wall-clock calculation.

Is this the best way to solve the issue?

This is the smallest complete fix: replace the timestamp producer and elapsed-time reader together, preserving the existing owner, timing limits, and save lifecycle.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c4f34cb7bb71.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 73ad32e adds extensions/browser/src/browser/pw-session-downloads.ts:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 73ad32e20a48; files: extensions/browser/src/browser/pw-session-downloads.ts)

PR surface

Source +1, Tests +3. Total +4 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 3 2 +1
Tests 1 9 6 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 12 8 +4

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A clock correction can omit sibling downloads from a browser action result, with impact limited to the collection window.
  • 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-28T15:29:24.383Z sha f401e43d6d9a02c29dc26f672402c22199ac6911 :: needs real behavior proof before merge. :: [P3] Control elapsed time in the clock-jump regression
  • reviewed 2026-10-28T16:32:17.000Z sha c124cf9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-29T02:13:35.226Z sha c124cf9 :: needs maintainer review before merge. :: none

Reviewed October 28, 2026, 11:38 PM ET / October 29, 2026, 03:38 UTC (Revision 4).

…lock

Ref: BUG-228-browser-action-download-drain-deadline-wall-clock (local finding)
@SunnyShu0925
SunnyShu0925 force-pushed the fix/browser-download-drain-quiet-window-monotonic branch from f401e43 to c124cf9 Compare October 28, 2026 16:26
@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. 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 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 rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 29, 2026
@obviyus

obviyus commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Corrected runtime reproduction — supersedes NO-REPRO

The initial fallback-timer run did not exercise the bug. The final probe observes the actual compiled download timestamp assignment, logs its clock reading, then steps only the Gateway process's Date.now by +10,000 ms in a microtask before the drain's elapsed-time read. There is no fallback timer and the system clock is unchanged.

Built Gateway, Gateway-owned browser HTTP bridge, real Chromium 156.0.8078.47, and real downloads saved under managed paths. The page starts first.txt 100 ms after the click; the fixture releases the second download 20 ms after observing the first quiet-window elapsed-time read. This keeps the sibling inside the quiet window instead of depending on a drifting page timer. The step runs after the first download event timestamp while its managed save is pending. No production source or built artifact is patched by the harness.

Final observed results:

main step run 1:
  timestamp write Date.now=1793244690288; offset=0
  step realWallMs=1793244690288; offset=10000
  elapsed read Date.now=1793244700416; realWallMs=1793244690416
  real elapsed=128 ms (inside 250 ms window)
  downloads=[first.txt] — sibling incorrectly omitted
main step run 2:
  timestamp write Date.now=1793244708115; offset=0
  step realWallMs=1793244708115; offset=10000
  elapsed read Date.now=1793244718256; realWallMs=1793244708256
  real elapsed=141 ms (inside 250 ms window)
  downloads=[first.txt] — sibling incorrectly omitted
candidate step run 1:
  timestamp performance.now=6436.752801
  process-local Date.now offset=10000
  elapsed read performance.now=6587.528331
  downloads=[first.txt,second.txt]
candidate step run 2:
  timestamp performance.now=7090.192796
  process-local Date.now offset=10000
  elapsed read performance.now=7241.681788
  downloads=[first.txt,second.txt]
main no-step control: [first.txt,second.txt]
candidate no-step control: [first.txt,second.txt]

The contributor's fix uses performance.now() directly at both ends, without a local helper or SDK export. The existing slow-save ownership test now also covers the clock step and sibling download, replacing the separate regression: net test-count growth is zero. It retains the assertion that unrelated later downloads do not join the original action.

Focused verification in the isolated container: browser session suite 27/27 passed. Oxfmt check passed for all four changed browser files. Whole-PR delta against merge base: production +3/-2 (including the monotonic timestamp comment); tests +9/-6, test count +0.

This targeted reproduction supersedes the initial NO-REPRO conclusion. Thanks to @SunnyShu0925 for the report and original fix; their commits are preserved. No merge performed.

@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@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. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@obviyus
obviyus merged commit 12c6ec4 into openclaw:main Oct 29, 2026
116 of 117 checks passed
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Landed in 12c6ec4. Thanks @SunnyShu0925. Browser downloads are no longer missed when the wall clock jumps.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
…lock (openclaw#186850)

fix(browser): keep the download quiet window on the monotonic clock

The browser plugin measured the download quiet window with Date.now, so a forward wall-clock step while a download was in progress ended the window early and a following download was missed. The window now uses performance.now(), as the other extension budgets do since openclaw#186484.

Evidence: built Gateway with real Chromium over the browser HTTP bridge. A process-local +10 s Date.now step was placed between the window's timestamp write and its elapsed-time read, and logs confirm the order. Main missed the second download (twice); with this change both files were captured (twice). No-step controls captured both on each ref, and the system clock was not touched. Details: openclaw#186850 (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

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: XS 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.

2 participants