Skip to content

fix(desktop): fix background tab spawning - #6590

Merged
Sg312 merged 2 commits into
stagingfrom
improvement-desktop-5
Aug 12, 2026
Merged

fix(desktop): fix background tab spawning#6590
Sg312 merged 2 commits into
stagingfrom
improvement-desktop-5

Conversation

@Sg312

@Sg312 Sg312 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix background tab spawning

Type of Change

  • Bug fix

Testing

Manual

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)

@Sg312
Sg312 requested a review from a team as a code owner August 12, 2026 03:18
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 12, 2026 3:24am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR stops browser and terminal automation from spawning replacement background tabs after users select the active surface. It also preserves existing resource selection during background activity and adds concise running-command labels for terminal close confirmations.

  • Reuses the current browser automation tab and terminal shell after user interaction.
  • Keeps resource activity in the background when another resource is selected.
  • Adds and tests describeRunningCommand in the shared terminal protocol.

Confidence Score: 4/5

The browser-tab change should be fixed before merging because unguarded navigation operations can replace a tab after the user has claimed it.

User interaction still marks the active browser tab as claimed, but the changed session selectors return that tab directly and several navigation operations bypass the claim check already used by element actions.

Files Needing Attention: apps/desktop/src/main/browser-agent/session.ts; packages/terminal-protocol/src/index.test.ts

Important Files Changed

Filename Overview
apps/desktop/src/main/browser-agent/session.ts Removes background-tab forking, but leaves navigation operations able to mutate a user-claimed automation tab.
apps/desktop/src/main/terminal/index.ts Reuses the selected terminal for agent operations while retaining command-busy and close protections.
apps/sim/app/workspace/[workspaceId]/home/home.tsx Preserves an existing resource selection and records activity on other agent resources.
packages/terminal-protocol/src/index.ts Adds a bounded best-effort parser for displaying concise running-program names.
packages/terminal-protocol/src/index.test.ts Covers command-label parsing thoroughly but introduces a relative import contrary to repository policy.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  U[User interacts with active browser tab] --> C[Tab marked user-selected]
  C --> A[automationTabId remains on same tab]
  A --> T{Next browser tool}
  T -->|Click/type/scroll| G[User-claim guard rejects action]
  T -->|Navigate/open URL/back/forward| N[Navigation runs without claim guard]
  N --> F[User-visible page or history changes]
Loading

Reviews (1): Last reviewed commit: "Update tab spawning" | Re-trigger Greptile

Comment thread apps/desktop/src/main/browser-agent/session.ts
Comment thread packages/terminal-protocol/src/index.test.ts Outdated
@Sg312
Sg312 merged commit 380aca2 into staging Aug 12, 2026
28 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement-desktop-5 branch August 12, 2026 03:42
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