Skip to content

fix(native-chat): preserve initial chat mode on paired-host launches - #8567

Merged
AmethystLiang merged 3 commits into
mainfrom
native-chat-paired-view-mode
Jul 13, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
native-chat-paired-view-mode

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Related issue: #8401. Canonical first-flush PR: #8418. This PR changes only paired-launch mode propagation, not transcript polling, reading, or caching.

Paired runtime/web-host launches could ignore the user's initial native-chat choice because the web-owned branch returned before renderer-only tab defaults were applied. This change carries an optional viewMode through the existing typed session-creation path and keeps that mode authoritative across:

  • launch decision and paired web-host creation;
  • sessionTabs.createTerminal schema/RPC handling;
  • runtime/headless session creation and persistence;
  • renderer IPC materialization and stale PTY rescue.

Explicit terminal mode is preserved just as carefully as chat, so host-provided intent is never replaced by a local preference.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test (29,165 passed, 42 skipped during the implementation pass)
  • pnpm build was not rerun for this focused typed-routing change
  • Added focused runtime, RPC, web-session, launch, IPC-event, rescue, and persistence regressions (882 tests across the reviewer’s focused files)

AI Review Report

Two separate gpt-5.6-sol xhigh agents implemented and then adversarially reviewed the exact origin/main..HEAD diff. The second pass found and fixed three omissions: explicit terminal-mode propagation, mode loss during stale renderer/PTY rescue, and headless initial-mode persistence.

The review checked macOS, Linux, and Windows behavior; local versus runtime-owned/paired/SSH ownership; schema and type coverage; stale events; local/web divergence; persistence; performance; and overlap with #8418, #8157, and #8288. There are no hardcoded shortcuts, labels, paths, shell commands, or platform-only Electron branches, and those open PRs have no changed-file overlap with this branch.

Security Audit

No command execution, filesystem access, dependency, secret, auth, or credential behavior changes. viewMode is additive, enum-constrained data on an existing schema-validated session-creation path. The review verified that stale renderer events cannot replace explicit host intent and that persistence remains inside the existing runtime session boundary.

Notes

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds optional viewMode propagation for terminal creation across shared types, RPC handlers, web-runtime launches, renderer IPC handling, and mobile-session runtime flows. Renderer launch logic computes and forwards the initial mode for local and paired tabs. The runtime stores pending mode, includes it in startup and tab payloads, persists headless tab properties, derives effective tab mode during creation, and reconciles existing surfaces against the requested mode. Tests cover terminal and chat propagation across these paths.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: preserving native-chat view mode during paired-host launches.
Description check ✅ Passed The description matches the required template and includes summary, screenshots, testing, AI review, security audit, and notes.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 24984297-c8c2-418a-9b42-a3390d3dc5b4

📥 Commits

Reviewing files that changed from the base of the PR and between 9a77f56 and 8ba40d6.

📒 Files selected for processing (13)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/session-tabs.test.ts
  • src/main/runtime/rpc/methods/session-tabs.ts
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-agent-web-host-tab.ts
  • src/renderer/src/runtime/web-runtime-session.test.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/shared/runtime-types.ts

Comment thread src/renderer/src/hooks/useIpcEvents.ts
@AmethystLiang

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AmethystLiang
AmethystLiang merged commit 476b6f9 into main Jul 13, 2026
2 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.

1 participant