Skip to content

#626: on macOS, the tabs a session creates open in a Chrome window of cua's own (normal size, placed by Chrome; extension 0.4.0; cua 0.31.6) - #645

Merged
SSFSKIM merged 24 commits into
mainfrom
626
Dec 1, 2026

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Closes #626
Refs #610

What changes

On macOS, the tabs an agent session creates now open in a Chrome window of cua's own, in the person's profile, instead of in the background of the person's window (owner's ruling 1314). It ships at normal size, placed as Chrome places any new window (ruling 1380).

  • Once per session. cua opens the window when the session first creates a tab, or takes a popup, and closes it with the session's last tab. Later tabs open in the same window.
  • Where Chrome puts it, at normal size. The window opens where Chrome places, and at the size it gives, any new window: no bounds are asked.
    • On a real Mac (the owner's MacBook, 2026-11-30), a normal-size unfocused window from a background Chrome opened at the back, behind the person's work, without the focus, and Chrome reported it visible (the real-Mac look, below).
    • When the person's own Chrome is the front app, where the window opens is unmeasured, and it may come up in front.
    • A half-off-screen corner panel was tried and withdrawn (rulings 1340, 1345). Chrome refuses bounds less than half on a display and keeps the window it creates on screen. Its smallest window, 500x375, broke parity's drag cells.
    • Bounds asked for also did not decide where the window landed in the stacking order.
  • No focus taken. The window opens with focused: false on the session's own tab (windows.create {url} returns that tab, so no placeholder tab is made or removed). Driving another tab of the session's selects it within cua's window only, and neither focuses nor raises the window.
  • Speed, as the hosted runs measured it. While any part of the window shows, the agent's tab answers in about 1.7 ms a command under load. Once the window has shown and is then fully covered, as by a full-screen or zoomed app, or minimized, the tab is as slow as a background tab, about 120 ms. The window born behind the person's work on the real Mac was reported visible, but its speed was not measured there.

The details:

  • The driven tab is the session's created tab in cua's window that last received attach or executeCdp. The host asks the extension's new tabs.activate to select it when Chrome hasn't reported it as the window's active tab.
    • tabs.activate selects by window and index (chrome.tabs.highlight), never by tab id.
    • Chrome's tabs.onActivated is relayed to the host, which counts the reports per window. An activation's reply counts only if no newer report came after the request, so a selection the person makes wins.
  • Closing: the window closes with its last tab while its session lives. The New Tab page that keeps a window open (Ending a session can close the user's Chrome window and kill the profile's extension host: no last-tab guard when closing agent tabs #148) is added only when cua's window is the profile's last window with a tab.
    • Once the session's client is gone, or while a window is being handed to the person, it is the person's: no reuse, no activation, the protective New Tab page again.
    • The handback: before the window becomes the person's, the host sends the extension the new windows.release and waits for its answer. tabs.activate checks the release in the same step that selects, so an activation already on its way when the session leaves selects nothing there. The host waits at most 1 s (the activation's own bound). If the extension doesn't answer, the handback completes anyway and is logged; the extension's check still guards, and an extension that isn't answering selects nothing.
    • A tab of the person's in cua's window keeps the window open.
    • A tab of cua's that the person drags into their own window stays there and is never made active in it.
    • A tab that lands in a window just handed to the person stays there, the session's and inactive. That is the placement without this change.
  • Untouched: the person's windows and the tabs cua claims get no placement request. The service's preferredWindowId, which names one of the person's windows, is not used for created tabs.
  • macOS only. Linux keeps today's placement, because a CDP press raises the window it lands in there (Linux: a CDP click in a tab whose window the person isn't using raises that window and takes their focus (Chrome's own behaviour; parity with the vendor's route) #622).
    • A MAWS peer keeps its own placement, and so does any extension before 0.4.0, which the host tells by the hello's version.
    • Their requests are dispatched exactly as on main.

The extension goes to 0.4.0:

  • tabs.activate {tabId, windowId};
  • windows.release {windowId}: the window is the person's from now on;
  • windows.create takes url, group and guard, and returns the window's first tab;
  • the tabs.activated notification.

Its permissions are unchanged.

Limits

Measured on GitHub's hosted macOS runner

The setup:

  • Chrome for Testing 158.0.8127.36, cua's real host, the extension loaded unpacked;
  • one CPU burner per core;
  • from branch 626-macos-probe, which is not merged; evidence in docs/evidence/2026-11-29-own-window-626/.

Results:

  • A tab driven in cua's window, while it shows: 1.08 to 2.2 ms median, 0 commands at 250 ms or more, in every run. A background tab of the person's in the same runs: 107 to 140 ms, up to 13 s.
  • Fully covered or minimized: 109 to 125 ms median, 4.5 to 18% at 250 ms or more.
  • The person's state when cua's window opens: the frontmost app, Chrome's focused window, every other window's bounds, state and order, and the person's focus all stayed unchanged, across all runs.
  • Where the window landed: the runner's window list mostly put cua's new window first, but the screenshots of 46410016977 never showed it over the front window. The real Mac's list and screenshots agree (below).
  • Switching the driven tab made it the active tab of cua's window and changed nothing else.
  • Closing: the window closes with the session's last tab, and a tab of the person's in it keeps it open.
  • The withdrawn corner panel: 46399440730, 46402846688.

Not shown live:

The real-Mac look (owner's MacBook, 2026-11-30, ruling 1349)

The kit is commit 28ddbd7 on branch 626-look-kit; it is not merged.

The result:

  • Focus: the person's Google Chrome stayed the front app throughout, and nothing took the focus.
  • Where: both windows opened at the very back, behind all 11 of the person's on-screen windows, and stayed there at +1 s and +5 s. They were Chrome's cascade with no bounds given, 1200x855.
  • Screenshots: they agree with the window list. They show the person's Chrome unchanged and no Chrome for Testing window, only its Dock icon. They stay on the owner's Mac.
  • Visibility: Chrome reported both pages visible the whole time, though both windows were fully covered.

Not covered:

The redacted record and the caveats are in the evidence README's "Real-Mac look (2026-11-30)".

Unresolved Review Findings

The final check on 53c0e81 found no P1. Its P2, the release wait counting against the 2 s keep-open deadline when cua's window is the profile's last, is fixed (ruling 1354): the release and the protective New Tab page are sent together, and the release is still waited for. Its P3 is left under ruling 1350: it cannot touch the person's windows, tabs, selection or focus, and gives no false result. It is logged in tech-debt-tracker.md.

  • P3, the released set never shrinks (extension/background.js L323–325). It keeps every released window id for the worker's lifetime, one per session that handed back a window. Fix: track the windows still eligible for activation instead, and drop them on release or closure.

Which installs get this at merge

  • The extension loaded unpacked from a checkout: gets it once the checkout is updated and the extension is reloaded on chrome://extensions.
  • The Chrome Web Store install: gets it only after the owner publishes 0.4.0 to the Store (the npm run extension:pack zip). Until then it stays on 0.3.0 and today's placement.
  • A Linux VM's force-installed extension: stays at 0.3.0 until the owner next packs the self-hosted CRX. This change doesn't need it there, since it is macOS only.

Nothing was packed or signed in this pull request.

Validation Evidence

  • ci-gate GREEN on the head c989abe, which has main 51e3f8a merged in: plugin, test-1, test-2 and parity-browser. Run: https://github.com/SSFSKIM/cua/actions/runs/46575245163. Earlier heads 0aa2825 (46417166471) and f43477e (46428459579) also passed.
  • Tests: own-window 27 of 27. The host, extension and browser-service suites ran 692 tests with none failing. The full npm test fails exactly main's 54 tests on the Linux VM, and nothing new. Every new test failed before its fix. Deleting the extension's release check makes the P1 reproduction fail again.
  • Hosted macOS proofs are in "Measured on GitHub's hosted macOS runner" above. The real-Mac look is in its own section above.

Also

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

…cua's own (ruling 1314); extension 0.4.0 adds tabs.activate

The host opens the window unfocused at the session's first created tab, which
replaces its New Tab page; the created tab in it that last took attach or
executeCdp is made its active tab (tabs.activate, once per change). It closes
with its last tab unless it is the profile's last window; a tab of the
person's keeps it open. Linux, an extension before 0.4.0 and a MAWS peer keep
today's placement.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…wn-extension design records tabs.activate and the window of cua's own; a claimed tab in cua's window is never activated (test)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… hosted-macos.sh, the window tools, #610's pin)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…, closed with its last tab; the New Tab page rule and 'never opens a window' say so

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…e strip, reads floating windows (the cover), keeps cua's window minimized before the close, and checks whether cua's window opens behind the one in front

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… cua's window's last 60 points (Target.activateTarget does not reorder Chrome's windows on the hosted runner)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…44543495): their rows, the probe's lines, and the README's tables

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
# Conflicts:
#	.claude-plugin/marketplace.json
#	.claude-plugin/plugin.json
…0.4.0 (the real host is the machine's, and test-2 runs on a Mac); a macOS-only test drives cua's own window through the real host and extension

ci-gate run 46362733420 failed test-2 on these three: on the hosted Mac the spawned host saw
the checkout's extension at 0.4.0 and opened a window of its own. Checked here with the host
forced to darwin: 14/14.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…eaving that showed it

P1 placeholder removal: windows.create {url} opens cua's window on the session's first
tab and answers its id (extension), so no New Tab page is made, read or removed, and no
tab is judged cua's by a later look at the window.
P1 activation: tabs.activate selects by window and index (chrome.tabs.highlight) and
answers whether the tab is active after it; a drag landing between the read and the
selection can only select another tab of cua's window (Chromium 158 tabs_api.cc,
TabListBridge::HighlightTabs: no window activation).
P2 close exemption: given up when the session's client goes, after its closes.
P2 reuse vs teardown: the reuse runs where the window checks run (windowsExclusive); a
tab that still lands in a window just handed to the person is closed (cua's own) and
made again in a fresh window of cua's; a window that closed meanwhile gets a fresh one.
P2 stale cache: Chrome's tabs.onActivated is relayed (tabs.activated); only Chrome's
answer or that event marks a tab active; an activation in flight is joined.
P2 unbounded first activation: none any more (a window's only tab is its active one).
P2 failed first create: one primitive makes the window and its tab, nothing to undo.
P2 MAWS dispatch: a request with nothing to activate is dispatched synchronously, as on
main (needsDrive).

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ndows.create {url} and the confined tabs.activate

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…/31, the front-ordering check only) and where cua's window lands while another app is frontmost (46388949499: over that app's window, unfocused); front.mjs and mac-app.swift

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…fter disconnect, reply vs newer selection, selection before creation answers, no-replacement fallback) and the pinned P1-1 limit test; fixes not built (ruling 1338 hold)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Race fixes:
- a window being handed to the person is given up before its protective New Tab page
  is asked for: no reuse of it, no activation in it while that request is on its way;
- a window whose creation answers after the session's client left is given up after
  its own tab closes;
- Chrome's tabs.activated reports are counted per window, and an activation's reply
  is believed only if no report came after its request; a new window's active tab is
  unknown until Chrome says, never assumed;
- the replace-in-a-fresh-window path is gone: a tab that lands in a window just handed
  to the person stays there, the session's, inactive and never activated;
- only the session's current window is cua's (an old one is retired).
The P1-1 limit (a tab the person placed in cua's window can inherit the dragged tab's
index) is pinned by a test and named in the extension.

The panel: windows.create {left, top, width, height}: 500x375, half off the primary
display at its top edge, on the side away from the Dock (chrome.system.display's work
area: the new system.display permission, which carries no install warning), or the
other side when a display adjoins; placed once, never moved back.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…es it; the corner panel withdrawn (ruling 1345)

The panel's half-off-screen bounds are not achievable (Chrome keeps the window it
creates on screen), its 500x375 size broke parity-browser's drag cells, and asked
bounds did not decide the stacking order (hosted runs 46399440730, 46402846688,
46410016977). windows.create goes back to {focused: false, url, group, guard};
displays.query and the system.display permission go. The race fixes of ruling 1339
stay.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ruling 1349)

On the owner's MacBook, a window opened unfocused and with no bounds by a
Chrome that was not the front application opened behind all of the
person's windows, at normal size, and the screenshots agree with the
window list. Chrome reported it visible though fully covered; its speed
was not measured there. With the person's own Chrome as the front app,
where the window opens is unmeasured. The README's own-window lines say
so, and a leftover "panel" from the withdrawn corner panel becomes
"window".

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…he report count only grows

P1: removing the window from cua's stopped new activations but not one the
extension was already running. Its tabs.highlight could land after the
session left and change the person's selection in the window now theirs.
The host now sends windows.release before a handback completes (the
session leaving, a late create after it, and before the protective New
Tab page) and waits for the answer at most ACTIVATE_WAIT_MS. The
extension records the release, and tabs.activate checks it in the same
step that selects, with no await between. So a highlight was either
issued while the window was cua's, or it is declined. An unanswered
release hands back after the bound and is logged.

P2: a window's report sequence restarted at 1 on every tabs.activated
(read after the entry's delete), so with a populated cache a late reply
was believed over a newer selection. It is now a count over all reports.

Extension 0.4.0 gains windows.release (unreleased, so no bump).

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…deadline) and P3 (the released set never shrinks), shipped under ruling 1350

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…window is the profile's last (final check P2, ruling 1354)

checkWindow awaited windows.release (up to 1 s) before asking for the
protective New Tab page, all inside keepWindow's 2 s bound. A slow tab
query plus a slow release reply let the last tab close first, and the
window and profile went with it. The release is now sent first and the
New Tab page asked for right after it, without waiting for the reply.
The extension handles messages in order, so the release is still
recorded first, and checkWindow still waits for the release, bounded,
before it returns. The tracker drops the P2; the P3 stays logged.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…uling 1351)

Conflicts: plugin.json and marketplace.json keep 626's 0.31.6;
tech-debt-tracker.md keeps both new entries.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T04:42:25.660364Z c989abe PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM enabled auto-merge (squash) December 1, 2026 04:40
@SSFSKIM
SSFSKIM merged commit 9b69f53 into main Dec 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser service on macOS: open the tabs cua creates in a Chrome window of cua's own, so they keep full speed while part of that window shows

1 participant