Skip to content

feat(browser): sharper computer use for the desktop browser agent - #8283

Merged
waleedlatif1 merged 10 commits into
stagingfrom
feat/computer-use-hillclimb
Sep 25, 2026
Merged

waleedlatif1 merged 10 commits into
stagingfrom
feat/computer-use-hillclimb

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Chord shortcuts (Ctrl+A, Cmd+Shift+K, …) press the modifiers as real key-down/key-up events with cumulative flags, so pages listening for the modifier keys themselves see them; bare modifiers report their own flag
  • browser_click accepts holdMs (0–10,000 ms, single click only) for press-and-hold controls; batches refuse holds so they can't outlast the batch watchdog
  • Snapshots read disablePortal modals whose app root is aria-hidden: the open modal is exempt from the hidden-ancestor walk
  • Agent downloads get a synchronous staging save path, so Electron never falls back to a native Save dialog; the file moves to its final name on completion and staging files are cleaned up on failure
  • Snapshot lines for elements that appeared since the previous snapshot are marked new, so the agent can see what an action changed without diffing
  • Page functions share one serializePageCall + installPageHelpers path for the driver and tests

Type of Change

  • Bug fix
  • New feature

Testing

  • A/B against staging on gemini-3.8-flash, fresh seeds, full suites (paired, exact McNemar):
    • REAL clones: 68 → 86 / 121 (p = 0.0003; 21 fixed, 3 lost)
    • WebGames: 79 → 83 / 104 (p = 0.22; fixes press-and-hold and key-combo tasks)
    • Capability bench: 55 → 56 / 56
    • On tasks both sides solved: 10–17% fewer rounds and 10–18% fewer input tokens
  • 866 desktop tests pass; lint, block registry, check:audits, and docs manifest all pass

Companion: simstudioai/mothership#524

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

A chord such as Control+Shift+Y was sent as one key-down with a modifier
bitmask, so pages that track held keys never saw Control or Shift go down.
Modifiers are now pressed in order before the main key and released in
reverse, as a physical keyboard delivers them, and a bare modifier key can be
pressed on its own.
Clicks released the button immediately, so press-and-hold controls could not
be operated. A click now accepts holdMs (0 to 10000, single clicks only) and
keeps the button down that long before release.
MUI hides every <body> child except a modal's mount node; a disablePortal
modal mounts inside the app root it just hid, so every node had an aria-hidden
ancestor and the snapshot came back empty while the dialog was on screen.
Visibility checks now skip aria-hidden only on ancestors above the single
topmost modal hidden that way; portaled modals and other hidden regions are
unchanged.
…pens a Save dialog

The save path was set only after an asynchronous non-conflicting-name lookup.
When Electron's own path step won that race it opened a native Save dialog, so
an agent download stalled forever at full size (and a user would see a
surprise dialog). Downloads now write to a hidden staging file set during
will-download and are renamed to the allocated name when they complete.
…s snapshot

After an action the agent saw a fresh snapshot but no hint of what changed, so
a popup, suggestion list, or validation message looked like any other line.
The page now remembers which elements an earlier snapshot of the document
listed, and later snapshots mark the rest new (the first snapshot marks
nothing).
- Modifier aliases (Ctrl, Cmd, Command, Option) share one descriptor with their
  canonical key, so a bare alias sets its own flag; a bare modifier's key-up
  reports it released.
- The framed-control fallback no longer treats a held click as a plain click,
  and a batch refuses press-and-hold so eight holds cannot outlast its watchdog.
- installPageHelpers caches the modal lookup per invocation, and one
  serializePageCall builds the page expression for the driver and the tests.
- Download completion drops a branch whose state was never published.
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 25, 2026 1:43am UTC

Request Review

@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Sep 25, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • ❌ simstudioai/mothership#524 — OPEN, not merged (targets staging) — feat(browser): sharper computer use for the browser agent

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/cdp.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/keyboard.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/session.ts
Comment thread apps/desktop/src/main/browser-agent/page-functions.ts Outdated
@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds press-and-hold capability to browser click actions.

The PR appears safe to merge; this re-review found no new findings to report.

Summary

This PR improves desktop browser-agent keyboard chords, press-and-hold clicks, modal visibility, snapshot change markers, and staged downloads.

  • Browser input now sends individual modifier events and supports cancellable holds.
  • Downloads use a staging path and claim their final filename before completion.
  • Page functions share a serialized helper installer.

Reviews (6) · Last reviewed commit: "fix(browser): close cancellation and tea..."

Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/cdp.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/page-functions.ts
Comment thread apps/desktop/src/main/browser-agent/page-functions.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/session.ts
…changes

- A held right-click renews its agent context-menu marker before release, so
  Windows' release-time menu stays suppressed after a hold over one second.
- A failed chord releases only the keys whose press was attempted.
- A disk probe that resolves after a download completed can no longer cancel it.
- A disablePortal modal nested inside another open modal is picked as topmost.
- holdMs is an integer bounded to 0-10000 in the tool contract.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 13 files

Confidence score: 5/5

  • In apps/desktop/src/main/browser-agent/page-functions.ts, standalone headings and landmarks can bypass the marker, so newly rendered sections may not be identified as new; apply the marker and record those elements in their emission paths.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/main/browser-agent/page-functions.ts">

<violation number="1" location="apps/desktop/src/main/browser-agent/page-functions.ts:581">
P3: Standalone heading and landmark lines bypass this marker, so newly rendered headings or sections are not identified as new. Apply the marker and record those elements in their emission paths too.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/page-functions.ts
- An aborted press-and-hold rejects and releases the button at once instead of
  staying held into the next action.
- The disablePortal exemption applies only when a <body> child hides the modal
  (MUI's mechanism), so a dialog the app hid itself stays hidden, and it is
  looked up per document so same-origin iframes get it too.
- A completed download's move retries transient EBUSY/EPERM/EACCES errors, as
  Chromium's own final rename does, instead of discarding the file.
- Keyboard docs describe the separate modifier presses; the partial-release
  test covers a failure at the first modifier.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/desktop/src/main/browser-agent/session.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files

Requires human review: Auto-approval blocked because this review re-detected 2 unresolved issues already reported by Cubic.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/cdp.ts
Comment thread apps/desktop/src/main/browser-agent/driver.ts
Comment thread apps/desktop/src/main/browser-agent/page-functions.ts
The allocated destination gets an empty placeholder created with O_EXCL, as
Firefox does, so another program picking a name sees it taken and the final
rename only ever replaces Sim's own placeholder. A name that something else
grabbed first stops the download instead of being overwritten. Teardown and
failures remove the placeholder once, so a late-settling download cannot delete
a name a newer download has claimed.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
Comment thread apps/desktop/src/main/browser-agent/session.ts Outdated
…loads

- An already-aborted click presses nothing, and a held click marks its outcome
  pending before dispatch, so cancelling mid-hold reports an unknown outcome
  with doNotRetry instead of an error that invites a retry.
- The disablePortal exemption resets when a visibility walk crosses from an
  iframe into its host page, where the host's own aria-hidden applies.
- Teardown keeps a download's name reserved until its placeholder claim
  settles, so a newer download cannot be handed a name the claim then takes.
- Downloads are paused before the staging path is set, as on staging, so a
  pause failure leaves no staging file behind.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 40f4a8e into staging Sep 25, 2026
28 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/computer-use-hillclimb branch September 25, 2026 01:49
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — ae8cb3c1 Deployed Sep 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant