Skip to content

feat(desktop): browser pages as resource tabs, agent works in a background tab - #7745

Merged
waleedlatif1 merged 4 commits into
stagingfrom
feat/mothership-background-tab
Sep 10, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
feat/mothership-background-tab

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Each live desktop browser page is now its own resource tab in the Chat panel, projected from the desktop app's tab list. The inner browser tab strip, the singleton "Browser" resource, tab pinning, duplicate, reorder, and the native tab context menu are removed, along with their IPC channels and bridge methods. Browser resources are no longer persisted on the chat row; the desktop restores its own pages and legacy rows are dropped on read.
  • The agent works in a background tab. The desktop's automation cursor already drove pages independently of the visible one; the renderer no longer force-activates the browser on every tool call or auto-switches the panel to the agent's tab. The agent's tab is announced as resource activity, so the existing view policy shows it or badges it depending on whether the user has taken over selection. Strip-driven switch-tab no longer claims the page for the user, and a user closing the agent's tab leaves the agent cursor unset.
  • Mentions and attachments point at exact tabs; the "tagged the Browser as a whole" context is gone. The copilot tool catalog is unchanged: browser_open_tab / switch_tab / close_tab / list_tabs still map to native tabs, which are now the resource tabs.
  • Resource tab titles ellipsize at 200px for one or two tabs, 180px for three, and 160px from four on.
  • Bridge snapshot regenerated (additive: claim on switch-tab; new-tab kept only as the fallback for shells without openTab). MIN_DESKTOP_VERSION unchanged.

Type of Change

  • New feature

Testing

  • Unit: new use-browser-tab-resources tests (projection, in-flight close, pending-to-durable migration, selection/follow without ping-pong, agent announce, chat links), plus updated desktop session/driver/ipc/store tests. apps/sim home + browser suites and the full apps/desktop suite pass.
  • In the desktop app against a local build: opening tabs from + Browser, navigating, titles and favicons, switching, closing, the width cap at 1/3/4 tabs, tabs surviving a chat switch, and tabs restored after quitting and relaunching the app.
  • Lint, check:audits, check:desktop-bridge, and type-check pass.

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)

…kground

Each live desktop browser page is now its own resource tab in the Chat
panel, derived from the desktop app's tab list instead of a persisted
singleton "Browser" resource with a second tab strip inside it. The inner
browser tab strip, tab pinning, duplicate, reorder, the native tab context
menu, and the auto-replacement of a closed last tab are removed.

The agent drives its own tab (the desktop's automation cursor) without
moving the user's visible page: the renderer no longer force-activates the
browser on every tool call nor auto-switches the panel to the agent's tab.
The agent's tab is announced as resource activity, so the existing view
policy shows it or badges it depending on whether the user has taken over
selection. Mentions and attachments point at exact tabs; the chat row never
stores browser resources, and legacy rows are dropped on read.
…th cap

Review and in-app verification of the resource-tab browser model found
five problems, all fixed here with tests:

- The strip's switch and follow effects could trade `switch-tab` calls
  forever after a native switch; the switch effect is now keyed on the
  selection alone and ignores the switch it requested itself.
- Migrating a pending chat onto its durable id briefly removed and re-added
  every browser tab; a missing store bucket is no longer read as closed.
- Chat hydration could replace the resource list underneath a fresh add,
  dropping restored tabs on return; a tab stays projected until its
  resource is seen. Hydration also falls back to the last server-held
  resource instead of whichever tab happened to land first.
- Strip-driven `switch-tab` no longer claims the page for the user
  (`claim: false`), so the agent can still close or adopt it; a user
  closing the agent's tab leaves the agent cursor unset rather than
  announcing the neighbour as agent activity.
- The driver marked every restored scope as material, refusing pending
  chat migration after an empty restore; only a restore that yields pages
  does now, matching the session layer. The bridge snapshot is regenerated
  with the documented `'new-tab'` fallback.

Resource tab titles ellipsize at 200px for one or two tabs, 180px for
three, and 160px from four on, one small step at a time.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Sep 10, 2026 11:15pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness, security, or repository-rule violations identified.

Summary

  • Removes the inner browser tab strip, pinning, duplication, and native context-menu actions.
  • Allows agent automation to continue in a background tab without overriding user selection.
  • Migrates mentions and attachments from the former singleton browser resource to exact browser tabs.
  • Updates desktop IPC, bridge contracts, persistence, resource events, and tests for the new tab model.
  • Replaces the loader’s inline animation duration with a configurable CSS custom property, fully addressing the previous review finding.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Desktop browser session] -->|tab snapshots and events| B[Desktop bridge / IPC]
    B --> C[Browser-tab resource projection]
    C --> D[Chat resource tabs]
    D -->|selection without user claim| B
    E[Agent browser tools] -->|automation tab| A
    A -->|resource activity| C
    C -->|follow or badge according to view policy| D
    F[Mentions and attachments] -->|exact scope and tab IDs| D
Loading

Reviews (3) · Last reviewed commit: "fix(emcn): drive the loader spin period ..."

…itles

Reordering a browser tab in the resource strip now reorders the desktop's
native tab list too, so restore and the agent's tab list keep the strip's
order (`reorderTab` returns as an optional bridge method). Dragging a tab
into the chat carries the strip's live title rather than the title captured
when the tab was added. The fork route test follows the new policy that
stored browser rows are dropped.
@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 10, 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.

@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 10, 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.

@waleedlatif1
waleedlatif1 merged commit 1a82a17 into staging Sep 10, 2026
28 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/mothership-background-tab branch September 10, 2026 23:17
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.

1 participant