Skip to content

Prevent background terminal sessions from auto-activating - #6686

Merged
AmethystLiang merged 3 commits into
mainfrom
fix-orchestration-visibility-handoff
Jun 29, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
fix-orchestration-visibility-handoff

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

  • add explicit background/focused terminal presentation handling for runtime-created terminals
  • keep background PTY-backed sessions from activating/revealing desktop or mobile UI
  • avoid sending undefined terminal-create fields through remote runtime RPC payloads
  • remove unrelated orchestration guidance from this branch so it can land separately

Tests

  • pnpm vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts src/renderer/src/lib/launch-agent-background-session.test.ts src/main/runtime/orca-runtime.test.ts src/renderer/src/hooks/useIpcEvents.test.ts src/cli/index.test.ts src/main/runtime/runtime-rpc.test.ts src/main/runtime/orchestration/coordinator.test.ts

* Add `presentation` field ('background' | 'focused') to terminal
  creation to control focus behavior.
* Prevent terminal creation from stealing UI focus by default.
* Return discoverability warnings when default terminal presentation
  fails, unless explicit background mode is selected.
* Update orchestration SKILL.md to clarify review-only worker
  completion rules and named owner handoffs.
Ensure that terminal tabs created with 'background' presentation (such
as background agent sessions or locally backed renderer transports) do
not automatically activate or get selected as the active tab on remote
or mobile sessions.

- Add a selectIfNoActiveTab option to control auto-activation on mobile
- Set presentation to 'background' for remote runtime transports and
  agent background sessions
- Skip tab auto-selection when the presentation is background
@AmethystLiang
AmethystLiang force-pushed the fix-orchestration-visibility-handoff branch from ce9ed96 to e6e82fd Compare June 29, 2026 02:51
@AmethystLiang
AmethystLiang merged commit 49c0917 into main Jun 29, 2026
5 of 6 checks passed
@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2719bd2c-dab2-4910-b227-d209c684594f

📥 Commits

Reviewing files that changed from the base of the PR and between 2edfad0 and e6e82fd.

📒 Files selected for processing (19)
  • src/cli/handlers/terminal.ts
  • src/cli/index.test.ts
  • src/cli/terminal-format.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/orchestration/coordinator.test.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/runtime-rpc.test.ts
  • src/main/window/attach-main-window-services.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/launch-agent-background-session.test.ts
  • src/renderer/src/lib/launch-agent-background-session.ts
  • src/shared/runtime-types.ts

📝 Walkthrough

Walkthrough

A new RuntimeTerminalPresentation type ('background' | 'focused') is introduced in shared runtime types alongside an optional warning field on RuntimeTerminalCreate. This type is threaded through the RPC schema, runtime createTerminal/revealTerminalSession options, main-process IPC, and preload API contracts. The runtime gains resolveTerminalPresentation and createTerminalRevealWarning helpers; tab activation and selectIfNoActiveTab logic are updated accordingly. The renderer's useIpcEvents hook routes creation through a matching resolveTerminalPresentation helper to gate UI surfacing. The CLI --focus flag now sends presentation: 'focused' and displays any returned warning. Tests are updated throughout.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmethystLiang
AmethystLiang deleted the fix-orchestration-visibility-handoff branch June 29, 2026 03:02
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
)

* Support background and focused terminal presentation modes

* Add `presentation` field ('background' | 'focused') to terminal
  creation to control focus behavior.
* Prevent terminal creation from stealing UI focus by default.
* Return discoverability warnings when default terminal presentation
  fails, unless explicit background mode is selected.
* Update orchestration SKILL.md to clarify review-only worker
  completion rules and named owner handoffs.

* Prevent background terminal sessions from auto-activating

Ensure that terminal tabs created with 'background' presentation (such
as background agent sessions or locally backed renderer transports) do
not automatically activate or get selected as the active tab on remote
or mobile sessions.

- Add a selectIfNoActiveTab option to control auto-activation on mobile
- Set presentation to 'background' for remote runtime transports and
  agent background sessions
- Skip tab auto-selection when the presentation is background

* Keep background terminal create payloads focused
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