Repository navigation
fix(remote): create paired agent sessions without host focus - #10193
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughStructured web runtime session creation now sends 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 84d7a197-ace3-490e-9c36-4a9f53f5243a
📒 Files selected for processing (2)
src/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 028bb1d8-53bd-4962-9b8b-16db3a671918
📒 Files selected for processing (16)
config/reliability-gates.jsoncconfig/scripts/remote-agent-session-authority-repro.mjsconfig/scripts/remote-agent-session-process-cleanup.mjsconfig/scripts/remote-agent-session-repro-client.mjsconfig/scripts/remote-agent-session-repro-fixture.mjsconfig/scripts/remote-agent-session-repro-writable-shell.mjssrc/main/runtime/rpc/methods/agent-session.test.tssrc/main/runtime/rpc/methods/agent-session.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-focus-intent.tssrc/renderer/src/runtime/web-session-intent-owner.test.tssrc/renderer/src/runtime/web-session-tabs-sync.test.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/store/index.tstests/e2e/remote-agent-session-focus-authority.spec.ts
…i#10193) * fix(remote): create paired agent sessions without host focus * test(remote): assert structured resume request * test(remote): preserve provider-separated resume coverage * test(remote): assert paired agent focus authority * fix(remote): separate agent host creation from viewer focus * test(remote): harden agent-session authority validation * test(remote): validate retired pane identity --------- Co-authored-by: OrcaWin <[email protected]>
Summary
terminal.createAgentSessionand resumeterminal.ensureAgentSessionrequestsFixes #10192.
Root cause
The remote renderer sent
presentation: "focused"when an activated agent session was requested. A headlessorca servehost has no authoritative renderer window, so terminal creation failed withNo renderer window availablebefore spawning a PTY.Plain paired terminal creation already separates background host creation from caller-local focus. This change applies the same ownership boundary to structured agent sessions.
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
vitest run --config config/vitest.config.ts src/renderer/src/runtime/web-runtime-session.test.ts— 37 passedpnpm test:repro:remote-agent-session— passed: one spawn, retry adoption, durable exit retirement, no restart resurrectionpnpm typecheck— passedpnpm lint— passedoxfmt --checkand focusedoxlint— passedgit diff --check— passedThe full test run completed 36,443 passing tests with two unrelated failures:
src/main/runtime/multi-client-navigation-isolation.integration.test.tsfailed in the aggregate run and then passed in isolation (5/5).src/relay/git-handler.test.tsexpectsnot a git repository, while this temporary checkout returnsStopping at filesystem boundary; it remains reproducible in isolation and does not touch the changed renderer path.The repository requests Node 24; local validation ran on Node 22.22.2 with pnpm 10.24.0 and emitted the engine warning.
AI Review Report
Reviewed the complete two-file diff for host/client focus ownership, legacy fallback behavior, duplicate-spawn risk, and fresh/resume parity. The change leaves legacy
session.tabs.createTerminalbehavior and the existing caller-local focus intent unchanged.Cross-platform compatibility was checked for macOS, Linux, and Windows. The patch contains no platform-specific shortcuts, labels, paths, shell behavior, native modules, or Electron window APIs. It also preserves SSH and paired-runtime host ownership.
Security Audit
No new input handling, command execution, path handling, authentication, secrets, dependencies, permissions, or IPC methods are introduced. The only runtime change selects the existing
backgroundpresentation enum for paired structured agent-session RPCs. Operation IDs, provider claims, compatibility fallback, and host-side authorization remain unchanged.Notes
This is intentionally client-side and scoped to paired remote structured-agent launches. It does not change the server fallback for ordinary local focused terminal creation and does not mask local renderer startup failures.