Skip to content

fix(session-tabs): open a new workspace on its agent for every viewer that has not picked a tab - #29204

Closed
brennanb2025 wants to merge 425 commits into
brennanb2025/unify-row1-first-surfacefrom
brennanb2025/unify-row2-creation-tab
Closed

brennanb2025 wants to merge 425 commits into
brennanb2025/unify-row1-first-surfacefrom
brennanb2025/unify-row2-creation-tab

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you create a workspace from your phone with an agent (say Claude with the chat view) in a repo that has a setup script, Orca should open that workspace on the agent's chat: on the phone that made it, on any other phone, and on the desktop when you later open it there. Instead every screen opened on the "Setup" tab and stayed there, even after the chat appeared. With this PR, any screen that hasn't chosen a tab in that workspace yet shows the agent, worked out by one shared rule. As soon as you pick a tab yourself (including tapping or clicking Setup when it's already showing), that pick sticks, through later updates, saves and restarts. Creating a workspace from the phone still never moves the desktop.

Supersedes #28985 (tracked in #28985). Stacked on #29095.

What Changed

The problem, as Brennan saw it. Creating a workspace from the iOS app with Claude and the chat view landed on a plain Setup terminal instead of the chat (M4Air QA round 3 on main afea81ba789: screenshots 29204-before-phone-03-created and 29204-before-06-desktop-opened-greenling). Two things combine:

  • The creation makes the Setup tab first and the agent's tab after it, and nothing activates the agent for a phone create. So the workspace's "active" tab is Setup.
  • Every screen that hadn't picked a tab treated whatever it was showing as if you had picked it. The phone's host remembered the Setup it fell back to; the phone app let the tab it last displayed outrank the host (mobile/src/session/active-session-tab.ts:resolveActiveSessionTab); the desktop saved its shown tab as its selection. So once Setup had been shown, the chat arriving a moment later never replaced it.

The structural fact: a default that was only shown was stored as if it were the viewer's choice.

Before / after, as the user sees it

  • Phone creates a workspace with an agent chat or agent terminal: before, Setup, and it stayed on Setup. After, the phone shows Setup only until the agent's tab exists, then the agent.
  • A second phone, or a desktop connected to a remote server, opening it: before, Setup. After, the agent.
  • The desktop opening it later, including after a restart that happened before the chat existed: before, Setup. After, the agent. The desktop's current workspace and tab don't change when the phone creates it.
  • Tap or click Setup on any screen (also when Setup is already showing): it stays on Setup on that screen from then on, across later updates, saves and restarts. Other screens are unaffected.
  • Workspaces created without an agent, and every screen that already has a pick, behave as today.

Mechanism

  • One pure rule in src/shared/workspace-creation-tab.ts (resolveWorkspaceViewerTab): a viewer's explicit choice while that tab exists; with no choice, the first tab running the agent the workspace was created with (createdWithAgent, already saved); otherwise the viewer's existing fallback. Its result is only ever shown, never recorded as a choice.
  • Host, per paired device (ClientSessionTabSelectionStore.project): uses the rule only for a device with no recorded pick (the store's existing shouldPersist flag). The fallback it caches for a device is still never saved or promoted to a pick. The workspace's createdWithAgent is read on the workspace's own host, for worktrees and folder workspaces, and list and subscription go through the same projection.
  • Phone app: on a snapshot the host projected for this device (its publication epoch ends in :client-navigation), the app follows the host's active tab instead of the tab it last displayed. A tap still waiting for the host to record it wins until it lands. Placement of new tabs is unchanged.
  • Desktop window: it keeps its own tab choices in memory (desktopTabChoices). A workspace gets one when you click a tab in the tab strip, switch tabs by keyboard or number shortcut, or open a tab from the palette; when you create a tab yourself (the "+" button, the new-tab menu and shortcuts, a new terminal from the explorer, any file you open from the explorer, search, a link or quick open, an agent you launch from "+" or another menu); or when a saved selection is restored. Automatic creates never record one: seed and Setup tabs, default tabs, adopted or restored terminals, and the chat or terminal the host publishes for the creation. For a workspace without a choice:
    • reconciliation fills a group that has no shown tab from the rule before falling back to the first tab;
    • when the agent's chat arrives from the host, it goes through the existing focus-intent projection, so group, tab and visible tab type change together, only in that workspace;
    • when the agent's terminal arrives as a background tab, it is shown in place;
    • the session save writes no shown tab for it, so a restart before the agent exists can't turn Setup into a pick;
    • the layout-owner build (not shipped yet) fills its frame slices the same way, from the view the window reads back from its save.
  • A paired device's agent launch never activates the chat on the host window; a create from a phone records nothing for the phone either, so it gets the same default as every other screen. Launches into an existing workspace still select the new tab for the phone that asked, as before.

Why

The earlier version of this PR picked the tab imperatively in the desktop renderer: it activated the creation tab during create, seeding and reconciliation, threaded a "don't record focus" flag through each create path, and guessed whether Setup had been picked from focus timestamps. Every change to creation on main (Setup in its own tab, background agent creates, the layout-owner move) broke another guard, and the phone suite started failing on optimistic placement and prompt delivery. This version follows the common pattern instead: the tab inventory is shared, each screen's selection is its own, and a default is computed when it's read. That removes the whole class: nothing races at create time, nothing needs a per-call flag, and a shown default can't harden into a pick. It needs no new saved field, RPC method, stream operation, capability or minimum server version.

Intended differences

  • Older phone apps and older desktop windows (intended; never worse than main). On main, a workspace created from the phone lands on Setup and stays there when the chat publishes (the QA screenshots above), because resolveActiveSessionTab lets the last displayed tab outrank the host's active flags. With this PR's host, an older client gets the agent chat on a cold open, or on a create that resets its selection first (use-mobile-session-startup.ts). An older client that is already showing the interim Setup stays on Setup, exactly as on main. The same holds for an older desktop window connected to a new remote server. Fixing that would need a forced navigation broadcast or a minimum client version, which this PR deliberately doesn't add.
  • Older servers (intended). A new phone paired with an older server reads that server's per-device projection as before; a server without per-device projection keeps the phone's old reader. No upgrade is required.
  • "Created for" is the first matching tab (intended). The agent's tab is found as the first tab running the workspace's creation agent, not a saved marker. If you add a second tab of the same agent and drag it in front, an unpicked screen shows that one. Closing the agent's tab falls back to the next match or the old fallback; nothing is left behind to retry.
  • A remote desktop doesn't move live to an arriving creation terminal (temporary). A desktop connected to a remote server that is already showing the interim Setup when the creation's agent terminal (not chat) arrives stays on Setup until it next opens the workspace; a cold open shows the agent. Main behaves the same way. Follow-up: give that desktop's web-session sync the same arrival projection for terminals that this PR gives chats (arrivingCreationChat in apply-preparation-base.ts); no ticket filed yet.
  • A window closed while the phone creates (intended; equal to main). If the Orca app is running with its window closed when a phone creates a workspace, the app's main process saves that workspace's layout itself, and the window restores Setup as if it were a choice when it reopens. Main does the same.
  • Setup can show before the agent exists (intended). While the agent's tab doesn't exist yet, a screen shows Setup; that alone never becomes a pick on an updated client.
  • resolveWorkspaceSelection is unchanged (intended). Its only caller reads pane selection, not the shown tab; the layout-owner build's shown tab comes from buildLayoutFrameSlices, which uses the rule.

Linked Issue

N/A — maintainer PR (design-panel ruling for row 2). Supersedes #28985 (tracked in #28985).

Visual Proof

Pending — real QA on a gate-admitted machine follows on this head: phone Claude chat create, creating phone and a second phone on the chat, desktop still where it was, desktop later opening on the chat, and an explicit Setup that sticks.

Testing

  • src/main/runtime/client-session-tab-selection.test.ts: one flow for an agent chat and an agent terminal: Setup first, agent later; the creating phone and a second phone resolve to the agent; Setup picked before and after the agent arrives sticks across later snapshots and a host restart; no creation agent and a closed agent tab fall back as today. Fails without the change.

  • src/renderer/src/store/slices/tabs/desktop-tab-choice.test.ts: the desktop saves and restarts while only Setup exists, the chat arrives, and the workspace shows the chat with group, tab and type together while the window's own workspace and tab are unchanged; a click on the already-shown Setup sticks through the arrival, another save and restart, and the layout-owner build's frames; a terminal the user then opens is where a restart reopens, as on main. Fails without the save change or without the arrival projection.

  • mobile/src/session/use-mobile-session-tab-application-launch.test.ts: interim Setup gives way to the agent while unpicked; a pending tap on Setup wins; an older server's snapshots keep the old reader.

  • agent-launch-caller-selection.test.ts: a phone's create activates nothing on the host and records no pick.

  • Ran locally on macOS through the test queue: the touched main suites, 157 renderer test files around tabs, session save and hydration, web session sync, activation and the tab commands, and 90 more around file opens, tab creation and agent launches. The mobile suite and the full workflow run in CI.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

This branch now carries current main; until #29095 takes the same main, the diff against its base also shows main's commits since #29095's last merge. The merge ran the pre-commit formatter over files main had left unformatted, so about 20 unrelated files under src/main show whitespace-only changes.

Author: @BrennanKB5

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)

nwparker and others added 27 commits October 17, 2026 21:00
…dow does (dark) (#30166)

* fix(sidebar): main takes its row baseline from the session's catalog and skips unchanged listings

* fix(sidebar): read catalog listings the way the window's merge does

* fix(sidebar): a seeding listing re-samples, and listings compare with the window's equality
…overflow (#30157)

* fix(tasks): bound GitLab all-projects fan-out to avoid runtime queue overflow

The GitLab Tasks list started one listIssues/listMRs runtime RPC per selected repo at once. With 150+ projects this, combined with other callers on the same selector, overflowed the runtime RPC call queue and surfaced "Remote runtime call queue is full".

Fetch per-repo lists through mapSettledWithConcurrency with a limit of 6 (below the queue's foreground concurrency of 8), and stop starting new calls once the selection goes stale.

Fixes #30133

* test(tasks): assert merged GitLab rows without a type assertion

---------

Co-authored-by: Neil <[email protected]>
…space's id on save and from the first frame (#30172)

Sessions saved before #29930 can hold a moved editor tab whose
worktree id still names the workspace it came from. Pin that the
saver writes the workspace's own id and that the window's tab carries
it after main's first snapshot. Tests only.
…nst the window (dark) (#30184)

* feat(sidebar): main produces the local workspace rows, checked against the window (dark)

* fix(sidebar): workspace rows invalidate the listing only on metadata saves; prove it on the real cache

* fix(sidebar): workspace rows merge the listing fresh instead of invalidating the shared cache

* chore(sidebar): workspace rows comments say what the fresh merge reads
…k, layout-owner build only) (#30174)

The chat, simulator, and browser tab recorders each computed where the window
drew a just-opened tab with the same lines. They now share drawnTabPlacement.
…dark, layout-owner build only) (#30177)

* feat(layout): main drops the layout of workspaces the catalog no longer validates (dark, layout-owner build only)

* rename the paired-host check so the switch-off bundle keeps its names

* a repo id two hosts register skips the listing purge
#30187)

A managed SSH or paired-server workspace has no SSH connection id, so the
notebook read it as local and ran its cells in the desktop's own Python
against a same-named local file. Derive the execution host from resolveOwner;
refuse remote, ambiguous and unloaded owners.
…e host's id (#30190)

worktree.detectedList built its rows from the raw Git scan, so a folder project upgraded to Git
was published under Git's spelling (C:/x) while the host keyed its metadata and terminals by the
folder's (C:\x). Apply preserveFolderUpgradeWorktreePath at the runtime listing scan every
runtime listing reads.

Fixes #30150
* chore(deps): remove unused desktop and mobile declarations

* fix(deps): retain parser used by historical-release tests
…idebar (#30194)

* fix(worktrees): keep a CLI-created worktree out of listings until its metadata is saved

A watcher-driven listing during `git worktree add` surfaced the new checkout as a bare
external row. The host's default-terminal request then made that stale row active, so it
slipped past Hide sleeping and Hide CLI-created until the next refresh hid it (~1s flash).

* fix(worktrees): hold canonical checkout paths during creation
… joining an existing server (#30189)

* fix(ssh): move the open workspace to the server's linked project when joining an existing server

* fix(ssh): follow the active repo and detected checkouts when rehoming a linked workspace

* fix(ssh): treat a missing server row as unknown, and keep watching for it
…o a big saved buffer no longer blocks a host's move (#30126) (#30188)
…0149)

* perf(typecheck): pnpm tc uses the pinned Bun checker when available

bun check (Bun 1.4.3, TypeScript 7.0.2 parity, already used by CI) checks the
node project in ~29 CPU-s / ~2 GB peak vs tsc's ~98 CPU-s / ~16.6 GB. tsc's
incremental cache rarely helps agents: noEmit builds store no declaration
signatures, so the first edit to any file after a cold check re-checks every
transitive importer (a comment in src/shared/constants.ts re-checks all 18k files).

pnpm tc / tc:node / tc:web / tc:cli now pick the Bun from config/.bun-version when
it is on PATH and fall back to tsc with a one-line hint otherwise;
--compiler=native forces tsc. The pinned-Bun probe is shared with the
localization extraction check.

* build: pin Bun as a devDependency and make it the only default checker

The PATH probe left anyone without the exact pinned Bun (including a 1.4.2
global) on tsc's expensive path. [email protected] is now a devDependency, its
postinstall is allowed, and pnpm tc / typecheck:ci run that binary. A missing
binary is an error pointing at pnpm install rather than a silent fallback;
--compiler=native still selects tsc. A test keeps the devDependency equal to
config/.bun-version.

* ci: link the pinned Bun after the script-free install

--ignore-scripts leaves node_modules/.bin/bun as bun's postinstall stub, so the
typecheck runner found no binary and any pnpm-run script calling bun would hit
the stub before setup-bun's copy. pnpm rebuild bun runs only that allowed build.
* security: ship a locked skills installer instead of running npx

* chore: remove retired skills process import exception

* test: include the locked installer in packaged layout fixtures

* test: reuse the real installer builder for package fixtures
…cannot launch (#30204)

* fix(startup): shell PATH probe falls back and retries when the shell cannot launch

* chore: drop hydrate-shell-path from the process-host direct-import baseline
…ile record (dark, layout-owner build only) (#30197)

* fix(layout): a reopen that rewrites an open tab's file record reaches main (dark, layout-owner build only)

* fix(layout): compare reopened editor records without a new renderer import
…yout-owner build only) (#30178)

* fix(layout-owner): main repairs a terminal stored in two panes once at startup, after moving the dropped pane's owners (dark, layout-owner build only)

* fix(layout-owner): the load repair moves the dropped pane's records and skips the write when an owner move fails (dark, layout-owner build only)

* fix(layout-owner): the load repair leaves a paused WSL move's workspace untouched (dark, layout-owner build only)
…ut-owner build only) (#30176)

* feat(layout): main records a workspace's default-tabs mark from the window (dark, layout-owner build only)

* fix(layout): record the default-tabs mark after the tab creates it covers (dark, layout-owner build only)

* test(e2e): strict default-tabs mark and exact tab count across a crash (dark, layout-owner build only)
…dark, layout-owner build only) (#30206)

A restored tab re-owned inside its own workspace now tells main through
renameEditorFiles with the file's new record; main skips it for paired servers.
Main's load, save, close and tab-host read an editor tab's file by its owned id
as well as its path, behind the layout-owner switch.
Jinwoo-H and others added 22 commits October 19, 2026 03:21
)

* feat(native-chat): choose which agents open as a chat

Settings → Chat gets a Providers list. Each agent the host can open as a chat
has a switch; off opens that agent in a terminal instead. Only choices the user
makes are saved. Unchosen: Claude and Codex on, others on when their CLI is
installed on this computer.

The renderer's route and the host's launch-mode decision both read one rule, so
the tab menu, shortcuts, CLI, orchestration and relayed phone launches agree.

* fix: keep chat provider settings with the other chat settings types

* test: route input carries this computer's detected agents

* feat(native-chat): the + menu shows chat, disabled chat and CLI rows

With Chat UI on, each agent whose chat provider is on gets a chat row, disabled
with the reason where the workspace's machine can't run that chat (not
installed, SSH, WSL, not on this host). Every other installed agent gets a row
marked (CLI) that opens its terminal. With Chat UI off, or on an older server
that opens no chats, the menu is unchanged.

* fix: new tab menu rows use a launch variant instead of restyling the menu item

* fix: name every route blocker the menu rows map

* fix: menu row subscriptions render on the server too

* feat(native-chat): open a chat agent's CLI from beside its + menu row

A chat row whose CLI is installed on the workspace's machine gets a › beside
it. Its side menu offers '<Agent> (CLI)', which opens that agent's terminal for
this launch only; nothing is saved and the row itself still opens a chat.

* fix: keep new tab agent surfaces authoritative

* fix: handle unknown host support reasons

* fix(chat): resolve provider choices from their owning computer

* fix: include chat launch feedback translations

* test(chat): use checked native inventory fixtures

* chore: retrigger PR checks

* test: pin pending chat row behavior

* chore: retrigger PR checks after cancellation

* Fix launch preparation lifetime and execution host startup

* fix: keep agent menu choices bound to their launch

* Simplify agent menu support reads and preserve explicit surfaces

* Keep focused menu behavior coverage within its budget

* Keep menu host fixtures typed as execution hosts

* Assert notes payload on the current launch action

* Combine agent session launch type imports

* fix(chat): keep unchosen providers on without discovery

* fix(chat): use workspace installation for menu defaults

* test(chat): type provider routing fixtures against store contracts

* fix(tab-bar): keep + menu chat rows clickable while the host answers

Each menu open discarded the host's answers, so every open showed the chat
rows disabled with 'Checking chat support' until the host replied. Answers
now outlive the menu and refresh in the background, rows use this client's
facts until the host answers, and a slow host no longer reads as a refusal.

* test(chat): align shared launch fixture with private settings reader

* fix(tab-bar): keep known + menu refusals and never treat a silent host as one

Closing the menu dropped the workspace's agent list, which changed which agents
the menu asks about and threw away the host's earlier answers, so a reopen showed
a refused chat as clickable. A support read that could not answer was stored as
"No chat on this host", disabling chats the client knows are supported.

The menu now keeps the stored agent list while closed (only fetching waits for
it to open) and only a real host answer relabels a row. The workspace's
detection target is resolved where main already resolves it (QuickLaunchButton
and the tab-bar runtime model) and passed in, so no new focus read is added.
Tab-bar test mocks now stub the QuickLaunchButton exports the menu imports.

* fix: sync runtime English catalog for agent menu

* test(chat): give the structured-session RPC fixture the private settings reader

The host now reads saved chat choices through requireStore().getSettings(); the
shared RPC fixture only had getClientSettings, so the launch-mode reader saw no
settings and create support refused Claude. The fixture now follows each test's
client settings.

* test(chat): pin create support's options argument and kept decline reason

* fix(native-chat): + menu chat rows wait disabled for the host and share its answer across tab groups

A chat the host refuses showed clickable for up to the 10s host read, then flipped to disabled,
once per tab group. Rows now stay quietly disabled until their host answers (or the read times
out), and every tab group on the same workspace host reads the same answers.

* fix(native-chat): + menu rows also wait before the host's chat list loads, and on every reopen of a host that could not answer

Asking the host no longer waits for its chat list, so Claude and Codex no longer show clickable,
then disabled, while it loads. A read that times out releases rows for that open only, so the
next open waits again instead of flipping on a late refusal. Agents not installed skip the read.

* fix(native-chat): typed + menu search puts a launchable row ahead of a disabled chat

In a WSL workspace, typing an agent's name and pressing Enter highlighted its disabled chat row,
so nothing launched where main opened the CLI. Search now ranks rows that can launch first.

* fix: preserve provider choice and cached native inventory

* feat(native-chat): hosts publish each workspace's chat availability as one stream

A new negotiated stream, agentSession.subscribeAvailability, advertised as
agent-session.structured.availability.v1. The host keeps one in-memory resource per
workspace, shared by every reader, that asks the existing createSupport check for every
registered agent in that workspace and publishes only complete generations. It answers
again when a launch setting changes, after an explicit agent refresh, and (for answers
that could not be checked) when a workspace appears; the last reader leaving retires it.
A check that could not answer is unknown, never a refusal. agentSession.agents stays
static and unchanged.

* feat(native-chat): + menus read a publishing host's workspace availability

The renderer holds the workspace's availability stream while its tab bar is mounted
(not while a menu is open), shared by every tab group, with runtime and contact fences.
It exposes a readiness model, { ready: false } | { ready: true; byAgent }, from
useHostStructuredAgentAvailability and the menu hook. On a host advertising the
capability the menu reads its answers from that model and makes no per-agent
createSupport reads; an older host keeps the per-agent reads, answer cache and deadline
unchanged. Row building and presentation are unchanged.

* fix(native-chat): workspace availability checks only what the shown workspace needs

Only the shown worktree (or an open menu) holds its host's availability stream, and only with Chat
UI on. Display checks no longer force a fresh login shell for an agent that isn't installed, so
Claude and Codex answer without waiting on it. A change to the Windows runtime default or a project's
WSL choice re-checks, and a workspace still on its first check answers again when one appears.

* fix: keep main's bytes for the create-support file the merge reformatted

The pre-commit formatter rewrapped main's unformatted lines during the merge and pushed the file past its line limit.

* test: type the + menu rows hook mocks without assertions

* test: match the availability stream's types in three tests

* test(cross-version): declare the workspace availability stream in the agent-session surface

* feat(native-chat): + menu holds a placeholder until its agents are known, and learns them while the workspace is shown

* feat(native-chat): + menu reads one agent health snapshot per machine

The + menu no longer checks chat availability per workspace. Each Orca
runtime keeps one agent health snapshot: every agent's location rule on
this machine plus a typed observation of its installed release, probed
in the server's own home. It is taken on first use and replaced only on
a launch setting change, an explicit agent Refresh (after a fresh shell
capture), or a restart, and kept without readers.

- The version probe reports supported, unsupported or inconclusive; a
  launch still refuses an inconclusive run, while the snapshot reads it
  as unknown rather than a refusal.
- agentSession.subscribeAvailability takes no params and publishes that
  snapshot; a replay that closes the transport releases its reader.
- The renderer keeps the snapshot per host, runtime and pairing, through
  lost contact and across workspace switches on the same host.
- The menu hook drops the per-open createSupport display reads, their
  deadline and answer cache; older hosts show client facts and the
  click's admission, unchanged, states any refusal.

* fix: a failed shell recapture still publishes the agent health snapshot

* fix(native-chat): capture fresh shell facts for every health snapshot

* fix(tab-menu): share settled agent actions across menu surfaces

* fix(tab-menu): preserve loading row line height

* feat(native-chat): the whole chat row opens its CLI submenu

Hovering a chat row in the + menu, or pressing ArrowRight on it, now opens
the "<Agent> (CLI)" submenu to the right instead of needing a separate
chevron button. Clicking the row, or Enter/Space, still starts the chat
and closes the menu; hosts pass closeMenu since a submenu trigger never
closes the menu on its own.

* fix(tab-menu): line the CLI submenu up with its chat row

* feat(native-chat): a chat row's terminal button opens its CLI

Clicking a chat row in the + menu starts a chat. Hovering the row (or
pressing ArrowRight on it) reveals a terminal button at its right edge that
opens the agent in a terminal instead. This replaces the submenu, whose
chevron made the row look like it only opened a submenu. The button's click
bubbles into the row, so the menu closes as for any item and the hosts no
longer need a closeMenu callback.

* fix(native-chat): the chat row's terminal button handles drags, arrows and screen readers

A press on + dragged onto a chat row's terminal button and released there
now opens the CLI: the row reads whether the pointer or focus is on its
button instead of the click target, which a drag-release never sets.
Arrow, Home and End keys pressed on the focused button move between rows
as they do on the row. The row is announced as "Start a <Agent> chat"
instead of including the button's label.

* fix(native-chat): chat rows read "Start a chat with <Agent>"

"Start a OpenCode chat" was ungrammatical for agents whose name starts with a vowel.
…desktop data link (#30607)

* fix(mobile): recover a relay that died during an app switch in one short probe, and retry an attach timeout through the director once

Refs STA-11130.

Co-Authored-By: Claude <[email protected]>

* fix(mobile): redial the same cell once on attach-timeout instead of re-resolving

Aligns with the relay step 6 design: reason string attach-timeout, no director
re-resolve (the director names the cell the host is seated on).

Co-Authored-By: Claude <[email protected]>

* fix(mobile): probe decisively only on a real background return, 4s, and jitter the attach-timeout redial

Co-Authored-By: Claude <[email protected]>

* test(mobile): replace type assertions with a typed fake in the relay probe tests

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
…x config strips command environment variables (#30406)

* fix(codex): a Codex chat's commands keep its Orca identity under a restricted shell environment policy

Codex rebuilds each command's environment from the user's shell_environment_policy, so
inherit = "core" dropped the chat id, marker, launcher and instance pin Orca gives the
app-server. orca orchestration then could not tell which chat was calling.

Every thread start and resume now sends those values as shell_environment_policy.set
overrides, which Codex applies after its filter and merges per key.

* fix(codex): accept the launch's read-only delete list

* test(codex): a chat without visuals gets no visuals config, identity overrides aside

* refactor(codex): a chat's command env is what the seal wrote, not a second key list

The seal now returns the session values it set (identity, a registered worker's own handle, the CLI launcher, the instance pin and the blanked remote selectors) as commandEnv, and the composed launch carries it. The Codex acquire sends that plus the chat's scratch folder from its own visuals. This deletes the hand-kept key list, the handle prefix test and the delete-list re-check, so a key later added to the seal reaches each command too, and an inherited worker handle the seal never named no longer does.

* test(codex): wait for the shell command's turn to complete before the cold resume
* fix(agent-status): never drop a running helper for lack of room

Helper state (subagents, background tasks and commands) was bounded by counts and byte budgets that refused or evicted live records once hit, so the agent kept working while Orca listed it wrong. Every one of these records already dies with its session, pane or chat, so the count and size caps go; identity-history, transcript and transport bounds stay.

* fix(agent-status): keep the status field limit, measured without the subagent roster

The previous commit dropped the 256 KiB status check outright; it still guards every other field. Only the roster, whose rows are bounded individually, is left out of the measurement.

* fix(agent-status): fit helper previews and walk lineage once

* fix(agent-status): skip an oversized Pi row instead of stopping, and parse every envelope the store can write

Review follow-up: one long row no longer hides later rows that still fit the request, and the transport envelope's reader no longer refuses a size its writer now produces.
* fix(sidebar): Sleep stops a workspace's native chat agents

Sleeping a workspace stopped terminals and browsers but never its structured (native)
chats, so their claude/codex process kept running, and Sleep was disabled for a
workspace whose only content was a chat.

Sleep now stops each chat's agent through a new agentSession.sleep (the host's close,
keeping the tab), routed to the host recorded on the chat's tab; an older host without
the capability fails Sleep with a clear message. The Sleep menu counts a chat.

* Fix native chat Sleep ownership and delayed teardown

* Stop native chat sessions when sleeping their workspace

* Fix sleep teardown wake and host-qualified receipt races

* Verify mobile Sleep sends the selected desktop host

* Keep worktree Sleep RPC within method file limit

* Use sleep intent as attempt identity

* Gate workspace sleep on structured client support

* fix(native-chat): preserve sleep stop receipts and send timing

* fix(native-chat): keep superseded workspace sleeps quiet

* fix(native-chat): ignore superseded failed sleep stops

* Fix sleep lifetime test resolver types

* Accept workspace Sleep for already ended chats

* Sleep native chats through the shared no-toast sleep core

Main split runSleepWorktrees into sleepWorktreesReportingFailures (no toast) and
a toasting wrapper. Move the native chat stop, host routing and typed failures
into the shared core so the WSL move's Sleep request also stops chats, and
report every workspace not verifiably slept (an unconfirmed chat stop included)
in failedWorktreeIds. Fold one ACP adapter field onto a line so main's file plus
this PR's ownership check stays within the file length limit.

* Import isStructuredTab from its shared module

* fix(native-chat): leave chat rows to their host through Sleep

Sleep's worktree status drop deleted the chat's row, which the host feed then
rewrote, so the outcome depended on which write landed last. Open chat tabs
own their rows (same rule as terminal-tab close), and a chat only makes a
workspace sleepable while its host holds the agent's process.

* fix(native-chat): judge the Sleep receipt by facts, not lane occupancy

A running chat's stop queues the provider's own requested-close end report
onto the chat's lane, so the lane-occupancy check read every proven stop as
superseded and dropped its receipt. Later work now counts only once it
exists: a moved fence, a child, delivery, child work, a pending submission,
a pending create or attach, or an open dispatch.

* test(native-chat): report a fake close's end only for an acquired child

* Preserve canonical workspace identity when sleeping

* Propagate optional sleep host through file command contract

* Move the deliberate-sleep PTY tests to main's spec file

Main grouped the PTY connection suites (#29193) and moved this file to a .spec.ts registered from pty-connection-spawn-and-startup.test.ts. Taking main's copy here keeps the following main merge free of a modify/delete conflict; this PR's test changes are reapplied after the merge.

* Reapply Sleep's teardown waits to the moved PTY spec; keep acquisition under its line limit

The deliberate-sleep spec moved in #29193; this carries the PR's changes into it: a pane mounted after wake waits for issued teardown, an unqualified pane waits for every same-id host's teardown, and a queued startup waits too.

The merge left claude-structured-session-acquisition.ts over 300 lines. resolveClaudeAcquisitionError, which already builds the exit-unproven error, now decides whether to release the acquisition.

* test: keep the Sleep receipt checks on the closed handle and kept record

* fix(sidebar): a single-workspace Sleep failure says workspace, not workspaces

* fix(sidebar): Sleep stops a workspace's chats on every host that has a copy

* test: drop redundant casts from the Sleep flow test state

* fix(sidebar): stop a workspace's chats after its terminals, leaving main's teardown owner check as is

* fix: admit workspace chat stops before teardown waits

* fix: retain browser teardown caller sequencing

* fix: retire failed acquisitions after observed root exit
…xisting-only (#30609)

A reserve cell keeps no activity rows and its ledger stamps last_activity_at, so the
stranded rule read its connected hosts as unserved and re-placed them.
#30616)

* fix(persistence): repo writes take the row's identity, never a bare id

updateRepo(target, updates) now takes Pick<Repo,'id'|'connectionId'|'executionHostId'>
(RepoHostTarget) and resolves the host from it, so a caller that holds the row can no
longer drop its host and write a same-id sibling on another host. The id-only callers
(project host setup controller and IPC handler, folder-to-Git upgrade watch, both
clone paths, registration adoption, fork backfill) pass the row they resolved.

Co-Authored-By: Claude <[email protected]>

* test: migrate the remaining Store.updateRepo callers to row targets

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
)

* plugins: name the shared catalog and manifest schema parts

Pure refactor. Marketplace entry/header fields and the duplicate-category
and duplicate-id checks become named pieces, the bounded catalog JSON read
is split from schema parsing, and the v1 manifest object is named apart
from its refinement, so a second catalog file and manifest version can
reuse them.

* plugins: share the plugin tree-identity check

Pure refactor. Install integrity and instructional-content checks each
inlined the full-hash-or-legacy-prefix comparison; both now call
pluginTreeHashMatches. The tree limits are exported for reuse.
* Align root Node types with the supported Node 24 runtime

* Preserve mobile rejection listeners with Node 24 types
)

The guest will-navigate guard cancelled every file: navigation, so clicking a
relative link on a file:// page did nothing. Allow file: -> file: when the
current page is itself a local file; web pages still cannot navigate or
redirect into the filesystem.
… (dark) (#30624)

* fix(sidebar): Hide sleeping reads a paired server's own terminal report (dark)

With ORCA_SIDEBAR_INPUTS=main, main's activity domain now lists a paired
server's rows: their terminals and agents as the server's worktree.ps
reports them, plus the browser and chat tabs this desktop's saved session
holds there. A server out of contact keeps live terminals unverifiable.
Switch-off builds are unchanged.

* fix(sidebar): keep server activity out of the published paired rows

Review: a strict field on paired rows could drop a whole row for an older
reader; the activity domain already carries it.
* fix(native-chat): identify the owner when resume create is refused

* test(native-chat): consolidate transcript refusal cases

* test(native-chat): keep ownership coverage at the launch boundary

* test(native-chat): update adoption fixture for early ownership admission

* test(native-chat): align resume admission assertions with host ownership

* test(native-chat): keep RPC coverage focused on ownership proof

* test(native-chat): assert blank request presence before optional source

* fix(native-chat): admit the actual CLI source during chat creation

* fix(native-chat): satisfy source admission lint checks

* test(native-chat): provide the waiting hook prompt

* test(native-chat): isolate source admission fixtures from host homes

* test(native-chat): canonicalize adoption fixture directories

* test(native-chat): preserve early ownership admission in source stack

* Resume CLI conversations directly in native chat

* fix(native-chat): preserve resume refusal behavior and honest transcript feedback

* fix(native-chat): retain import read evidence in typed result

* Use the header test fixture record type

* Consolidate launch owner imports and correct feedback assertion

* Keep existing resume translation in runtime catalog

* fix(native-chat): preserve admitted source and prepared execution home

* fix(chat): retain source evidence for dispatched adoption

* fix(chat): keep source capture within module limits

* Keep deferred chat publication in the shared launch owner

* test(chat): allow host evidence in create routing

* Satisfy launch publication checks and scope slot cleanup

* Preserve canonical tab membership on projected reorders

* Use recorded launch ownership for surface recovery

* Reserve deferred chat order through existing group actions

* Pass the active layout owner into launch cancellation

* Stop terminal writer before adopting conversation in chat

* Guard chat adoption completion and satisfy static checks

* Switch completed terminal turns without confirmation and test handoff

* Recheck terminal writers on reserved adoption retry

* Split session entry delegates and fix linted test types

* Keep chat opening send below create module line limit

* Require explicit terminal stop consent before chat adoption

* Use direct process-table test mock

* Fix chat adoption types and runtime localization

* Localize terminal takeover refusal guidance

* Keep CLI stop admission scoped to active source panes

* Preserve ordinary history resume through attach

* fix(native-chat): admit an unsaved transcript under a linked account folder

A missing transcript stayed unresolved while its account root resolved through
symlinks, so containment failed and a not-yet-saved conversation showed a load
error instead of the unsaved notice.

* Update adoption replay test for at-rest creation

* refactor(native-chat): move the newest-item import window into its own module

Keeps journal-legacy-import.ts under the line limit after the source
identity observer landed on top of the streaming import.

* fix(native-chat): restore the refusal error import lost in the main merge

* Remove duplicate account resolver and condense terminal admission

* Refuse conversation adoption until terminal writers exit

* Keep conversation inspection within lint limits

* Preserve conversation owner in launch feedback

* Expect unavailable writer scan to refuse fresh adoption

* Keep terminal conversation evidence tied to its execution

* Correct writer continuity test refusal and event shapes

* Prove original terminal writers exited before chat adoption

* Scope saved conversation holds to their execution host

* Keep child-inspection fixture verdict literal

* Recheck awake saved conversation holds against their owned pane

* fix: inspect owned Windows jobs independently of foreground naming

* test: use braces in Windows inspection fixture

* test: complete ordinary Windows terminal inspection fixture

* test: explain partial terminal inspection fixture

* fix: inspect the terminal a conversation is switched out of

* test: separate OpenCode writer observation coverage

* fix: tie terminal conversation links to the PTY execution

The conversations a terminal reported now live on its PTY record for that
incarnation, so moving the pane or running many other terminals can no longer
drop them, and a link whose terminal can't be inspected refuses.

- Each link keeps the agent process its hooks last proved; a live or
  suspended process refuses even when the terminal's tree is shell-only
  (detached tmux, nohup).
- tmux-published events are never pane-owned, and an unmarked binding copy no
  longer revokes an earlier pane-owned proof.
- A restored row or saved checkpoint is censused against the pane's current
  local PTY instead of requiring this runtime's observed identity.
- The refusal now says Orca can't confirm the agent has exited and asks the
  user to stop what's running there or close the terminal.

* test: drop the stub-host admission calls from OpenCode observation coverage

* test: census suspended children through the real terminal host

* test: drop writer checks the real-terminal flow already covers

* fix: let prompt workers outside the terminal's session pass the exit check

- The POSIX shell-alone proof skips a session leader below the shell and
  everything under it: a prompt's zpty worker has left the terminal, while
  suspended, background, nohup and disowned jobs still refuse.
- Windows steady-state polls read the cached process table; every read that
  decides adoption or close stays fresh.
- The pane header and tab menu point back to Session History, since their
  action is gone once the agent exits.

* fix(terminal): count only Windows job members still linked to the shell

A pane's job keeps every process it ever started, including daemons whose
parent exited (an rc-started ssh-agent), so such panes never read as an idle
shell and the chat switch refused forever. Walk descendants of the shell along
live parent links within the job, for every shell; the Git Bash launcher keeps
its bash-chain allowance and a child older than its parent still refuses.

* Revert "fix(terminal): count only Windows job members still linked to the shell"

MSYS exec and fork leave intermediate Win32 parents exited, so a live Claude
started through a script (and 'sleep 60 &') became unreachable and the chat
switch admitted while it ran. Back to the job census until a console-based
design is measured.

* fix(terminal): set aside detached daemons on a Windows shell-alone decision

A pane's job keeps every process ever started in it, so an rc-started
ssh-agent made a Git Bash pane read as busy forever and the chat switch
refused. MSYS fork/exec leaves live work under exited Win32 parents, so parent
links alone can't tell the daemon apart; it is the one that also left the
console. On a scanChildProcesses decision read (switch admission, run-terminal
close, close guards), a member neither linked to the shell nor attached to its
console no longer counts. Polls and shell confirmation keep the job census.
The console-list helper now forks through the process-host chokepoint.

* refactor(daemon): name the process inspection options once

Keeps the daemon router and terminal host within their line budget now that
the options carry scanChildProcesses.

* fix(terminal): set aside detached daemons only for adoption, never for close

Closing a Windows pane kills its whole job, so a close check that ignored a
detached process (gitk &, cmd /c start ...) would kill it without asking.
Adoption asks whether anything is still in the terminal; close asks whether
closing destroys something. Only the adoption read now sends ignoreDetached;
close guards and the run-terminal sweep keep the job census. The win32 test
also stops the ssh-agent it starts.

* fix(native-chat): check the terminal being switched out of before opening its chat

When the conversation already had a native chat, the switch hit the
ownership conflict first and the header opened that chat, even while the
terminal's agent (a later claude --resume) was still running. The switched-out
terminal is now checked before the conflict, so a live one refuses as usual
and one at rest still opens the owning chat.

* test(terminal): assert close reads never call an ssh-agent pane idle

A plain read can answer unverifiable while the eval's short-lived processes
exit; either way it must not read as no-children.

* fix(native-chat): check terminal writers before naming an owning chat for any switch

Session History's Resume in New Native Chat carries no source pane, so with an
earlier chat still holding the conversation it skipped the terminal check and
the owning chat's first send would start a second writer beside a live
terminal Claude. Every adoption request now runs the writer check before the
owner conflict, as the no-owner path already does.

* test(reliability): run the chat-switch writer oracles in the provider-ownership gate
…to find its sessions (#30469)

* perf(session-history): remember each transcripts folder so Workspace scans stop re-reading files

* refactor(session-history): keep the scope cwd table in its own module

* test(session-history): type the hoisted read log without an assertion

* test(session-history): type the collected session folders

* chore(wsl-move): list the parse cache scope_cwds table

* Keep scoped session selection current with cache authority

* Consolidate scope cache imports in regression test

* Run scope cache SQLite regression tests under Node

---------

Co-authored-by: OrcaWin <[email protected]>
Co-authored-by: Orca Worker <orca-worker@localhost>
* fix(sidebar): phone feed list leftovers before the flip (dark)

Bump the feed's semantics version for P11's desktop facts; mark switch-on phone page bundles so packaging and orcad staging refuse them; show the page's last-listed rows before the first feed read; draw the host's pending creations; pass the listed host's own label into host sections instead of the running device's platform.

* fix(sidebar): review fixes for the phone feed leftovers (dark)

A dark orcad may stage the dark page (only a marker of an off switch is refused); the bundle tree writer leaves the marker; the pre-feed list keeps the view's filters; a creation names its project only outside that project's header and survives search when its project matches; the feed view and row labels read one resolved desktop platform.

* fix(sidebar): second review fixes for the phone feed leftovers (dark)

Test the off-switch marker check across switches; resolve the desktop platform once for rows and headers; a section search narrows keeps only matching rows.
…ile (#30605)

* feat(files): guarded file writes that refuse to overwrite a changed file

Adds an optional disk precondition to file writes: the writer compares the file
on disk with an expected signature inside the write, serialized per file (path
then inode), and refuses with a typed changed/missing result instead of writing.
Remote hosts serve it as files.writeIfUnchanged behind a capability; older
hosts get a client-side compare that fails closed, pinned to the probed runtime
and connection. Undo of a delete and the MCP starter config use it to write only
into a missing or identical file. Groundwork for guarding editor saves.

* fix(files): pin guarded writes on the sending socket; keep refused undo; narrow not-found and pinning

* fix(files): pin a guarded save to one pairing; keep only refused undo steps

* fix(files): ENOENT by code only; resolve symlink chains fully; pin lost-reply recovery to the save's pairing
…w2-creation-tab

Row 1 conflicts keep main's creation registry and startup resolver while
keeping row 1's first-surface ownership (no promisedAgentChat). Row 2's
conflicting renderer and mobile selection files take main's side; the
rebuild that follows drops that mechanism.
The re-plan replaces it with a read-time resolver: a default is shown, never
recorded as a pick. This removes workspace-creation-tab-selection.ts, its
showUnchosenWorkspaceSurface activation, the per-call recordFocus plumbing,
the timestamp-based viewer-selection policy in web-session-tabs-sync, the
create-worktree caller-selection persistence and the mobile selection-ref
rewiring, restoring those files to row 1 on main.
…ation agent

One pure resolver in shared/workspace-creation-tab.ts decides which tab a
viewer shows: its explicit choice while that tab exists, otherwise the first
tab running the workspace's creation agent, otherwise the viewer's own
topology fallback. The host's per-device projection uses it only for a device
with no recorded pick, so a cached Setup fallback never becomes a pick and
gives way when the agent's tab arrives, on list and subscription alike.

A paired create still activates nothing on the host, and no longer records a
pick for its caller: the creating phone gets the same derived default as any
other viewer.
On a snapshot the host projected for this device (the :client-navigation
epoch), the active flags already carry this device's pick or, until it picks,
the workspace's derived default. The last displayed tab is only a display
cache, so it no longer outranks them: an interim Setup gives way to the agent
chat when it arrives. Pending local intent still wins until the host records
it, and placement still reads the displayed tab. Hosts without per-device
projection keep the legacy reader.
…icks a tab

The desktop window now keeps its own tab choices (desktopTabChoices): a
workspace is listed once a tab-strip click, a tab-switch key or an explicit
palette open picks one of its tabs, or a saved selection restores. Creates,
seeds, repairs and display projection never record a choice.

A workspace without a choice shows the same shared resolver's default:
- reconciliation fills a group with no shown tab from the creation tab first;
- a creation chat arriving from the host goes through the existing focus
  intent projection, so group, tab and visible type move together, and only
  for that workspace (no global or window change);
- a creation agent terminal arriving as a background tab is shown in place;
- the session serializer saves no shown tab for it, so a reload before the
  agent arrives never turns Setup into a choice;
- the layout-owner build's frame slices fill the same way from the view the
  window read back from its save.

Every tab-strip click, including one on the Setup tab already shown, records
the choice, so an explicit Setup sticks across later publication, save and
reload.
Record desktopTabChoices at the user's create commands, the same boundary
as clicks and keys: the tab-strip "+" and new-tab menu and shortcuts
(useTabGroupCreationCommands, useTerminalCreateActions, the open-new
commands they and the palette use, the explorer's new terminal), every
file open (openFile / openFileForLink: explorer, search, links, quick
open), and user agent launches ("+" quick launch, fork, dashboard, quick
commands, fix checks, commit actions). Automatic creates stay unrecorded:
seed and Setup tabs, default tabs, adopted or restored PTYs, and the
host-published creation chat or terminal.

So a restart after the user made a tab reopens on it, as on main. The
desktop flow test now pins that.
The commit-recovery and source-control action agent launches now record
desktopTabChoices like every other user agent launch, so a restart after
one reopens on it, as on main.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #31255, which carries this change rebuilt directly on main (this branch was stacked on the closed #29095). Closing in favor of that PR.

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.

9 participants