Skip to content

Default experimental native chat to structured chat - #22933

Merged
brennanb2025 merged 26 commits into
mainfrom
brennanb2025/structured-chat-default
Oct 8, 2026
Merged

brennanb2025 merged 26 commits into
mainfrom
brennanb2025/structured-chat-default

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 85 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​511 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1247 $\color{#cf222e}{\Huge{\mathbf{−}}}$​736
Prod 76 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​126 $\color{#cf222e}{\Huge{\mathbf{−}}}$​867 $\color{#cf222e}{\Huge{\mathbf{−}}}$​741

ELI5

Today’s rollout: Keep the Chat UI on/off switch in Settings → Experimental. Remove both chat-type choices and make supported new chats structured whenever that switch is on. The regular-settings move and upgrade tip are deferred.

Chat UI used to have three saved choices: the Chat UI switch, a separate "default view" selector, and a structured-chat opt-in. With Chat UI on, a new agent could still open as a terminal drawn as chat (the older terminal-backed chat view), and a launch the host could not run as a chat could silently fall into that same view. The extra choices made the single Chat UI switch misleading, and different launch paths disagreed about what it meant.

With this change there is one switch. Chat UI on: a supported new agent opens as a structured chat, where Orca talks to the agent directly and renders its messages. Chat UI off, or a launch the host cannot run as a structured chat (for example SSH, WSL, or an agent without chat support), opens the normal terminal UI. No new launch picks the terminal-backed chat view on its own anymore. Chats you already have, and chat actions you take yourself, keep working with Chat UI off.

What Changed

  • One rule for new launches. One shared check (isNativeChatEnabled) decides the default for every new launch: desktop new tabs, work items, the new-workspace composer, folder workspaces, workspace startup, the host's agent.launch (used by phones, the CLI and orchestration workers), and the support answer the host gives released phones. Whether the host can actually run a structured chat for that agent is still decided separately, by the existing per-host capability and registered-agent checks (including the paired-host version boundary).
  • No automatic terminal-backed chat. The two functions that could choose that view for a new tab are deleted, so tab creation, startup seeding, folder and remote fallbacks, and host-published tabs all open new agents in terminal view.
  • Explicit actions still work with Chat UI off. A saved chat tab still opens as chat and can switch chat → terminal → chat. The tab/pane "Switch to chat view" action and Cmd/Ctrl+Shift+J stay available on supported agent terminals. "Resume in new chat" from agent session history stays available whenever the host supports it. The switch controls only the default for ordinary new launches.
  • Chat model and effort stay with chats. The model and effort picked in the chat composer are applied only to launches that open as a structured chat (which load them themselves). A launch that falls back to the terminal no longer gets them as command-line flags, and uses the agent's normal default arguments again.
  • Retired settings. The default-view and structured-opt-in settings are removed from saved settings, defaults, updates, and telemetry. Loading a saved profile deletes both keys and keeps the Chat UI choice.
  • Paired clients. A current paired desktop still decides from its own settings and sends its own launch preference. Released phones, which leave the launch mode to the host, follow the host's Chat UI switch, and the host still only creates a chat the phone can display. For wire compatibility the host's settings answer still includes the two old keys, now derived and never saved: the structured-support key mirrors Chat UI and the default-view key is always false. No current client reads them to choose a view, so they do not decide how an older paired desktop launches. An older desktop uses its own saved settings, as before.
  • Settings → Experimental keeps one Chat UI on/off switch. The terminal/structured switch and default-view selector are removed, along with obsolete copy. Moving the switch into regular Chat settings is deferred to Put Chat UI in the existing Chat settings section #22934.

What users will notice on upgrade

  • Anyone who had Chat UI on with the default view left on "Terminal chat", or with the structured opt-in off, now gets structured chats for every supported new launch. This includes orchestration workers and phone launches through this host.
  • With Chat UI on, opening a workspace with no tabs now starts the default agent, as a chat where the host supports it. Before, this happened only when the default view was set to chat. Choosing "blank" as the default agent still opens the workspace without an agent.
  • Anyone with Chat UI off sees no change for new launches.

Why

A second default plus a terminal-chat fallback let different launch paths disagree about what Chat UI meant. Routing every new launch through one setting and the existing per-host support check removes those conflicting states, and there is no stored second copy left to drift. Support is kept separate from the default so existing chats and explicit chat actions keep working after Chat UI is turned off.

Release dependency

This PR can ship on its own today. Chat UI remains an Experimental on/off setting, so this update does not introduce regular-settings opt-ins.

#22934 (regular Chat settings) and #26540 (the permanent experimental audience record and restart tip) are held as drafts for a later rollout. Those two must first ship in the same future graduation update, so the audience is captured before regular opt-ins become possible. #26336 supplies the sidebar action described by that future tip and has already landed on main.

Linked Issue

This is the existing maintainer PR for the Chat UI default change; no separate issue was opened.

Visual Proof

Current PR: full-window Experimental settings at 73fba25554b. Captured from the real hidden Electron app in an isolated macOS development profile, using the Electron and visual-proof skills. App identity and branch were verified. The entire 1728×994 app viewport is shown, with the Settings sidebar and Experimental page; no crop or recreated component.

Chat UI enabled: one on/off switch, with structured chat for supported new agents and no terminal/structured or default-view selector.

Full-window Experimental settings — Chat UI on

Same full-window page with Chat UI off

Full-window Experimental settings — Chat UI off

These captures verify the current settings surface. They do not exercise a live agent conversation or a packaged release.

The earlier settings and launch checks ran on the combined stack with #22934 at 6f24254. They verify the structured/terminal launch routing, but show the deferred regular-settings UI. The current-head Experimental screenshots above now verify that settings surface directly. The final head 73fba25 integrates newer main code; its conflict resolutions only adapt tests, and the Experimental settings surface was subsequently captured on that exact head; the launch flow was not repeated. Review and screenshots.

Chat UI off opens a terminal:

Chat UI off: terminal

Chat UI on opens a structured chat:

Chat UI on: structured chat

The launch checks used stand-ins. The chat's startup notice is expected because the stand-in exits; a signed-in conversation was not exercised.

Testing

  • Targeted tests on the final head: the earlier 33-file batch (385 tests) passed. That batch covers launch routing, persistence, session-history resume, the composer, folder workspaces, the telemetry allow-list and saved-key removal. The four agent-launch-caller-* files (268 tests), including the fixed test below, and the two structured-chat seeding test files (35 tests) also passed. A wider batch on the combined stack with Put Chat UI in the existing Chat settings section #22934 found one test still expecting the saved chat model and effort on a terminal fallback launch. That test is replaced: with Chat UI on or off, a fallback terminal launch keeps the default permission-bypass flag or the user's saved arguments and gets no model or effort flags. The existing structured-chat tests show a new chat still gets the saved model and effort. The broader combined-stack batch exercised 85 files: 83 passed, while the stale caller assertion and the local-runtime load failure were resolved in the separate runs described here. This reports the recorded batches, rather than claiming one complete CI run.

  • src/main/runtime/orca-runtime.test.ts fails to load on a machine whose Bun is older than the version this repo pins (1.4.2): Bun 1.3.14 has no node:sqlite. With the pinned Bun, and under Node, it passes (1,338 passed, 1 skipped). CI uses the pinned version, and this PR does not touch that file or anything related to SQLite.

  • Web typecheck passed on the final head. Node and web typechecks passed from a clean cache on the previous head; the last commit changes only a renderer test. orca-ci-checks passed all 22 static checks on the final head and all 23 checks (typecheck included) before the merge with main.

  • CI on the previous head failed one test: the terminal pane store-listener budget expected 16 listeners per pane and got 15. This PR deliberately removed the pane's read of the Chat UI setting, so one fewer listener is the intended result, not a regression. The test now pins 15 exactly, and the 20-pane bound tightens with it. Putting that one read back restores 16, which confirms the cause. Budget file 4/4, the related terminal-chat lifecycle tests 7/7, web typecheck and the 22 static checks passed. Only that test changed.

  • Final head 73fba25554b integrates current main 3e27e62f434 and is mergeable. The only conflict was the restart-modal test: retain main’s new fixture and session-list assertions while switching to the single experimentalNativeChat flag; the new shared fixture uses that flag too. A fresh Claude Opus review approved the resolution with no findings. Fresh node and web typechecks passed from a cleared cache; 15 targeted test files passed 1,650 tests with one skip on pinned Bun 1.4.2; orca-ci-checks --no-typecheck passed 22/22. Final readiness without counsel passed.

  • CI was green at the previous head 1b24297a04e (38 successful checks and 18 skipped). The new push restarts CI; it was not awaited. No PR was merged.

  • Combined-stack rendered launch choices and settings were checked on the M4Air through hidden CDP with the authorized Codex driver; stand-ins only.

  • Automated tests added/updated

Review

Prepared by @BrennanKB5.

Agent skill upstream boundary

  • Not applicable; this change copies no upstream skill-installer material.

Notes

  • Unsupported agents and SSH/WSL execution use the terminal UI for new launches.
  • Known limits, intentionally left as they are: an older desktop client set to the old chat-by-default view still asks a new host for a terminal-backed chat tab, and the host cannot tell that request from an explicit one. Agent Sleep wake and quick-create startup do not send an explicit view, so an older host with its own old chat default still applies it. Both behave the same before and after this PR.
  • The Chat UI setting copy and its "Supported agents" list are finalized in Put Chat UI in the existing Chat settings section #22934.

Checklist

  • The user-facing before and after, mechanism, and reason are described above
  • Existing chat and mixed-version behavior are covered by tests
  • Cross-platform and remote fallback paths were considered
  • Rendered settings and ordinary launch choices checked on macOS, with screenshots above
  • Signed-in provider, Windows, Linux, WSL, SSH, and mobile rendered flows were not exercised

Retire the experimentalStructuredNativeChat opt-in. Chat UI on is now the
one gate for structured chat: new agent tabs that default to Chat UI start a
structured session wherever the launch is supported, and unsupported
launches keep falling back to terminal-backed chat.

- Shared isNativeChatEnabled predicate replaces prefersStructuredNativeChatByDefault;
  host admission, renderer routing, orchestration mode, startup projection,
  tab sync and the resume offer all read it.
- The retired key is stripped on load and on save, dropped from the settings
  type, defaults, the published client-settings projection and telemetry.
- Settings no longer offer the structured toggle; resume-after-restart and
  shell-environment rows show under the Chat UI default view.
- Startup structured-tab projection moves beside its sync hook so both gates
  read the same predicate.
New local Claude and Codex chats no longer sit on a PTY, so the page stops saying the terminal is always the source of truth and scopes the chat/terminal toggle to terminal-backed chats.
…ope note

A host refusal after the route picks structured chat still ends as a failed launch.
…s off

Turning Chat UI off hid open Claude/Codex chat tabs while their provider
processes kept running, because the host and the desktop mirror gated
serving existing sessions on the same setting that decides how new
launches open.

The host now asks two separate questions. Creating a new structured
session (agentSession.create, createSupport, ensure) needs the negotiated
capability plus the Chat UI setting. Serving a session that already
exists (listing, reading, sending, resuming, closing, and the mobile
projection and restore) needs the capability only. The desktop mirror,
startup restore and resume-on-restart offer no longer read the setting,
and the toggle-off teardown and the mobile re-publish on setting change
are removed as dead.
…may exist

The previous commit started the every-worktree session-tab census and
subscription, the startup restore, and the resume-offer host read for every
desktop user. Gate them on a derived fact instead: Chat UI is on, or the
local host holds at least one structured session record. With Chat UI off
nothing can create a session, so the answer can only go from yes to no.

The host answers from its installed record store, or from whether the store
file exists when the host is not installed, so a machine that never had a
structured chat pays one existence check and never starts the host. Chat UI
turning on starts the sync; turning it off never stops it.

@pullfrog pullfrog 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.

Important

The reworked local structured-chat tab sync can latch itself as "already running" without ever subscribing, so a transient capability-probe failure at startup leaves the desktop/sidebar mirror stale until the app reloads. One gate-classification gap and a stale comment are also noted.

Reviewed changes

  • Host gate split — one settings-gated check is replaced by canServeStructuredAgentSessions (capability only) and canCreateStructuredAgentSessions (capability + host Chat UI). create/createSupport/ensure use the create gate; every other agentSession.* is now served regardless of the Chat UI setting, so a settings toggle can no longer lock a user out of a running chat.
  • Retired setting — experimentalStructuredNativeChat is removed from the settings type, defaults, RuntimeClientSettings, the store contract, telemetry and five locales, and added to RetiredGlobalSettings so an old value is stripped on load.
  • Shared launch predicate — isNativeChatEnabled / agentTabsDefaultToNativeChat replace prefersStructuredNativeChatByDefault across renderer routing, orchestration worker mode and agent.launch.
  • Tab projection — the Chat UI setting no longer gates listing; mobile always keeps agent-session rows (fallback title when incapable), capable clients keep real rows with Chat UI off.
  • Renderer sync rework — toggle-off teardown deleted; one module-global runningSync starts when Chat UI is on or the host holds records and is never stopped by a Chat UI change.
  • New host probe — app:hasLocalStructuredAgentSessions / hasStructuredAgentSessionRecords back the presence check without installing the host.
  • Settings UI/i18n — structured opt-in removed; scope note, resume and shell-env rows now follow Default view.

ℹ️ Nitpicks

  • src/renderer/src/lib/activate-ai-vault-structured-session.ts:236-238 still says switching structured chat off "wipes the mirror"; this PR removed that teardown, so the rationale for the generation fence there is now inaccurate (the fence may still be wanted for other races).
  • structured-agent-session-gate-classification.test-fixture.ts states a method belongs to exactly one of its lists, but conversationCommand, commands, restart* and subscribeTurnCompletions appear in none. Repointing restart* is fine (covered separately), but the unclassified conversationCommand is why the gap in the inline comment went unpinned.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

*
* - Brings a NEW session into being -> `requireStructuredCreatePermission` first. createSupport,
* create and ensure (which attaches a client-supplied location) live here; the host's Chat UI
* setting is asked on top of the capability.

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.

This comment defines "brings a NEW session into being -> create gate", but agentSession.conversationCommand is requireStructuredCapability-only while its clear branch attaches a brand-new session with expectedRuntimeFence: null (structured-conversation-command.ts:98-144). With Chat UI off, a capable client can therefore still bring a new structured session (and provider child) into being through /clear. If that is an accepted continuation of an open chat rather than a new launch, it is worth saying so where the rule is stated; otherwise the branch needs the create gate.

Technical details
# `conversationCommand` (`clear`) bypasses the create gate

## Affected sites
- `src/main/runtime/rpc/methods/structured-agent-session.ts:106-126` — handler calls `requireStructuredCapability` then `host.conversationCommand`.
- `src/main/native-chat/agent-session-wire/structured-conversation-command.ts:98-144` — `clear` mints `replacementSessionId` and `host.attach`es it with `expectedRuntimeFence: null`.
- `src/main/native-chat/agent-session-wire/structured-agent-session-attach.ts:3-6` — a null expected fence means "no session exists yet".

## Required outcome
- Decide and document whether an open chat's `/clear` is exempt from the Chat UI create requirement; if not, gate the clear branch on the create permission.

## Open questions for the human (optional)
- Is `/clear` a new launch (create) or a continuation of an already-open chat?

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

The change removes experimentalStructuredNativeChat and uses Chat UI enablement and the chat-default setting for launch routing. Structured-session serving now depends on client capability, while session creation also checks Chat UI enablement. Local session discovery supports startup tab restoration and continued synchronization when Chat UI is off. Restart offers no longer depend on the retired setting.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 8ec35

After a failed capability probe, live chat-tab synchronization can remain unavailable even when Chat UI is toggled later. Release sync ownership on the retry path before merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 8ec35

The new session lifecycle warrants design review. Local ownership checks limit the apparent exposure, and no cross-account access is established, but an in-flight inventory response may restore an outdated chat tab after session state changes.

Retained concerns

  • Medium · reliability · inferred: Removing the inventory generation fence may let a delayed authoritative response apply an older publication after local session state changes, restoring an outdated tab. The resulting exposure is limited by local-host ownership checks, and response-ordering guarantees have not been established.
Security review details

Security Blast Radius

  • inferred — The investigated repair path affects renderer-visible local structured-session tabs. The supplied source does not establish remote-host, cross-tenant, or credential authority through its worktree and epoch arguments.

Trust Boundaries and Controls

  • observed — The worktree and publication-epoch values supplied to repair select retry bookkeeping and the post-refresh retirement check; the injected authoritative inventory refresh takes neither value as an argument.

Resilience and Maintainability Implications

  • inferred — Same-lineage version checks and local-host ownership constrain stale inventory effects, but neither establishes ordering between delayed authoritative responses from different publication lineages.

Hardening Proposals

  • proposed — Establish a response-ordering or lifecycle fence for authoritative inventory application, and test a delayed repair response arriving after a newer publication or session close. This is a proposal, not a verified security finding.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.87% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 61 functions across 65 files. 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 identifies the main change: native Chat UI now defaults supported launches to structured chat. It is concise and directly related to the changeset.
Description check ✅ Passed The description is comprehensive and follows the repository template. It explains the user-facing change, implementation, rationale, testing, visual proof, compatibility considerations, known limitati…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 24552c11-48c8-4cfa-b352-6c0fe4e0fef0

📥 Commits

Reviewing files that changed from the base of the PR and between acf8e67 and 4ce93f5.

📒 Files selected for processing (89)
  • docs/site/content/docs/agents/native-chat.mdx
  • src/main/agent-launch/agent-launch-executor.test.ts
  • src/main/agent-launch/agent-launch-mode.ts
  • src/main/ipc/runtime.test.ts
  • src/main/persistence/applying-settings/terminal-settings-migrations.ts
  • src/main/persistence/loading-store/normalize-loaded-global-settings.test.ts
  • src/main/runtime/claude-structured-session-integration.test.ts
  • src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
  • src/main/runtime/orca-runtime-state-fields.ts
  • src/main/runtime/orca-runtime-structured-native-chat-settings.test.ts
  • src/main/runtime/orca-runtime-structured-session-presence.test.ts
  • src/main/runtime/rpc/methods/agent-launch-replay.test.ts
  • src/main/runtime/rpc/methods/agent-launch.test-fixture.ts
  • src/main/runtime/rpc/methods/client-ui.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-mode-opacity.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-mode-selection.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-mode.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-receipt-wording.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-support-unknown.test.ts
  • src/main/runtime/rpc/methods/session-tab-agent-capability-mutations.test.ts
  • src/main/runtime/rpc/methods/session-tab-agent-status-projection.test.ts
  • src/main/runtime/rpc/methods/session-tab-agent-status-projection.ts
  • src/main/runtime/rpc/methods/session-tab-close-methods.ts
  • src/main/runtime/rpc/methods/session-tab-mutation-methods.ts
  • src/main/runtime/rpc/methods/session-tabs-inventory.ts
  • src/main/runtime/rpc/methods/session-tabs-structured-restore.test.ts
  • src/main/runtime/rpc/methods/session-tabs.ts
  • src/main/runtime/rpc/methods/structured-agent-session-admission.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-adoption-replay.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-gate-classification.test-fixture.ts
  • src/main/runtime/rpc/methods/structured-agent-session-gate.ts
  • src/main/runtime/rpc/methods/structured-agent-session-hold.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-hold.ts
  • src/main/runtime/rpc/methods/structured-agent-session-policy.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-policy.ts
  • src/main/runtime/rpc/methods/structured-agent-session-precommit-refusal.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-rpc.test-fixture.ts
  • src/main/runtime/rpc/methods/structured-agent-session.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session.ts
  • src/main/runtime/rpc/methods/structured-session-tab-restore.ts
  • src/main/runtime/runtime-client-settings.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/runtime/structured-agent-session-integration-replay.test.ts
  • src/main/runtime/structured-agent-session-integration.test.ts
  • src/main/startup/main-process-ipc-bootstrap.ts
  • src/preload/api/app-api.ts
  • src/preload/api/app-bridge.ts
  • src/renderer/src/app-shell/use-app-startup-hydration.ts
  • src/renderer/src/app-startup-routing.test.ts
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
  • src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
  • src/renderer/src/components/native-chat-resume-on-restart-store.ts
  • src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx
  • src/renderer/src/components/settings/ExperimentalPane.test.tsx
  • src/renderer/src/components/settings/NativeChatExperimentalSetting.test.tsx
  • src/renderer/src/components/settings/NativeChatExperimentalSetting.tsx
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/agent-launch-caller-routing.test.ts
  • src/renderer/src/lib/agent-launch-funnel-test-harness.ts
  • src/renderer/src/lib/agent-launch-route-input.test.ts
  • src/renderer/src/lib/agent-launch-routing.test.ts
  • src/renderer/src/lib/agent-launch-routing.ts
  • src/renderer/src/lib/agent-session-launch-plan.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts
  • src/renderer/src/runtime/host-session-mirror-settle-census.test.ts
  • src/renderer/src/runtime/local-structured-session-presence.ts
  • src/renderer/src/runtime/local-structured-session-tab-retirement.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync-chat-ui-off.test.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/inventory-generation-fence.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts
  • src/renderer/src/web/preload-api/web-app-api.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/structured-native-chat-launch-route.test.ts
  • src/shared/structured-native-chat-launch-route.ts
  • src/shared/telemetry-events.test.ts
  • src/shared/telemetry-property-schemas.ts
  • tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
  • tests/e2e/structured-native-chat-routing-authority.unit.test.ts
💤 Files with no reviewable changes (21)
  • src/main/runtime/orca-runtime-structured-native-chat-settings.test.ts
  • src/renderer/src/lib/agent-launch-funnel-test-harness.ts
  • src/main/runtime/orca-runtime-state-fields.ts
  • src/main/agent-launch/agent-launch-executor.test.ts
  • src/main/runtime/rpc/methods/orchestration-worker-start-receipt-wording.test.ts
  • src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx
  • src/main/runtime/rpc/methods/agent-launch-replay.test.ts
  • src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts
  • src/main/runtime/rpc/methods/agent-launch.test-fixture.ts
  • src/renderer/src/lib/agent-launch-route-input.test.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/shared/telemetry-property-schemas.ts
  • tests/e2e/structured-native-chat-routing-authority.unit.test.ts
  • src/shared/global-settings-types.ts
  • src/shared/default-global-settings.ts
  • src/renderer/src/lib/agent-launch-caller-routing.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab-placement.test.ts
  • src/renderer/src/runtime/local-structured-session-tab-retirement.ts
  • src/main/runtime/rpc/methods/orchestration-worker-support-unknown.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

import { Callout } from '@/components/docs/prose'

Chat UI is an experimental view layered on supported agent terminal sessions. The terminal remains the source of truth; Chat UI is a structured transcript + composer for the same PTY. Transcript decoding covers **Claude**, **Codex**, **Grok**, and **OMP** — OMP sessions open in Chat UI like the others instead of staying raw-terminal-only.
Chat UI is an experimental chat surface for supported agent sessions. New local **Claude** and **Codex** chats run as chat sessions Orca drives directly, with no terminal behind them. Other agents, and Claude or Codex chats Orca can't start that way (for example on WSL, over SSH, or on a remote server), show chat over their agent terminal, which stays the source of truth. Transcript decoding covers **Claude**, **Codex**, **Grok**, and **OMP** — OMP sessions open in Chat UI like the others instead of staying raw-terminal-only.

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Qualify when local chats run without a terminal.

If a user keeps Terminal as the default view, a new local Claude or Codex tab does not necessarily start a directly driven chat session. State that the terminal-free path applies when Chat UI is enabled, Chat UI is the default view, and the launch is supported. The current sentence conflicts with the option described in Line 14.

Comment on lines 182 to 194
defineMethod({
name: 'agentSession.ensure',
params: AttachParams,
handler: async (params, ctx) => attachClientSuppliedLocation(params, ctx)
// Create-gated: attaching a client-supplied location can bring a new session into being.
handler: async (params, ctx) => {
requireStructuredCreatePermission(ctx)
return attachClientSuppliedLocation(params, ctx)
}
}),
defineMethod({
name: 'agentSession.send',
params: SendParams,
handler: sendStructuredAgentSessionForClient

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n 'attachClientSuppliedLocation|expectedRuntimeFence' src/main/runtime/rpc/methods/structured-agent-session.ts src/main/runtime src/shared | head -110
sed -n '160,205p' src/main/runtime/rpc/methods/structured-agent-session.ts

Repository: stablyai/orca

Length of output: 9281


🏁 Script executed:

set -eu
rg -n "function attachClientSuppliedLocation|const attachClientSuppliedLocation|resolveClientSuppliedAttach|attach\\(|expectedRuntimeFence|structured.*attach|attach.*structured" src/main/runtime/rpc/methods src/main/runtime src/shared -g '*.ts' | head -220
printf '\n--- structured-agent-session.ts ---\n'
cat -n src/main/runtime/rpc/methods/structured-agent-session.ts | sed -n '70,155p'
printf '\n--- candidate host declarations ---\n'
rg -n "class .*Host|interface .*Host|attach.*\\(|async attach|attach:|host\\.attach" src/main/runtime -g '*.ts' | head -220

Repository: stablyai/orca

Length of output: 41438


🏁 Script executed:

set -eu
printf '%s\n' '--- method and imports ---'
cat -n src/main/runtime/rpc/methods/structured-agent-session.ts | sed -n '1,155p'
printf '%s\n' '--- attach parameter and receiver definitions ---'
rg -n "export .*AgentSessionAttachParams|interface AgentSessionAttachParams|type AgentSessionAttachParams|attach\\s*\\(" src/main/native-chat src/main -g '*.ts' | rg "agent-session|structured|host|attach" | head -180
printf '%s\n' '--- native-chat candidate files ---'
find src/main/native-chat -type f -name '*.ts' | sort | head -120
printf '%s\n' '--- fixture and admission tests ---'
cat -n src/main/runtime/rpc/methods/structured-agent-session-rpc.test-fixture.ts | sed -n '1,155p'
cat -n src/main/runtime/rpc/methods/structured-agent-session-admission.test.ts | sed -n '130,205p'

Repository: stablyai/orca

Length of output: 41593


🏁 Script executed:

set -eu
printf '%s\n' '--- host attach implementation ---'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-host.ts | sed -n '180,310p'
printf '%s\n' '--- attach flow ---'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-attach-flow.ts | sed -n '1,260p'
printf '%s\n' '--- attach params ---'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-attach.ts | sed -n '45,125p'
printf '%s\n' '--- host tests around attach behavior ---'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-host.test.ts | sed -n '1,180p'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-host.test.ts | sed -n '640,830p'
printf '%s\n' '--- explicit missing/stale/session existence cases ---'
rg -n -C 5 "missing|does not exist|not found|stale|fence|expectedRuntimeFence|session.*exist|create.*attach|attach.*create" src/main/native-chat/agent-session-wire/*test.ts | head -300

Repository: stablyai/orca

Length of output: 42636


🏁 Script executed:

set -eu
printf '%s\n' '--- attach admission and reservation helpers ---'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-attach.ts | sed -n '1,190p'
printf '%s\n' '--- reservation implementation ---'
rg -n "reserveOwner\\s*=|reserveOwner\\(|function reserveOwner|reserveRequestFor|expectedRuntimeFence" src/main/runtime/agent-session-record-store.ts src/main/native-chat/agent-session-wire src/main/runtime -g '*.ts' | head -220
printf '%s\n' '--- relevant host test names and ranges ---'
rg -n -C 3 "non.?existent|missing|new session|existing session|second create|replay|expectedRuntimeFence|ensureParams" src/main/native-chat/agent-session-wire/structured-agent-session-host.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-*test.ts | head -260

Repository: stablyai/orca

Length of output: 42268


🏁 Script executed:

set -eu
printf '%s\n' '--- reserve request construction ---'
cat -n src/main/native-chat/agent-session-wire/structured-agent-session-attach.ts | sed -n '285,350p'
printf '%s\n' '--- record store reservation ---'
cat -n src/main/runtime/agent-session-record-store.ts | sed -n '150,285p'
printf '%s\n' '--- store tests for expected fence and missing records ---'
cat -n src/main/runtime/agent-session-record-store.test.ts | sed -n '210,265p'
cat -n src/main/runtime/agent-session-record-store.test.ts | sed -n '300,365p'

Repository: stablyai/orca

Length of output: 14248


🏁 Script executed:

set -eu
printf '%s\n' '--- reservation commit implementation ---'
rg -n "commitAgentSessionReservation" src -g '*.ts'
printf '%s\n' '--- reservation implementation context ---'
rg -l "commitAgentSessionReservation" src -g '*.ts' | xargs -r -n1 sh -c 'echo "--- $0"; rg -n -C 8 "commitAgentSessionReservation" "$0"'
printf '%s\n' '--- ensure callers and fence construction ---'
rg -n -C 5 "agentSession\\.ensure|ensureParams\\(|expectedRuntimeFence:.*fence|expectedRuntimeFence:.*runtimeFence" src -g '*.ts' | head -260

Repository: stablyai/orca

Length of output: 32695


🏁 Script executed:

set -eu
rg -n "function evaluateAgentSessionReserveOperation|evaluateAgentSessionReserveOperation|expectedFence|checkpoint_stale" src/main/runtime/agent-session-reservation-admission.ts | head -100
cat -n src/main/runtime/agent-session-reservation-admission.ts | sed -n '90,315p'

Repository: stablyai/orca

Length of output: 11128


Gate only new-session attaches.

When expectedRuntimeFence is non-null, agentSession.ensure can reattach an existing session. The current unconditional gate rejects this before host.attach. A non-null fence cannot create a missing session: the record store rejects that request with agent_session_checkpoint_stale. Gate only the null-fence create form.

Suggested fix
    handler: async (params, ctx) => {
-      requireStructuredCreatePermission(ctx)
+      if (params.envelope.expectedRuntimeFence === null) {
+        requireStructuredCreatePermission(ctx)
+      }
      return attachClientSuppliedLocation(params, ctx)
    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
defineMethod({
name: 'agentSession.ensure',
params: AttachParams,
handler: async (params, ctx) => attachClientSuppliedLocation(params, ctx)
// Create-gated: attaching a client-supplied location can bring a new session into being.
handler: async (params, ctx) => {
requireStructuredCreatePermission(ctx)
return attachClientSuppliedLocation(params, ctx)
}
}),
defineMethod({
name: 'agentSession.send',
params: SendParams,
handler: sendStructuredAgentSessionForClient
defineMethod({
name: 'agentSession.ensure',
params: AttachParams,
// Create-gated: attaching a client-supplied location can bring a new session into being.
handler: async (params, ctx) => {
if (params.envelope.expectedRuntimeFence === null) {
requireStructuredCreatePermission(ctx)
}
return attachClientSuppliedLocation(params, ctx)
}
}),
defineMethod({
name: 'agentSession.send',
params: SendParams,
handler: sendStructuredAgentSessionForClient

Comment thread src/renderer/src/i18n/locales/ja.json Outdated
"structuredCopy": "Codex と Claude 用のホスト所有の構造化チャットランタイムにオプトインします。 Off では、既存のターミナルを使用したチャットパスが維持されます。",
"structuredScope": "今のところローカルセッションのみ。 WSL およびリモート実行ホスト (SSH を含む) は引き続きターミナルチャットを使用し、Orca がプロセスの開始時間を読み取ることができない限り、Windows はターミナルチャットにフォールバックします。",
"structuredToggleLabel": "更新された構造化ネイティブチャットの切り替え",
"structuredScopeLocalOnly": "今のところローカルセッションのみ。WSL およびリモート実行ホスト (SSH を含む) は引き続きターミナルチャットを使用します。",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '65,135p' src/renderer/src/components/settings/NativeChatExperimentalSetting.tsx
sed -n '7058,7067p' src/renderer/src/i18n/locales/ja.json
sed -n '7224,7234p' src/renderer/src/i18n/locales/en.json
sed -n '1,55p' src/main/claude/claude-structured-location-support.ts
sed -n '1,55p' src/main/codex/codex-structured-location-support.ts

Repository: stablyai/orca

Length of output: 5930


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- setting state references ---'
rg -n -C 4 'structuredChatActive|structuredScopeLocalOnly' src/renderer/src/components/settings/NativeChatExperimentalSetting.tsx src/renderer/src/i18n/locales/en.json src/renderer/src/i18n/locales/ja.json
printf '%s\n' '--- launch routing ---'
sed -n '160,240p' src/main/agent-launch/agent-launch-mode.ts
printf '%s\n' '--- runtime capability path ---'
sed -n '1,60p' src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
printf '%s\n' '--- base Japanese and English strings ---'
git show acf8e679ea694081862464be3cd2af8cb5059826:src/renderer/src/i18n/locales/ja.json | sed -n '7058,7067p'
git show acf8e679ea694081862464be3cd2af8cb5059826:src/renderer/src/i18n/locales/en.json | sed -n '7224,7234p'

Repository: stablyai/orca

Length of output: 15302


Retain the Windows fallback condition in both scope strings.

“Local sessions only” is a necessary location restriction, but this text is shown when users select structured chat as the default. The router can still downgrade local Windows launches when process-start-time support is unavailable. The text lists only WSL and remote hosts as terminal-chat cases, so omitting the Windows condition can mislead users.

Suggested fix
-            "structuredScopeLocalOnly": "今のところローカルセッションのみ。WSL およびリモート実行ホスト (SSH を含む) は引き続きターミナルチャットを使用します。",
+            "structuredScopeLocalOnly": "今のところローカルセッションのみ。WSL およびリモート実行ホスト (SSH を含む) は引き続きターミナルチャットを使用し、Orca がプロセスの開始時間を読み取ることができない限り、Windows はターミナルチャットにフォールバックします。",

Apply the equivalent Windows condition to src/renderer/src/i18n/locales/en.json as well.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"structuredScopeLocalOnly": "今のところローカルセッションのみ。WSL およびリモート実行ホスト (SSH を含む) は引き続きターミナルチャットを使用します。",
"structuredScopeLocalOnly": "今のところローカルセッションのみ。WSL およびリモート実行ホスト (SSH を含む) は引き続きターミナルチャットを使用し、Orca がプロセスの開始時間を読み取ることができない限り、Windows はターミナルチャットにフォールバックします。",

…chat host

With every Chat UI user now on structured chat, the launch-time resume offer read built the host even on machines with no stored chat, which on Linux scans every process environment. No store on disk means no offer, so the listing answers empty without installing the host.
…ribed

A failed capability probe reads as unsupported, so the sync returned without subscribing while still holding the one-sync slot. Nothing could start another, and chat tabs stopped live-updating until relaunch. The start now reports whether it subscribed, and a sync that did not releases the slot so the next Chat UI change retries.
… UI says

The renderer asked main whether a structured store existed before reading the restart offer, so it would not start the chat host for users without one. The host now answers an empty offer without starting itself, which made that probe an extra round trip. In paired web it was also wrong: the probe is hard-coded to no and the gate read the browser's own Chat UI setting, so a paired host's chats were never offered back once that was off.

@pullfrog pullfrog 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.

ℹ️ No new issues in this increment. The prior review's two findings are still open, so this stays a non-approving review.

Reviewed changes

  • agentSession.restartResumable short-circuit — the handler now checks the client capability, then returns an empty offer without installing the structured-session host when the host is absent and no structured-chat store file exists on disk, so a user who never had a structured chat stops paying a per-launch host install.
  • Restart-resume coverage — new structured-agent-session-restart-resume.test.ts covers the no-record short-circuit (host not installed), the has-record path (host install attempted), and the capability refusal for an incapable client.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues in this increment. The prior sync-latch finding is now addressed; the gate-classification finding remains open, so this stays a non-approving review.

Reviewed changes

  • Sync latch release — startLocalStructuredSessionTabsSync now resolves Promise<boolean>, returning false when it never subscribes (disposed or unsupported capability probe) and true once a subscription owns the mirror; ensureLocalStructuredSessionTabsSyncRunning stops the sync on false, so the module-global latch is released and a later Chat UI change retries.
  • Regression coverage — local-structured-session-tabs-sync-chat-ui-off.test.ts hoists getStatus for per-test control and adds a failed-probe-then-Chat-UI-on case that asserts the subscription is retried.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

The fence existed so a Chat UI toggle-off could retire in-flight inventory replies before it cleared the mirror. That teardown is gone: turning Chat UI off keeps open chats, and only a test reset still bumped the generation, so every production check compared equal. The sync's own disposal still fences its subscription, and the startup restore latch and publication cursors stay.

@pullfrog pullfrog 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.

ℹ️ No new issues in this increment. The generation fence is dropped now that the toggle-off teardown it guarded is gone, and the restart offer now always asks the host; one earlier finding remains open, so this stays a non-approving review.

Reviewed changes

  • Restart offer always asks the host — useNativeChatRestartOffer no longer takes the Chat UI flag and waits for settings before a single agentSession.restartResumable read; loadLaunchOffer drops its localStructuredSessionsMayExist probe. The host's restartResumable short-circuit keeps the no-record case to a cheap existence check, and the modal/status segment now render off the host's answer alone.
  • Generation fence dropped — inventory-generation-fence.ts is deleted and its publication cursors split into inventory-publication-cursors.ts. With Chat UI no longer tearing down the mirror, the syncGeneration fence had no production superseder left, so isCurrentLocalStructuredSessionGeneration/supersedeLocalStructuredSessionGeneration and every expectedGeneration argument are removed, and refreshLocalStructuredSessionTabs applies unconditionally.
  • Latch fix retained — startLocalStructuredSessionTabsSync still resolves false when it never subscribed and ensureLocalStructuredSessionTabsSyncRunning still stops the sync on false, so the earlier running-sync latch finding stays addressed.
  • Simplified call sites and tests — scheduleRetiredEpochRepair, activate-ai-vault-structured-session and the launch-recovery path drop their generation captures; the two toggle-off race tests are deleted with the teardown they exercised.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…robe fails

A failed runtime status probe maps to an empty capability list, which the sync read as "unsupported" and gave up on. The release only let a later Chat UI change try again, so one transient startup failure left chat tabs without live updates for the whole session. The sync now tells an unknown answer apart from a host that answered without the surface, re-asks unknown answers on its existing subscribe backoff, and stops only on a definite no.

@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: Advanced

Run ID: 2784c994-2699-40da-b057-c9c5109cc1ff

📥 Commits

Reviewing files that changed from the base of the PR and between 6bd3bb2 and 8ec3564.

📒 Files selected for processing (16)
  • src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
  • src/renderer/src/components/native-chat-resume-on-restart-store.ts
  • src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx
  • src/renderer/src/lib/activate-ai-vault-structured-session.ts
  • src/renderer/src/lib/structured-agent-session-launch-cancellation.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-recovery.ts
  • src/renderer/src/lib/structured-agent-session-launch.test.ts
  • src/renderer/src/runtime/local-structured-session-retired-epoch-repair.test.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync-chat-ui-off.test.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/inventory-publication-cursors.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/inventory-refresh.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/retired-epoch-repair.test.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/retired-epoch-repair.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts
  • src/renderer/src/runtime/local-structured-session-tabs-sync/subscription.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment on lines +89 to +90
if (!supported || !isCurrent()) {
return

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '30,175p' src/renderer/src/runtime/local-structured-session-tabs-sync/subscription.ts
sed -n '25,100p' src/renderer/src/runtime/local-structured-session-tabs-sync.ts

Repository: stablyai/orca

Length of output: 6474


🏁 Script executed:

git diff --no-ext-diff --unified=20 acf8e679ea694081862464be3cd2af8cb5059826 8ec35647b4c5cc93af6e77715b35e22041930f8c -- src/renderer/src/runtime/local-structured-session-tabs-sync/subscription.ts src/renderer/src/runtime/local-structured-session-tabs-sync.ts
printf '\n--- references and tests ---\n'
rg -n --glob '*.{ts,tsx}' 'startLocalStructuredSessionTabsSync|ensureLocalStructuredSessionTabsSyncRunning|runningSync|subscribeCurrent' src/renderer/src/runtime

Repository: stablyai/orca

Length of output: 13512


Release sync ownership when a retry finds no capability.

When the initial capability probe returns null, a later subscribeCurrent probe can return false. subscribeCurrent then resolves without creating a subscription, while startLocalStructuredSessionTabsSync has already returned true. The owner keeps runningSync, so the runningSync guard blocks a later Chat UI toggle.

Make subscribeCurrent report this unsupported result to its owner on every invocation. Release the singleton with sync.stop() when it does.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one edge in the new capability-probe retry.

Reviewed changes

  • Distinguished a failed capability probe from a host that answered without the structured surface: probeStructuredSessionSurface now returns boolean | null, and startLocalStructuredSessionTabsSync re-asks a null on its existing subscribe backoff instead of reading a transient startup failure as unsupported.
  • Added a backoff-retry test (three failed probes, then success) and a host-answered-without-surface test, and corrected the sync-latch comment.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

if (supported === null) {
throw new Error('structured_session_capability_unknown')
}
if (!supported || !isCurrent()) {

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.

The retry can land on a definite false here after the initial probe was null, but startLocalStructuredSessionTabsSync already returned true for the unknown case, so the caller's runningSync latch is never released and a later Chat UI change cannot retry. The sibling initial-false path releases the latch (line 53); this unknown→false sequence does not, so the earlier stuck-latch finding survives on this one path.

Technical details
# Unknown→false probe sequence leaves `runningSync` latched

## Affected sites
- `src/renderer/src/runtime/local-structured-session-tabs-sync/subscription.ts:48` — a failed initial probe is `null`, not `false`, so the function proceeds instead of releasing.
- `src/renderer/src/runtime/local-structured-session-tabs-sync/subscription.ts:53` — only the initial `supported === false` returns `false`.
- `src/renderer/src/runtime/local-structured-session-tabs-sync/subscription.ts:85-90` — the retry's fresh probe can return `false`; `subscribeCurrent` then returns without subscribing and without signalling the caller.
- `src/renderer/src/runtime/local-structured-session-tabs-sync.ts:56-61` — `runningSync` is cleared only when the returned promise resolves `false` (or rejects); it already resolved `true`.

## Required outcome
- A definitive `false` discovered on the retry must release the latch, or the initial unknown must not latch while the outcome is undecided, so a later Chat UI change can retry — the same guarantee the initial-`false` path already provides.

## Suggested approach (optional)
- `restoreLocalStructuredSessionTabsOnce()` already refreshes capabilities; re-reading `readLocalRuntimeCapabilitiesOrUnknown()` afterwards and returning `false` on a definite miss covers the common case, and giving `subscribeCurrent` a way to stop the sync when it concludes `false` covers a miss found only on a later backoff.

## Open questions for the human (optional)
- Is a host reporting no structured capability terminal for the session, or should the renderer keep the retry door open (e.g. after a runtime upgrade)?

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: code clean at 8ec35647b4, four product questions open

Four review loops ran; the last one found nothing to change. Readiness checks at the start and end both passed with nothing blocking. CI is green at 8ec35647b4.

Heads-up for #22934 (stacked on this branch): this branch received five new commits during review (fafb8d3c30, 6bd3bb2777, 4ff8f96927, 957a1ab40b, 8ec35647b4). #22934 needs a rebase onto 8ec35647b4.

What the review changed

  • fafb8d3c30: the resume-after-restart offer no longer starts the chat service at every launch for every Chat UI user. With no service running and no saved chat on disk, the host answers "nothing to resume" without starting anything.
  • 6bd3bb2777: the desktop chat-tab sync now releases its "sync is running" slot when it never actually subscribed. Before, a failed startup check left chat tabs frozen until relaunch.
  • 4ff8f96927: the renderer no longer pre-checks the resume offer; the host alone answers. This fixes a paired web browser with its own Chat UI setting off never offering the host's chats back after a restart.
  • 957a1ab40b: removes the tab-sync generation fence. Once the Chat UI-off teardown was removed, only a test reset could change it, so nothing in production could trip it. Its module is renamed to inventory-publication-cursors.ts.
  • 8ec35647b4: a failed startup capability check now counts as "unknown", not "unsupported", and the sync retries on its existing reconnect backoff (250 ms, capped at 5 s). It stops only when the host clearly lacks the capability.

Each fix has a test that fails without it. The PR description's "How it works" section is updated for the resume-offer change.

Live Electron QA (macOS dev build, background launch, separate profiles, real Claude)

Scenario Result
Profile with the old switch off: the key is stripped on load; a new Claude tab opens as a structured chat and replies Pass
New Codex tab opens as a structured chat Pass for opening. The reply could not be tested: the isolated test home had no Codex login (401). Not caused by this PR.
Settings: no structured switch; scope note, resume and shell-environment rows follow Default view Pass
Grok still opens as terminal-backed chat Pass
Chat UI turned off with chats open: tabs stay, Claude still replies, Codex closes cleanly, a new Claude tab is a terminal Pass
Restart with Chat UI off: the chat comes back with history and answers a new message; turning Chat UI back on adds no duplicate Pass
Fresh profile with Chat UI off: no structured tabs, hasLocalStructuredAgentSessions is false, Claude opens as a terminal Pass

01-claude-structured-ok
02-codex-structured-turn
03-settings-chat-ui-default
03-settings-terminal-default
04-grok-terminal-chat
05-tabs-stay-after-chat-ui-off
05-claude-replies-with-chat-ui-off
05-new-claude-is-terminal
06-claude-history-after-restart
06-chat-ui-on-no-duplicate
06b-restored-chat-replies-chat-ui-off
07-fresh-profile-claude-terminal

Not tested live: SSH, WSL, Windows, paired web, phones. For paired web, the code shows chat tabs arrive through the web client's own tab mirror, which has no Chat UI check.

Open product questions (need a decision before merge)

  1. No Orca CLI inside new chats. Ordinary structured chats get no orca on PATH and no orchestration identity. Only dispatched workers do. This PR moves every Chat UI user's new local Claude/Codex tabs from terminal-backed chat, which had both, to structured chat. So orca orchestration ... from inside those chats now fails. Workaround: set Default view to Terminal chat.
  2. Phone launches ignore Default view. With Chat UI on and Default view set to Terminal chat, the desktop opens terminals but a bare Claude/Codex launch from the phone opens a structured chat. The host's create-support check answers both "can this host create one?" and "should a default launch be one?". The desktop's explicit "Resume in chat" relies on the first meaning, so the host check can't simply be tightened. This already happened on main for opted-in users; it now reaches every Chat UI user.
  3. Auto-resume with Chat UI off. "Resume working chats automatically after a restart" still applies with Chat UI off, but its settings row is hidden then.
  4. Presence check before the desktop chat-tab sync. It works, but the cleaner long-term design is a chats-only feed owned by the host. That feed would answer empty without starting the chat service and push the first chat when one is created, removing the check, its IPC call and the latch. Proposed as a follow-up.

Known, not changed here

  • Declared out of scope: a host refusing after the desktop tab opens ends in a failed launch with Retry, not a terminal fallback. It now reaches every Chat UI user with a WSL-bound Claude account or a Windows install that can't read process start times.
  • Downgrading to an older build hides structured chats until the old switch is turned back on. No data is lost.
  • If the structured restore at startup throws, the app enters its "Session restore failed" no-save mode. That mode already existed on main, but only opted-in users could hit it; now any Chat UI user can. It is left unchanged because catching it locally could save a session with the chat tabs missing.

…ed-chat-default

# Conflicts:
#	src/main/persistence/applying-settings/terminal-settings-migrations.ts
#	src/main/persistence/loading-store/normalize-loaded-global-settings.test.ts
#	src/main/runtime/rpc/methods/session-tab-agent-status-projection.test.ts
#	src/main/runtime/rpc/methods/session-tab-agent-status-projection.ts
#	src/main/runtime/rpc/methods/session-tabs-inventory.ts
#	src/main/runtime/rpc/methods/session-tabs-structured-restore.test.ts
#	src/main/runtime/rpc/methods/session-tabs.ts
#	src/main/runtime/rpc/methods/structured-agent-session-admission.test.ts
#	src/main/runtime/rpc/methods/structured-agent-session-gate-classification.test-fixture.ts
#	src/main/runtime/rpc/methods/structured-agent-session-gate.ts
#	src/main/runtime/rpc/methods/structured-agent-session-hold.ts
#	src/main/runtime/rpc/methods/structured-agent-session-policy.test.ts
#	src/main/runtime/rpc/methods/structured-agent-session-policy.ts
#	src/main/runtime/rpc/methods/structured-agent-session-restart-resume.test.ts
#	src/main/runtime/rpc/methods/structured-agent-session.test.ts
#	src/main/runtime/rpc/methods/structured-agent-session.ts
#	src/main/runtime/rpc/methods/structured-session-tab-restore.ts
#	src/main/runtime/structured-agent-session-integration-replay.test.ts
#	src/main/startup/main-process-ipc-bootstrap.ts
#	src/preload/api/app-api.ts
#	src/preload/api/app-bridge.ts
#	src/renderer/src/app-shell/use-app-startup-hydration.ts
#	src/renderer/src/app-startup-routing.test.ts
#	src/renderer/src/components/NativeChatResumeOnRestartModal.tsx
#	src/renderer/src/components/settings/ExperimentalPane.test.tsx
#	src/renderer/src/components/settings/NativeChatExperimentalSetting.tsx
#	src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx
#	src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.tsx
#	src/renderer/src/hooks/composer-state/full-submit-preparation.ts
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/fr.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
#	src/renderer/src/lib/agent-launch-routing.ts
#	src/renderer/src/lib/native-chat-initial-view-mode.ts
#	src/renderer/src/lib/structured-agent-session-launch-recovery.ts
#	src/renderer/src/runtime/host-session-mirror-settle-census.test.ts
#	src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts
#	src/renderer/src/runtime/local-structured-session-tabs-sync.ts
#	src/renderer/src/runtime/local-structured-session-tabs-sync/inventory-generation-fence.ts
#	src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts
#	src/renderer/src/web/preload-api/web-app-api.ts
#	tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
@brennanb2025 brennanb2025 changed the title feat(native-chat): make structured chat the only Chat UI runtime Make Chat UI the single default for structured agent chats Oct 8, 2026
…verage

Chat composer model and effort no longer become CLI flags on terminal
launches, since a new launch can no longer open in the terminal chat
view; structured launches seed their own options. Restores dropped
route coverage, including that an explicit resume-in-new-chat request
stays available while Chat UI is off.
…rage

The test expected chat composer model and effort on a codex launch with
Chat UI on, but its mocked host has no structured capability, so that
launch is the terminal fallback that must not carry them. It now checks
the fallback with Chat UI on and off, with shipped and stored arguments;
structured creates are covered where the seed is applied.
@brennanb2025

brennanb2025 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Today’s scope: Experimental on/off remains; supported new native chats default to structured, with no chat-type selector. Regular settings and the tip are deferred.

Final head: 73fba25554b, mergeable. Integrated current main 3e27e62f434. The restart-modal test conflict retains main’s fixture and session-list assertions, replacing retired setting references with experimentalNativeChat; the new shared fixture uses it too. Fresh Opus review approved with no findings. Clean-cache node/web typechecks passed, 15 targeted files passed 1,650 tests with one skip on pinned Bun 1.4.2, and all 22 static checks passed. Final readiness without counsel passed. CI was green on 1b24297a04e and has restarted for this push; it was not awaited. Nothing was merged.

Enabling Chat UI previously left two other choices that could still open a new agent as terminal-backed chat. This PR gives ordinary launches one rule: on opens structured native chat where supported; off or unsupported opens the agent terminal. Saved chats and explicit chat actions remain usable with the switch off.

A fresh Claude Opus 5.5 high review loop included an issue-first architecture challenger, reviewers for distinct areas, and fresh reviews of the fixes. The confirmed P2 fix keeps chat-composer model and effort choices out of terminal fallback launches. Telemetry and stale launch expectations were corrected, and meaningful routing coverage was restored. Proposed preference gates on explicit resumes were rejected because the switch controls defaults. Compatibility fields remain; minor cleanup and older-client recovery behavior are deferred.

Previous reviewed head: 1b24297a04e. Scoped node/renderer typechecks, 22 static checks, and readiness without counsel passed. Recorded tests include 385 across 33 route-focused files, 268 caller tests, and 35 structured-seeding tests. A broader 85-file combined-stack run found a stale caller assertion and an old-local-Bun load failure; the corrected caller file passes 60/60, and the runtime file passes 1,338 with one skip on pinned Bun 1.4.2 and Node. A completed CI shard also found a stale listener-budget assertion: retiring the per-pane Chat UI read reduced the measured count from 16 to 15. The corrected exact budget and 20-pane limit are stricter; its four tests and seven related lifecycle tests pass, with fresh delta review and readiness approval. The final CI snapshot has all unit shards and static checks passing, with one SSH end-to-end failure: initial connection reports “Resulting promise was garbage collected.” A fresh reviewer found no changed PR code on that path; the screenshot shows a live remote terminal, but the exact cause is unresolved because the harness captured no app logs. One fresh run of that isolated CI job passed. The final snapshot has 38 successful checks and 18 skipped, with no failures; CI was not watched or waited on. No speculative app change or in-test retry was added.

Combined M4Air QA and screenshots verified ordinary New tab launches with stand-ins: off creates a terminal tab; on creates an agent-session chat. It checked app code at 6f242540724. Subsequent test corrections and the final integration of newer main were not followed by another rendered UI pass. The stand-in exits, so this establishes routing, not a signed-in conversation. Live providers, Windows, Linux, WSL, SSH and mobile rendered flows were not exercised.

Updated release scope: #22933 can ship independently today. The on/off switch stays in Settings → Experimental; there is no terminal/structured or default-view picker, and supported ordinary new launches use structured chat when enabled. Existing saved chats stay usable. #22934 and #26540 are held as drafts; they must first ship together in the later regular-settings graduation update. #26336 is already merged.

The explicit-chat change retired the per-pane Chat UI setting read, so
each mounted pane opens one fewer store listener. Pin the budget to the
measured count and count that read among the saved listeners.
@brennanb2025 brennanb2025 changed the title Make Chat UI the single default for structured agent chats Default experimental native chat to structured chat Oct 8, 2026
…ed-chat-default

# Conflicts:
#	src/renderer/src/components/NativeChatResumeOnRestartModal.test.tsx
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