Skip to content

feat: bound direct SSH reconnect fan-out and recovery - #11003

Merged
Jinwoo-H merged 29 commits into
mainfrom
ssh-reconnect-fanout
Jul 28, 2026
Merged

Jinwoo-H merged 29 commits into
mainfrom
ssh-reconnect-fanout

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Implements bounded direct SSH reconnect fan-out and recovery across main, preload, renderer, shared contracts, Electron integration, and reliability gates.
  • Keeps direct-SSH ownership fail-closed on the complete (targetId, providerEpoch, connectionGeneration) authority while preserving folder workspaces, runtime-owned SSH rows, local/WSL state, and host-qualified multi-host repo/worktree reads.
  • Rebased onto main@21dee21a6d9d398bb332ddf0f85fbb4d5de7cd1b; current pushed head is e04a0899e and was 0 commits behind main at push time.
  • Final merge-readiness fetch found two later main commits: 1bd80931b (combined-diff navigation/width persistence) and 2d2321716 (Trae agent catalog/recognition). Their concrete hunks do not change SSH reconnect authority, ownership, retry, cleanup, hydration, terminal provider, runtime-owned rows, or folder-workspace behavior; git merge-tree --write-tree HEAD origin/main is conflict-free. The branch is current enough without restarting an unbounded moving-base CI loop.
  • The design and implementation map are in docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md.

Implemented invariants

  1. Renderer waiter lease IDs are distinct from shared provider request IDs; only the final waiter cancels provider work.
  2. Authoritative SSH responses require the full authority pair. Partial, stale, malformed, ambiguous, or contradictory ownership fails closed before provider access and again after awaits.
  3. Discovery is target-scoped and bounded by a five-slot fair scheduler. Queue wait, provider deadline, retry, and cancellation debt are distinct; the first retryable timeout retains preparation until the retry reaches a terminal outcome.
  4. Reconnect prepares terminal panes before optional discovery. One exact attempt admits concurrent split spawn/reattach callbacks, retains sibling continuation authority, rotates at most once, and never starts attempt three.
  5. Primary exit, delayed sibling mount, live/pending activation gaps, split detach, hydration, and target deletion preserve or prune only the exact target/tab state they own.
  6. Same-target connect/disconnect/remove/reset/terminate lifecycles are serialized through successful or failed cleanup; unrelated targets remain independently keyed.
  7. A stale fresh sessionExpired fallback is killed before admission can publish PTY handlers. Retirement is awaited; shutdown refusal is reported as unknown while main retains ownership for retry. Reattach and cold-restore results are not killed because a current lease may adopt them.

Reproduction and red/green evidence

Falsifiable invariants were exercised at deterministic provider, store, transport, authority, hydration, and lifecycle seams before real SSH:

  • Historical red heads include 939719443 (split success consumed sibling authority), d501f2e96 (exit/detach lost continuation), d44ea382b (null-detach/delayed sibling escaped fencing), 9fa84dacf (authority rotation collided with stale transport), e5ba9a9e5 (connect overlapped teardown), 9a29e7a81 (cleanup rejection short-circuited lifecycle), and 47c7198f2 (reset could rotate before session retirement).
  • The late fresh-fallback oracle was red with zero pty.kill calls, then green for rejection, destroy-after-spawn, reattach/cold-restore non-destruction, and shutdown-refusal reporting.
  • Pending-provider oracles reject contradictory, malformed, empty, and whitespace repo provenance introduced during the await.
  • Authoritative target-tab deletion now prunes only that tab's retry/live/history ledgers while preserving retained target, sibling SSH, local, folder, and runtime state.

Exact-head CI run 30358577879 on 0989940cd passed every non-E2E job and nine E2E shards, but shard 3 reproduced two harness failures for a second consecutive pushed head:

  • orchestration-worker-terminal-visibility.spec.ts admitted a newborn pane because both persisted and DOM PTY IDs were still undefined, then correctly received terminal_not_found before worker start. 5cd374819 added the existing non-empty PTY readiness fence before exact pane resolution; it does not retry or mask any runtime operation.
  • plugin-panel-containment.spec.ts clicked its oversized/flood fixture, but neither the host response nor the fixture's unconditional fallback survived the Linux iframe lifecycle. All implicated files were byte-identical to main. 5cd374819 moved oversized and mixed-traffic budget refusals to the deterministic production bridge-host seam, including no-relay assertions, while Chromium retained a small real bridge refusal plus CSP, network, navigation, process-isolation, and watchdog coverage.

Exact-head CI run 30361426488 on 5cd374819 passed 38 checks and failed only shard 3:

  • The small real bridge refusal passed in 11 ms. The subsequent top-navigation click completed, the loopback server recorded zero requests, and the app plus clean about:srcdoc fixture remained, but the attempted navigation reset the iframe document before its setTimeout(0) DOM marker persisted.
  • 589be0f8d records will-frame-navigate.defaultPrevented after the production listener, forbids matching did-frame-navigate commits and shell.openExternal calls, and accepts a replaced fixture document only when an exact destination was authoritatively blocked.

Exact-head CI run 30364440185 on 589be0f8d passed 32 checks before shard 3 failed and fail-fast cancelled shard 9:

  • The hostile top-navigation control executed, loopback requests remained empty, and the same clean about:srcdoc document remained for the full five-second poll, but the renderer navigation policy consumed the attempt before will-frame-navigate; requiring that main-process event or a disposable timer marker was an invalid oracle.
  • 956934027 records immutable entry into each real hostile handler, requires retained anchor/form/meta artifacts, preserves exact blocked-destination fencing for any replaced document, and separately drives the registered frame to an exact destination that must reach will-frame-navigate with defaultPrevented=true. It still forbids network requests, matching commits, external opens, app navigation, and dirty replacement documents.

Exact-head CI run 30366892192 on 956934027 passed 32 checks before shard 3 failed and fail-fast stopped the remaining shards:

  • The trace proves Playwright completed the physical top-navigation button click while the original clean about:srcdoc remained, but no fixture-owned invocation result, loopback request, will-frame-navigate, committed navigation, or external open followed.
  • Independent source/trace audit disproved cross-world expando isolation: Playwright adopts locator evaluation into the frame main context. The failed seam was coordinate delivery, which is not the containment boundary.
  • 9f514fd38 invokes the real registered handler synchronously through HTMLButtonElement.click(), records exact fixture-owned DOM invocation markers and source-document identity, requires both anchor and form destinations for any replacement fallback, and separately requires an exact prevented subframe event from the main-process guard. The corrected diff was independently re-reviewed with no material finding.

Core validation through 928703279

pnpm exec vitest run --config config/vitest.config.ts \
  src/renderer/src/store/slices/direct-ssh-terminal-retry.test.ts \
  src/renderer/src/store/slices/direct-ssh-pane-detach-ledger.test.ts \
  src/renderer/src/store/slices/direct-ssh-terminal-recovery.test.ts \
  src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.test.ts \
  src/renderer/src/store/slices/terminals-hydration.test.ts \
  src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts \
  src/renderer/src/hooks/direct-ssh-reconnect-coordinator.test.ts \
  src/renderer/src/hooks/direct-ssh-host-hydration.test.ts \
  src/renderer/src/hooks/direct-ssh-state-routing.test.ts \
  src/renderer/src/hooks/remote-workspace-target-sync.test.ts \
  src/renderer/src/components/terminal-pane/pty-connection.test.ts \
  src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts \
  --reporter=dot
# 12 files, 647 tests passed

pnpm exec vitest run --config config/vitest.config.ts \
  src/renderer/src/components/terminal-pane/pty-transport.test.ts --reporter=dot
# 90 tests passed

pnpm exec vitest run --config config/vitest.config.ts \
  src/renderer/src/components/right-sidebar/plugin-panel-bridge-host.test.ts \
  src/shared/plugins/plugin-panel-message-budget.test.ts --reporter=dot
# 2 files, 15 tests passed

pnpm run typecheck
pnpm run check:reliability-gates
pnpm run check:max-lines-ratchet
pnpm run check:code-quality:changed
git diff --check
# all passed; 52 reliability gates, 0 changed-code findings, no new max-lines bypasses

pnpm exec electron-vite build --mode e2e
SKIP_BUILD=1 pnpm exec playwright test \
  tests/e2e/orchestration-worker-terminal-visibility.spec.ts \
  tests/e2e/plugin-panel-containment.spec.ts \
  tests/e2e/artificial-opencode-terminal-load.spec.ts \
  --config tests/playwright.config.ts --project electron-headless --workers=1
# 13/13 passed

SKIP_BUILD=1 pnpm exec playwright test \
  tests/e2e/plugin-panel-containment.spec.ts \
  --grep "contains hostile panel network and navigation probes" \
  --config tests/playwright.config.ts --project electron-headless --workers=1 --repeat-each=20
# 20/20 passed

SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 pnpm run test:e2e --shard=3/10
# 35 passed, 6 topology-gated tests skipped

ORCA_E2E_SSH_DOCKER=1 SKIP_BUILD=1 pnpm exec playwright test \
  tests/e2e/ssh-docker-relay-perf.spec.ts \
  --grep "keeps an SSH workspace terminal usable after disconnect and reconnect" \
  --config tests/playwright.config.ts --project electron-headless --workers=1
# 1/1 passed with live terminal input and an independent container-visible proof file

The repository Docker SSH fixture was used because brennan-test-ssh is not installed. It validates Orca's direct SSH provider/relay path; it does not substitute for paired Orca-server coverage.

Independent adversarial review found the late ownership, ledger, and cleanup issues above; each was fixed and re-reviewed. The revised navigation-oracle review found no material issue and confirmed handler-entry, exact artifact, main-process cancellation, CSP, bridge, sandbox, process-isolation, and watchdog coverage.

Exact-head CI run 30368873696 on 9f514fd38 finished with 39 green checks; shard 9 was cancelled by the workflow’s 20-minute cap at test 38/40 after one first-pass failure marker whose deferred detail never printed before cancellation. The focused close/restart test was green 6/6 locally, and the exact local shard was green with 31 passed and 9 platform-gated skips. c4001f2fb raises only the sharded E2E job budget to 30 minutes.

Exact-head run 30371289466 on c4001f2fb completed 33 jobs green and proved shard 9 can finish: 24 passed and 15 platform-gated tests skipped in 19.8 minutes. It exposed two independent lifecycle harness/base failures:

  • Shard 2 failed headless-serve-desktop-activation.spec.ts when a post-promotion CLI status call could not reach the runtime. The byte-identical oracle was rebuilt and run on origin/main@0404f27b3; main independently failed with the same stable runtime but replaced daemon PTY, establishing a pre-existing headless-promotion defect rather than a reconnect regression.
  • Shard 9 failed before close at terminal.resolvePane because the renderer pane descriptor became visible before the owning runtime published that exact pane. 7329a6511 polls only the authoritative (worktreeId, paneKey) lookup, retries only terminal_not_found, and surfaces every other error.

Exact-head run 30373488367 on 7329a6511 completed 38 checks green and failed only two E2E shards. Shard 1’s unchanged mainline OpenCode-load smoke recorded a 3064.6 ms worst echo against its 3000 ms catastrophic-hang ceiling; the test’s own comment records ~3.1 s on CPU-starved OSS shards and identifies median latency as the responsiveness guard. Shard 9 proved the exact pane poll was reached, but Playwright’s RPC error was not instanceof the imported constructor, so terminal_not_found was rethrown until the 15-second poll expired.

Exact-head run 30375539695 on e2c60e846 completed 37 checks green. Shard 9 still never published the pane key during the bounded lookup, disproving pane-hook visibility as a runtime-readiness barrier. Shard 2 repeated the byte-identical pre-existing headless-promotion failure already reproduced on main; shard 10’s unchanged responsiveness smoke measured 37.8 ms against 32 ms after the preceding exact-head run passed that shard.

928703279 removes the pane-hook dependency and polls authoritative terminal.list for exactly one row matching both the explicit worktree ID and captured tab ID before splitting that exact handle. Independent review confirmed the selector is deterministic for the isolated one-pane harness and found no blocking race. Validation on 928703279: a fresh E2E build plus focused lifecycle passed 1/1, the same lifecycle then passed 5/5 with --repeat-each=5, and pnpm run typecheck, focused oxlint/oxfmt --check, pnpm run check:max-lines-ratchet, pnpm run check:code-quality:changed, and git diff --check all passed. Exact-head PR Checks run 30377990077 on 928703279 completed with all 40 checks green; shard 9, including the corrected close/restart lifecycle, passed in 21m44s. ddce894d7 changed only the design status and validated-main SHA to match that completed evidence; pre-rebase PR Checks run 30380141831 completed with all 40 checks green after one bounded failed-job rerun. Attempt 1 passed 38/40 checks and failed only unchanged E2E harnesses: shard 5 accepted the seeded source-control store state while the renderer transiently stayed on Explorer, and shard 1 measured a 484 px combined-diff scroll delta against its 80 px threshold. The tests and implicated runtime code were byte-identical to the prior 40/40 implementation head; attempt 2 reran only those two jobs and both passed (8m37s and 16m16s). Shard 9 passed in 20m46s. Golden macOS/Linux, Wayland, Windows crash-survival, and Windows restart workflows also passed on ddce894d7. e04a0899e rebases the byte-identical implementation onto main@21dee21a6 and updates the validated-main metadata for #11206. Exact-head PR Checks run 30383578048 completed with all 40 checks green after one bounded failed-job rerun. Attempt 1 passed 38/40 checks and failed only unchanged/non-branch E2E harnesses: shard 5 kept the New Terminal menu visible for three seconds after a forced click, and shard 2 repeated the independently reproduced mainline headless-promotion CLI reconnect failure. Attempt 2 reran only those two jobs and both passed (8m21s and 14m57s). Shard 9 passed in 21m59s. Golden macOS/Linux, Wayland, Windows crash-survival, and Windows restart workflows also passed on e04a0899e.

Remaining coverage gaps

  • Physical Windows and Linux desktop clients, plus WSL.
  • Headed paired-Orca-server and headless orca serve parity.
  • Live paired-close non-interference and live multi-target fan-out.
  • Live folder-workspace reconnect and a large terminal-map timing benchmark.

These are explicit topology/performance gaps, not known design failures.

Review and security

All original major findings are implemented and tested: distinct waiter/provider identities, mandatory full authority, contradictory-provenance rejection, and retained preparation across the first retryable timeout. Later review also covered useIpcEvents preparation, repeated remote-workspace preparation, host-qualified reads, current-main ownership changes, runtime-owned rows, cancellation debt, hydration, terminal cleanup, provider refusal, session rotation, and late ssh2 ready/error events.

No credentials, dependencies, Git commands, native modules, UI, or permission surfaces are added. Telemetry excludes identifiers. Git 2.25 compatibility is unaffected.

Do not merge from automation; exact-head validation is complete and the PR is ready for maintainer review and merge.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an implementation-ready direct SSH reconnect fan-out design spanning main, preload, and renderer. It defines provider authority epochs, host-qualified IPC, fenced state mutations, bounded cancellable worktree scheduling, per-target reconnect coordination, PTY recovery, revision-aware workspace synchronization, telemetry, testing, rollout, rollback, and compatibility constraints.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description includes Summary and validation details, but it omits required Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes sections. Add the missing template sections and fill in the Testing, AI Review Report, Security Audit, Screenshots, and Notes content.
✅ Passed checks (3 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 is concise and accurately summarizes the main change: bounded direct SSH reconnect fan-out and recovery.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6108493e-f7e5-40fc-a175-0c7b3b7dca02

📥 Commits

Reviewing files that changed from the base of the PR and between 2bb3276 and 360d315.

📒 Files selected for processing (1)
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md

@OrcaWin
OrcaWin force-pushed the ssh-reconnect-fanout branch from 360d315 to ddb6e5c Compare July 27, 2026 23:57
@OrcaWin OrcaWin changed the title docs: direct SSH reconnect fan-out design (LLM counsel ×2) docs: direct SSH reconnect fan-out design Jul 27, 2026
@OrcaWin

OrcaWin commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba02f6c2-94df-4d13-ac18-8fe6116fa605

📥 Commits

Reviewing files that changed from the base of the PR and between 360d315 and ddb6e5c67c5f6b10350cf28946995dd0a989a08a.

📒 Files selected for processing (1)
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md

@OrcaWin
OrcaWin force-pushed the ssh-reconnect-fanout branch 2 times, most recently from 9c608c2 to ac83b41 Compare July 28, 2026 00:15
@OrcaWin

OrcaWin commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

@Jinwoo-H
Jinwoo-H force-pushed the ssh-reconnect-fanout branch from ac83b41 to 650dff3 Compare July 28, 2026 08:43
@Jinwoo-H Jinwoo-H changed the title docs: direct SSH reconnect fan-out design feat: bound direct SSH reconnect fan-out and recovery Jul 28, 2026
@Jinwoo-H

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

@Jinwoo-H
Jinwoo-H requested review from OrcaWin and brennanb2025 July 28, 2026 08:44

@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

🧹 Nitpick comments (2)
src/main/ipc/repos.ts (1)

129-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Three hand-copied direct-SSH authority validators. hasValidCatalogSshAuthority, hasValidDirectSshAuthority, and hasValidLineageSshAuthority have identical bodies; the copies have already drifted in signature quality (one predicate narrows to its own parameter type and needs an as-cast at its call site). Extract one isAdmissibleDirectSshAuthority(value: unknown): value is DirectSshAuthority into src/shared/ssh-retained-payload-admission.ts, which already owns SSH_PROVIDER_EPOCH_MAX_UTF8_BYTES.

  • src/main/ipc/repos.ts#L129-L147: replace the body with an 'expectedAuthority' in args && isAdmissibleDirectSshAuthority(args.expectedAuthority) check against the shared helper.
  • src/main/ipc/worktrees.ts#L1199-L1201: delete both local validators, widen the detected-worktree guard's parameter to ListDetectedWorktreesArgs so it narrows for real, and drop the as DirectSshDetectedWorktreeRequest cast at Line 1559.
config/reliability-gates.jsonc (1)

3722-3766: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

ssh.test.ts and several newly-added testFiles lack a matching assertionRefs entry.

src/main/ipc/ssh.test.ts, worktrees.test.ts, repos-remote.test.ts, public-ssh-state.test.ts, runtime-environment-ssh-state.test.ts, and ssh-types.test.ts are newly added to testFiles/commands (line 3716's --reporter=dot command) for this gate, but assertionRefs (3767-3981) documents assertions only for ssh-provider-authority.test.ts, ssh-authority-forwarding.test.ts, ssh-retained-payload-admission.test.ts, and runtime-client-events.test.ts from that same command. ssh.test.ts itself (reviewed alongside this file) adds concrete new assertions — e.g. registerSshGitProvider ordering relative to the ssh:state-changed broadcast, and providerEpoch/connectionGeneration presence — that would strengthen this gate's traceability if documented here.

♻️ Suggested addition to assertionRefs
         {
           "file": "src/shared/ssh-types.test.ts",
           ...
         },
+        {
+          "file": "src/main/ipc/ssh.test.ts",
+          "assertions": [
+            "registerSshGitProvider is invoked before the connected ssh:state-changed broadcast",
+            "connect/reconnect state includes providerEpoch and an incrementing connectionGeneration"
+          ]
+        },

Also applies to: 3855-3979


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df28f592-570f-4fcf-ae48-3e3e59e1be4a

📥 Commits

Reviewing files that changed from the base of the PR and between ac83b41 and 650dff3.

📒 Files selected for processing (14)
  • config/reliability-gates.jsonc
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/main/ipc/repos-remote.test.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/worktrees.test.ts
  • src/main/ipc/worktrees.ts
  • src/main/runtime/public-ssh-state.test.ts
  • src/main/ssh/ssh-provider-authority.test.ts
  • src/main/ssh/ssh-provider-authority.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/preload/ssh-authority-forwarding.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md

Comment thread src/main/ipc/worktrees.ts Resolved
Comment thread src/main/ssh/ssh-provider-authority.ts Resolved
Comment thread src/preload/api-types.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2cb8f1a7-b853-4112-a5b5-8b25212a143e

📥 Commits

Reviewing files that changed from the base of the PR and between ac83b41 and 650dff3.

📒 Files selected for processing (14)
  • config/reliability-gates.jsonc
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/main/ipc/repos-remote.test.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/worktrees.test.ts
  • src/main/ipc/worktrees.ts
  • src/main/runtime/public-ssh-state.test.ts
  • src/main/ssh/ssh-provider-authority.test.ts
  • src/main/ssh/ssh-provider-authority.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/preload/ssh-authority-forwarding.test.ts
🚧 Files skipped from review as they are similar to previous changes (13)
  • src/main/runtime/public-ssh-state.test.ts
  • src/preload/ssh-authority-forwarding.test.ts
  • src/preload/api-types.ts
  • src/main/ssh/ssh-provider-authority.ts
  • src/main/ssh/ssh-provider-authority.test.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/repos-remote.test.ts
  • src/preload/index.ts
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/worktrees.test.ts
  • config/reliability-gates.jsonc
  • src/main/ipc/worktrees.ts

Comment thread src/main/ipc/ssh.ts Resolved
@OrcaWin
OrcaWin force-pushed the ssh-reconnect-fanout branch from 650dff3 to 83bed15 Compare July 28, 2026 10:26
@OrcaWin

OrcaWin commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

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

🧹 Nitpick comments (21)
src/renderer/src/hooks/direct-ssh-reconnect-coordinator-telemetry.ts (1)

60-61: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify fallback metrics construction.

Building a full DirectSshReconnectOutcome (via createTerminalOnlyDirectSshReconnectOutcome('stale')) just to grab its .metrics is indirect and requires a non-null assertion. createEmptyDirectSshPreparationMetrics() is already exported from direct-ssh-reconnect-coordinator-outcomes.ts and returns exactly this default shape.

♻️ Proposed simplification
-import { createTerminalOnlyDirectSshReconnectOutcome } from './direct-ssh-reconnect-coordinator-outcomes'
+import { createEmptyDirectSshPreparationMetrics } from './direct-ssh-reconnect-coordinator-outcomes'
@@
-    const outcomeMetrics =
-      outcome.metrics ?? createTerminalOnlyDirectSshReconnectOutcome('stale').metrics!
+    const outcomeMetrics = outcome.metrics ?? createEmptyDirectSshPreparationMetrics()
src/renderer/src/hooks/direct-ssh-reconnect-tokens.ts (1)

44-59: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate duplicated repo-fingerprint sort logic into one shared, always-sorted helper. Both sites independently implement "sort repo refs by (executionHostId, repoId) then fingerprint," risking silent divergence if one comparator is edited without the other.

  • src/renderer/src/hooks/direct-ssh-reconnect-tokens.ts#L44-L59: make directSshRepoFingerprint sort internally (reusing compareText) so it's safe to call without a prior normalizeDirectSshPreparationInput pass, and export it for reuse.
  • src/renderer/src/hooks/direct-ssh-host-hydration.ts#L286-L299: replace the inline sort + JSON.stringify in isPreparationTokenCurrent with a call to the now-self-sorting directSshRepoFingerprint.
src/renderer/src/lib/workspace-session-hydration-keys.ts (1)

9-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider typing replaceWorkspaceKeys as readonly WorkspaceKey[] for consistency with additionalValidWorkspaceKeys.

Both fields address the same key space; using a raw string[] for one loses the alias/branding at call sites.

src/renderer/src/hooks/useIpcEvents.test.ts (1)

5062-5065: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

beforeEach declared mid-file applies to the whole enclosing describe.

This hook is registered for every test in the block, not just the reconciliation tests below it, so vi.resetModules() / vi.unstubAllGlobals() also run before the earlier tests. Scope it inside a nested describe for the reconciliation cases to avoid surprising cross-test coupling.

src/renderer/src/store/slices/direct-ssh-terminal-retry.test.ts (1)

17-62: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename the local seedStore helper to avoid colliding with the shared one.

store-test-helpers exports a seedStore (used in direct-ssh-pane-detach-ledger.test.ts); a local function with the same name but different semantics is easy to confuse. Something like seedDirectSshRetryStore reads better.

src/renderer/src/runtime/runtime-environment-ssh-state.ts (1)

75-79: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Rejected states are dropped silently — no error/log signal.

All three admission call sites in this file (fetchEnvironmentSshConnectionStates, applyRuntimeEnvironmentSshStateChanged, connectRuntimeEnvironmentSshTarget) drop a state that fails admitSshConnectionState with no logging or error callback. This is inconsistent with runtime-client-events.ts, which calls onError(new Error('Invalid retained SSH connection state')) on the same kind of rejection. A malformed payload during rollout/version-skew (a scenario this PR explicitly targets) would fail invisibly here, making it hard to diagnose.

🔍 Example fix (repeat for the other two call sites)
-      const admittedState = state ? admitSshConnectionState(state, target.id) : null
-      if (admittedState) {
+      const admittedState = state ? admitSshConnectionState(state, target.id) : null
+      if (admittedState) {
         useAppStore
           .getState()
           .setEnvironmentSshConnectionState(environmentId, target.id, admittedState, generation)
+      } else if (state) {
+        console.warn('Dropped invalid SSH connection state for target', target.id)
       }

Also applies to: 162-169, 189-195

src/main/ipc/ssh.ts (1)

923-939: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the attempt's authority explicit instead of re-reading it after doConnect().

Line 939 re-reads getSshProviderAuthority(targetId) and relies on doConnect() having already rotated it synchronously (no await precedes the rotateSshProviderAuthority at Line 983). Any future await inserted before that rotation would make attempt.authority the pre-rotation value, so a later connectTarget() would treat the live attempt as stale and evict/replace it. Have doConnect surface the authority it rotated (or rotate in connectTarget and pass it down).

Also, the re-check at Lines 933-935 is unreachable-as-false: observedAuthority === admissionAuthority and Lines 927-932 are synchronous, so Line 923 already covers it.

src/main/ssh/ssh-connection.test.ts (1)

466-469: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the microtask-drain spin into a shared helper.

The fixed 5-iteration await Promise.resolve() loop is duplicated verbatim; a waitForClientInstance() helper (or vi.waitFor) keeps the two tests from drifting if the connect path gains another await.

Also applies to: 489-492

src/main/ipc/ssh.test.ts (1)

535-537: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Assert the provider was registered before comparing call order.

If mockRegisterSshGitProvider is never called, invocationCallOrder[0] is undefined and the failure surfaces as an opaque comparison error. Add expect(mockRegisterSshGitProvider).toHaveBeenCalled() first.

src/renderer/src/hooks/direct-ssh-reconnect-preparation-metrics.ts (1)

15-22: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Avoid quadratic array re-allocation while folding duration samples.

Each iteration rebuilds both arrays; with many repos per target this is O(n²) copying for no benefit since aggregate is already a fresh local.

♻️ Push instead of re-spreading
-    aggregate.queueWaitDurationsMs = [
-      ...aggregate.queueWaitDurationsMs,
-      ...metrics.queueWaitDurationsMs
-    ]
-    aggregate.providerExecutionDurationsMs = [
-      ...aggregate.providerExecutionDurationsMs,
-      ...metrics.providerExecutionDurationsMs
-    ]
+    aggregate.queueWaitDurationsMs.push(...metrics.queueWaitDurationsMs)
+    aggregate.providerExecutionDurationsMs.push(...metrics.providerExecutionDurationsMs)
src/renderer/src/hooks/direct-ssh-state-routing.ts (1)

38-57: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Attach a rejection handler to the fire-and-forget async deps.

prepareAndSync and requestReconnect are injected and declared as possibly-async; void only suppresses the lint, so a rejection from either surfaces as an unhandled promise rejection and kills the routing path's error containment. A tiny helper keeps the routing decision synchronous while absorbing failures.

🛡️ Proposed fix
+const detach = (result: void | Promise<unknown>): void => {
+  void Promise.resolve(result).catch(() => {})
+}
+
 export function routeDirectSshConnectedState(
   deps: DirectSshConnectedStateRoutingDeps,
   input: {
     authority: DirectSshAuthority
     previousAuthority: DirectSshAuthority | null
     origin: DirectSshConnectedStateOrigin
   }
 ): DirectSshConnectedStateRoute {
   const { authority } = input
   if (input.origin === 'initial-hydration') {
     deps.rememberReconnectAuthority(null)
-    void deps.prepareAndSync(authority, 'initial-hydration')
+    detach(deps.prepareAndSync(authority, 'initial-hydration'))
     return 'initial-hydration'
   }
   if (!directSshAuthoritiesEqual(input.previousAuthority, authority)) {
     deps.rememberReconnectAuthority(authority)
     if (deps.coordinatorRoutingEnabled) {
-      void deps.coordinator.requestReconnect(authority)
+      detach(deps.coordinator.requestReconnect(authority))
       return 'changed-authority'
     }
     deps.coordinator.replaceAuthority(authority)
     deps.invalidateStaleTerminalBindings(authority)
     deps.retryTargetPanes(authority)
-    void deps.prepareAndSync(authority, 'reconnect', { authorityAlreadyReplaced: true })
+    detach(deps.prepareAndSync(authority, 'reconnect', { authorityAlreadyReplaced: true }))
     return 'changed-authority-fallback'
   }
   deps.coordinator.correctUnboundTerminals(authority, 'wake-refresh')
-  void deps.prepareAndSync(authority, 'wake-refresh')
+  detach(deps.prepareAndSync(authority, 'wake-refresh'))
   return 'same-authority-wake'
 }
src/renderer/src/hooks/remote-workspace-snapshot-apply.ts (1)

40-51: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

DirectSshTargetScopeInput is hand-constructed at three sites. All three build the same eight-field literal with catalogRevision: 0 before calling into the scope resolver; adding a field to the input type will silently skip whichever site is missed.

  • src/renderer/src/hooks/remote-workspace-snapshot-apply.ts#L40-L51: replace the local exactTargetWorktreeIds with a shared builder exported next to resolveDirectSshTargetScope.
  • src/renderer/src/hooks/remote-workspace-target-sync.ts#L51-L62: delete this verbatim copy and import the shared helper.
  • src/renderer/src/store/slices/terminals.ts#L176-L191: keep resolveDirectSshTerminalKeys but have it build its input via the same shared builder.
src/renderer/src/hooks/remote-workspace-target-sync.test.ts (1)

468-490: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Restore real timers in a hook, not inline.

vi.useRealTimers() on Line 489 is skipped if any assertion above it throws, leaking fake timers into the following test in this file.

♻️ Proposed fix
-import { describe, expect, it, vi } from 'vitest'
+import { afterEach, describe, expect, it, vi } from 'vitest'
 describe('createRemoteWorkspaceTargetSync', () => {
+  afterEach(() => {
+    vi.useRealTimers()
+  })
     pendingReattach.resolve()
     await flush()
     expect(harness.finalizeHydratedTerminals).toHaveBeenCalledOnce()
-    vi.useRealTimers()
   })
src/renderer/src/store/slices/terminals.ts (1)

2141-2162: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the shared retry-lease resolution.

This precondition block and the acknowledgement block at Lines 2265-2284 duplicate the same five-part check (lease lookup, bound tab, PTY connection id, current authority, tab generation) against two different tab snapshots. A single helper taking (state, tabId, ptyId, attemptId, tabs) would keep the two sites from drifting.

tests/e2e/helpers/docker-ssh-relay-connection.ts (1)

54-61: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Dead condition: state.connectionGeneration === undefined is unreachable — Number.isSafeInteger(undefined) is already false, so the preceding clause short-circuits first. Dropping it makes the guard read cleanly.

src/renderer/src/lib/direct-ssh-target-scope.ts (1)

264-299: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a one-line note on counter precedence.

Both the worktree and folder passes count a row as either contradictory or ambiguous (contradiction wins), and hosts.size === 0 is folded into ambiguous. That precedence is load-bearing for the telemetry counters and the gates in direct-ssh-target-scope.test.ts, but isn't evident from the code.

src/renderer/src/store/slices/ssh.test.ts (1)

129-165: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

as never disables type checking on the ledger fixtures.

These casts mean the fixtures compile regardless of the real DirectSshPaneRetryAttempt / DirectSshLivePtyBinding / DirectSshPaneRetryHistory shapes — note the live-binding fixtures omit attemptId, and it isn't clear from here whether that's legal. The file already uses the precise as SshProviderEpoch cast at Lines 18 and 23; applying that consistently keeps the fixtures structurally validated.

♻️ Proposed direction
-      providerEpoch: 'provider-a' as never,
+      providerEpoch: 'provider-a' as SshProviderEpoch,

For the three maps, drop as never and let TypeScript check the entries; if setState rejects them, that signals a genuine shape mismatch worth fixing in the fixture rather than casting away.

Also applies to: 290-306, 391-414

src/renderer/src/store/slices/direct-ssh-terminal-authority-ledger.ts (2)

177-178: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Self-comparison makes the authority check in liveBindingMatches a no-op here.

liveBindingMatches(sourceTab, live, live.authority) always satisfies the equality branch, so only tabGeneration/ptyId are validated. Currency is still enforced by args.isAuthorityCurrent(authority) at Line 196, but passing the binding's own authority reads as a check that isn't one — consider a dedicated predicate (or a short comment) so a later reader doesn't assume this line fences authority.


219-225: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace the non-null assertion with an explicit branch.

liveLease!.ptyId is only sound because the args.detachedPtyId || liveLease guard implies liveLease when detachedPtyId is falsy — a relationship the type system can't see, so a future edit to Line 219 silently turns this into a runtime undefined.

♻️ Suggested restructure
-    if (args.detachedPtyId || liveLease) {
+    const targetPtyId = args.detachedPtyId ?? liveLease?.ptyId
+    if (targetPtyId) {
       nextLiveBindings[args.targetTabId] = {
         attemptId: sourceLease.attemptId,
         authority,
         tabGeneration: targetTab.generation ?? 0,
-        ptyId: args.detachedPtyId ?? liveLease!.ptyId
+        ptyId: targetPtyId
       }
     } else if (pendingLease) {
src/renderer/src/hooks/useIpcEvents.ts (1)

2590-2621: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Hydrate targets concurrently so one slow target can't stall the rest.

The loop awaits ssh.getState and the port snapshots per target sequentially, so startup hydration cost scales with target count and a single unresponsive target blocks every later one (there's no timeout on these calls). The per-target watermark check already makes each iteration independent, so running them in parallel is safe.

♻️ Sketch
-        for (const target of targets) {
-          const hydrationWatermark = sshStateWatermarkByTargetId.get(target.id) ?? 0
-          const state = await window.api.ssh.getState({ targetId: target.id })
-          ...
-        }
+        await Promise.all(
+          targets.map(async (target) => {
+            const hydrationWatermark = sshStateWatermarkByTargetId.get(target.id) ?? 0
+            const state = await window.api.ssh.getState({ targetId: target.id })
+            // ...unchanged body...
+          })
+        )
src/renderer/src/store/slices/store-cascades.test.ts (1)

1376-1439: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a case for the pending-continuation detach (no detachedPtyId).

Both new tests pass a truthy detachedPtyId, so they only exercise the live-promotion branch of transferDirectSshPaneDetachLedger. The hasEmptyPendingContinuation path (Lines 170-176 / 226-234 of direct-ssh-terminal-authority-ledger.ts) — where both tabs carry pendingActivationSpawn and the pending lease is copied to the target's retry map rather than the live map — is the subtlest branch and is currently untested.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9acf81eb-bc5d-47ee-8c4f-082298c12942

📥 Commits

Reviewing files that changed from the base of the PR and between 650dff3 and 83bed15.

📒 Files selected for processing (103)
  • config/reliability-gates.jsonc
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/main/ipc/repos-remote.test.ts
  • src/main/ipc/repos.ts
  • src/main/ipc/ssh.test.ts
  • src/main/ipc/ssh.ts
  • src/main/ipc/worktrees.test.ts
  • src/main/ipc/worktrees.ts
  • src/main/runtime/public-ssh-state.test.ts
  • src/main/ssh/ssh-connection-manager.test.ts
  • src/main/ssh/ssh-connection.test.ts
  • src/main/ssh/ssh-provider-authority.test.ts
  • src/main/ssh/ssh-provider-authority.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/preload/ssh-authority-forwarding.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-types.ts
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.ts
  • src/renderer/src/env.d.ts
  • src/renderer/src/hooks/direct-ssh-host-hydration-scope.ts
  • src/renderer/src/hooks/direct-ssh-host-hydration-telemetry.ts
  • src/renderer/src/hooks/direct-ssh-host-hydration.test.ts
  • src/renderer/src/hooks/direct-ssh-host-hydration.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-coordinator-outcomes.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-coordinator-stabilization.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-coordinator-telemetry.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-coordinator-types.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-coordinator.test.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-coordinator.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-preparation-metrics.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-preparation.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-rollout.test.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-rollout.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-tokens.ts
  • src/renderer/src/hooks/direct-ssh-runtime-wake-isolation.test.tsx
  • src/renderer/src/hooks/direct-ssh-state-routing.test.ts
  • src/renderer/src/hooks/direct-ssh-state-routing.ts
  • src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-cancellation.ts
  • src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-metrics.ts
  • src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler-types.ts
  • src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler.test.ts
  • src/renderer/src/hooks/direct-ssh-worktree-refresh-scheduler.ts
  • src/renderer/src/hooks/direct-ssh-worktree-refresh-target-queue.ts
  • src/renderer/src/hooks/remote-workspace-session-merge.ts
  • src/renderer/src/hooks/remote-workspace-snapshot-apply.ts
  • src/renderer/src/hooks/remote-workspace-target-sync.test.ts
  • src/renderer/src/hooks/remote-workspace-target-sync.ts
  • src/renderer/src/hooks/useIpcEvents.test.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/direct-ssh-reconnect-product-telemetry-types.ts
  • src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.test.ts
  • src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.ts
  • src/renderer/src/lib/direct-ssh-target-owner-index.ts
  • src/renderer/src/lib/direct-ssh-target-scope-types.ts
  • src/renderer/src/lib/direct-ssh-target-scope.test.ts
  • src/renderer/src/lib/direct-ssh-target-scope.ts
  • src/renderer/src/lib/workspace-session-hydration-keys.ts
  • src/renderer/src/runtime/runtime-client-events.test.ts
  • src/renderer/src/runtime/runtime-client-events.ts
  • src/renderer/src/runtime/runtime-environment-ssh-state.test.ts
  • src/renderer/src/runtime/runtime-environment-ssh-state.ts
  • src/renderer/src/startup/ssh-startup-reconnect.test.ts
  • src/renderer/src/store/slices/bulk-worktree-purge-terminal-maps-leak.test.ts
  • src/renderer/src/store/slices/detected-worktree-refresh-leases.test.ts
  • src/renderer/src/store/slices/detected-worktree-refresh-leases.ts
  • src/renderer/src/store/slices/direct-ssh-pane-detach-ledger.test.ts
  • src/renderer/src/store/slices/direct-ssh-pane-retry-ledger.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-authority-ledger.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-recovery-types.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-recovery.test.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-recovery.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-retry.test.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.test.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.ts
  • src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts
  • src/renderer/src/store/slices/runtime-environment-ssh.test.ts
  • src/renderer/src/store/slices/ssh-target-cleanup.ts
  • src/renderer/src/store/slices/ssh.test.ts
  • src/renderer/src/store/slices/store-cascades.test.ts
  • src/renderer/src/store/slices/tabs.test.ts
  • src/renderer/src/store/slices/tabs.ts
  • src/renderer/src/store/slices/terminal-activation-spawn-suppression.ts
  • src/renderer/src/store/slices/terminals-hydration.test.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/renderer/src/store/slices/worktree-helpers.ts
  • src/renderer/src/store/slices/worktrees.test.ts
  • src/renderer/src/store/slices/worktrees.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/shared/detected-worktree-provider-contract.ts
  • src/shared/direct-ssh-reconnect-telemetry-schema.test.ts
  • src/shared/host-lineage-contract.ts
  • src/shared/host-repo-catalog-contract.ts
  • src/shared/ssh-retained-payload-admission.test.ts
  • src/shared/ssh-retained-payload-admission.ts
  • src/shared/ssh-types.test.ts
  • src/shared/ssh-types.ts
  • src/shared/telemetry-events.ts
  • tests/e2e/helpers/docker-ssh-relay-connection.ts
  • tests/e2e/ssh-docker-relay-perf.spec.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/preload/api-types.ts
  • src/main/ipc/repos-remote.test.ts
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/preload/index.ts
  • src/main/ssh/ssh-provider-authority.ts
  • src/main/ipc/repos.ts
  • src/main/runtime/public-ssh-state.test.ts
  • src/main/ipc/worktrees.test.ts
  • config/reliability-gates.jsonc
  • src/main/ipc/worktrees.ts

Comment thread src/renderer/src/store/slices/tabs.ts Resolved
@OrcaWin

OrcaWin commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

@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

🧹 Nitpick comments (4)
tests/e2e/agent-session-quit-resume.spec.ts (1)

49-50: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider preserving other persisted launchConfig fields.

Replacing the whole object drops any additional fields the runtime persisted for resume (e.g. cwd/shell metadata), which makes the fixture less representative of a real resume record. Spreading keeps the stub focused on the command.

♻️ Optional refactor
-  record.launchConfig = { agentCommand: 'echo', agentArgs: '', agentEnv: {} }
+  record.launchConfig = { ...record.launchConfig, agentCommand: 'echo', agentArgs: '', agentEnv: {} }
src/renderer/src/components/terminal-pane/pty-connection.test.ts (2)

1786-1817: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: extract the repeated pending-retry fixture.

Lines 1786-1817, 1885-1916, and 1964-1995 duplicate the same pendingRetry + sshConnectionStates + tab fixture with only the attemptId/restoredPtyId varying. A small builder (createStaleReattachFixture({ attemptId, restoredPtyId })) would keep future contract changes to one place.


1877-1882: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assertions run inside the mocked connect implementation. Both new stale-reattach tests call expect(...) from within the transport mock that production code invokes, so a failing assertion can surface as a rejected connect() promise instead of a test failure.

  • src/renderer/src/components/terminal-pane/pty-connection.test.ts#L1877-L1882: store options.admitPtyId?.(restoredPtyId) in a local and assert it after the first await flushAsyncTicks().
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts#L1956-L1961: apply the same capture-then-assert change.
tests/e2e/helpers/orca-restart.ts (1)

153-173: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded fixture date will eventually go stale.

The sessions directory and JSONL timestamp are hardcoded to 2026-07-28. If Codex's real resume/session-discovery logic ever filters by recency, this fixture will silently stop matching "recent" once real time passes far enough beyond this literal date.

♻️ Derive the date dynamically instead of hardcoding it
   const seedCodexResumeRollout = (sessionId: string, cwd: string): string => {
+    const now = new Date()
+    const yyyy = String(now.getUTCFullYear())
+    const mm = String(now.getUTCMonth() + 1).padStart(2, '0')
+    const dd = String(now.getUTCDate()).padStart(2, '0')
     const sessionsDir = path.join(
       homeIsolation.isolatedHome,
       '.codex',
       'sessions',
-      '2026',
-      '07',
-      '28'
+      yyyy,
+      mm,
+      dd
     )
     mkdirSync(sessionsDir, { recursive: true })
-    const transcriptPath = path.join(sessionsDir, `rollout-2026-07-28T00-00-00-${sessionId}.jsonl`)
+    const transcriptPath = path.join(
+      sessionsDir,
+      `rollout-${yyyy}-${mm}-${dd}T00-00-00-${sessionId}.jsonl`
+    )
     writeFileSync(
       transcriptPath,
       `${JSON.stringify({
-        timestamp: '2026-07-28T00:00:00.000Z',
+        timestamp: now.toISOString(),
         type: 'session_meta',
         payload: { id: sessionId, cwd }
       })}\n`
     )
     return transcriptPath
   }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f84ae13c-951d-4b33-b375-faf4b260451b

📥 Commits

Reviewing files that changed from the base of the PR and between 83bed15 and 7be41d7.

📒 Files selected for processing (31)
  • config/reliability-gates.jsonc
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/main/ipc/worktrees.test.ts
  • src/main/ipc/worktrees.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-tokens.test.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-tokens.ts
  • src/renderer/src/hooks/remote-workspace-target-sync.test.ts
  • src/renderer/src/hooks/remote-workspace-target-sync.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.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/direct-ssh-reconnect-product-telemetry.test.ts
  • src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.test.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.ts
  • src/renderer/src/store/slices/tabs.test.ts
  • src/renderer/src/store/slices/worktrees.ts
  • tests/e2e/agent-session-live-force-exit-resume.spec.ts
  • tests/e2e/agent-session-quit-resume.spec.ts
  • tests/e2e/helpers/orca-restart.ts
  • tests/e2e/new-workspace-linked-item-project-switch.spec.ts
  • tests/e2e/terminal-opencode-altscreen-reveal-artifacts.spec.ts
  • tests/e2e/terminal-tab-close-restart-persistence.spec.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.test.ts
  • docs/reference/plans/2026-07-27-ssh-reconnect-fanout.md
  • src/renderer/src/hooks/remote-workspace-target-sync.ts
  • src/renderer/src/store/slices/direct-ssh-terminal-workspace-scope.ts
  • src/renderer/src/hooks/remote-workspace-target-sync.test.ts
  • src/renderer/src/hooks/direct-ssh-reconnect-tokens.ts
  • src/main/ipc/worktrees.test.ts
  • src/renderer/src/lib/direct-ssh-reconnect-product-telemetry.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/store/slices/worktrees.ts
  • src/main/ipc/worktrees.ts

@OrcaWin

OrcaWin commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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

AmethystLiang and others added 2 commits July 28, 2026 10:34
Capture the implementation-ready plan for host-qualified, epoch-fenced
SSH reconnect recovery after two rounds of multi-model LLM counsel review.
@OrcaWin
OrcaWin force-pushed the ssh-reconnect-fanout branch from ddce894 to e04a089 Compare July 28, 2026 17:35
@Jinwoo-H
Jinwoo-H merged commit a401833 into main Jul 28, 2026
73 of 75 checks passed
nwparker added a commit that referenced this pull request Jul 31, 2026
…#11065)

* fix(worktree): use local base after offline refresh failure

* docs: add git worktree bug queue report

* fix(skills): require updater registration (#11051)

* fix(skills): require updater registration

* fix(skills): reject incomplete updater registrations

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* test(worktree): satisfy changed-code quality gate

* docs: record #11065 CI repair status

* docs: record CI rate-limit evidence

* chore: keep bug category report out of product diff

* release: v1.4.160-rc.3

* fix(quality): enforce performance-safe lint baseline (#11074)

* fix(quality): clear safe existing lint findings

* fix(quality): keep lint cleanup allocation-free

* fix(quality): enforce performance-safe baseline

* test(terminal): drain deferred confirmation cleanup

* fix(preflight): refresh Windows PATH on forced CLI checks (#10091)

Refresh the persisted Windows PATH during preflight without blocking Electron's main thread. Bound and deduplicate registry reads, preserve the last good cache on failure, skip host refresh for WSL, and add Windows regression coverage.

* feat(new-workspace): type-ahead Project and Run-on pickers (#11062)

* feat(new-workspace): make the project picker a type-ahead field

The Create-worktree Project slot read as bulky and unpolished: a label row,
an add-project icon, a 36px outline trigger and a chevron, all spent before
choosing anything — then a popover carrying its own *second* search box,
two-line rows, and a footer that scrolled out of reach.

The field is now the search. Typing filters in place, so the nested search
box is gone. Exactly one row is armed at any time and Enter takes it;
hovering arms, so pointer and keyboard drive one cursor rather than two
competing highlights. Armed is tracked by row key, not index, so a list
arriving late over SSH cannot slide a different project under a keypress
the user already aimed.

Rows are single-line at 28px with an on-row Enter cap that takes space only
while armed, and "Add a new project" is pinned to the popover edge so it
survives every state — scrolled, filtered to nothing, or no projects at all.

Long names and deep paths degrade deliberately: the name keeps up to half
the row and the path elides from its middle, so two monorepo siblings stay
distinguishable as …/services/checkout-api vs -web where a flat truncate
rendered both identically.

Recency is derived from when each project last had a workspace created,
which is the action this picker is about to repeat — no new store field.

The shell keeps data-project-combobox-root + role=combobox and stays
focusable, so the composer's initial-focus and project-required handlers
still land on it.

* fix(new-workspace): align, scroll and loosen the project picker

Five fixes to the type-ahead picker, three reported and two found while
checking for related breakage.

Alignment: the name and its smaller detail line were centred as boxes, so
the 12px path sat visibly high against the 14px name. Both now share a
baseline, in the committed field and in every row. The dot mark and the
Enter cap are chips rather than text, so they stay centred on the row.

Scrolling: the mouse wheel did nothing over the list. The composer is a
Radix Dialog, and react-remove-scroll cancels wheel events for portaled
content outside the dialog's DOM tree — the scrollbar dragged fine but the
wheel was dead. The old cmdk list carried a shim for exactly this; the
plain scroll pane that replaced it did not, so it has its own now.

Density: rows go 28px -> 32px, row text 13px -> 14px and detail 11px ->
12px, with a taller Add row and more air above section headings.

Escape stranded a query: with the list closed but text still typed, Escape
was ignored (it was gated on the list being open), leaving the field
showing text that matched nothing and hid the committed project. Escape now
always restores the committed display, and only bubbles when there is
nothing to undo.

Listbox ownership: options sat inside unroled section and scroll wrappers,
which breaks the listbox -> option relationship assistive tech relies on.
Sections are groups carrying the heading as their label, and the scroll
pane is presentational.

Both new behaviours are covered by tests verified to fail without the fix.

* chore(tools): keep the project-picker design lab

The exploration harness behind the picker rewrite: 16 interactive design
variants rendered against the app's real tokens and shadcn primitives, so a
prototype is a drop-in ProjectCombobox rather than a mockup.

Worth keeping because the frames encode bugs that only reproduce in
context. DialogFrame renders the picker inside a real Radix Dialog, which
is the only way the react-remove-scroll wheel bug shows up; the fixtures
carry duplicate display names and deep sibling paths that a naive truncate
renders identically.

Run with: npx vite --config tools/wt-picker-lab/vite.config.ts

* fix(new-workspace): stop the project list flashing open, shrink its empty state

Opening the picker read as a double flash. The shared popover surface is
translucent and fades 0 -> 1, which is right over the app canvas but wrong
here: this popover lands directly on the composer dialog, so for the length
of the fade the Name field underneath showed straight through the list and
you saw two layers at once. The list now uses an opaque surface and zooms
without fading, so it is solid from the first frame. Every other popover
keeps the blur and fade.

The "No projects match your search." state was a 60px centred block sitting
next to 32px rows, which read as a different kind of surface and made an
empty result feel like an error. It is now sized and aligned like a row.

The lab's dialog frame focused whatever Radix picked first, which popped the
Add-project tooltip on open and masked the real problem; it now focuses the
name field the way the real composer does.

* fix(new-workspace): square mark, centred empty state, and keep the list open on tab-focus

Four fixes, three reported and one found while sweeping for others.

Square mark: the option dot had a `rounded-full` override, so a project read
as a circle here and a square everywhere else (jump palette, sidebar). Drop
the override and use RepoBadgeMark's own shape.

Centred empty state: "No projects match your search." was left-aligned after
being shrunk to row height; centre it.

Tab-focus blinked the list shut: the field lives in the popover's anchor, not
inside its content, so Radix's dismissable layer saw focus land "outside" and
closed the list the instant you tabbed in. Focus and pointer events within
this control no longer dismiss it; genuine outside events still do.

Junk text could strand the field: typing a query that matched nothing and
then clicking away left the text sitting there with the list closed, showing
no project and no error. A query only means something while the list is open,
so closing without committing now clears it.

On pressing Create with no project: no change needed. The create gate has not
depended on project selection since #4991, and both submit paths already call
showProjectRequiredError(), which sets the inline message and turns the field
red via aria-invalid. Verified end to end: the button is pressable, the press
paints the field destructive, and the message appears beneath it.

* feat(new-workspace): rebuild the Run-on picker to match the project picker

"Run on" was the last composer field still built the old way: an outline
trigger wrapping a cmdk list, two-line rows, and no way to search. It now
matches the project picker, so the two fields in the same form read as one
control.

The field is the search — type to filter hosts, paths and recipes with no
nested search box. Exactly one row is armed at a time and Enter takes it;
hovering arms, so pointer and keyboard drive one cursor. Rows are 32px with
the label and its path on a shared baseline, the path eliding from its
middle so two deep sibling paths stay distinguishable. The popover surface
is opaque and unfaded because it lands on the composer dialog, where a
translucent fade shows the form underneath.

Two behaviours the project picker doesn't have are preserved. Disconnected
hosts keep their inline Connect action, tracked per host so one stalled
connect never blocks the others, and the list stays open so the connecting
state is visible. Two rows open nested lists rather than committing: VM
recipes, and "Add host" pinned to the popover edge so it survives every
state — scrolled, filtered to nothing, or with no hosts at all. Enter and
ArrowRight open a submenu; Escape backs out one layer at a time.

Extracted from NewWorkspaceComposerCard (-563 lines) into files that each
stay under the line limit without a suppression.

Tests: the run-target cases asserted cmdk internals (`[cmdk-item]`,
aria-disabled, cmdk-separator) that no longer exist. Rewritten against
behaviour and the listbox roles instead. All 22 composer tests pass,
plus a live sweep of 11 interactions in a real dialog.

* fix(new-workspace): drop the Enter cap, fix submenu hover, match the Add rows

Three follow-ups on the two composer pickers.

The ↵ cap on the hovered row is gone from both. On a run-target row it sat
next to the Connect action and read as a second, competing affordance; the
highlight already says what Enter will take.

Submenu rows never highlighted under the pointer. They passed a hardcoded
`armed={false}`, so the recipe list and the Add-host choices were the only
rows in either picker with no hover state. They now track their own hover.

"Add a new project" used a chunky FolderPlus where "Add host" uses a plain
Plus. Both rows were already the same height and type, so matching the glyph
is the whole difference.

* fix(new-workspace): restore the folder glyph, two-line Add-host cards, quiet Connect rows

Three follow-ups.

"Add a new project" goes back to FolderPlus — matching "Add host"'s plain
Plus made the two consistent but lost the glyph that says which kind of
thing is being added.

A disconnected host row no longer repeats its status. The Connect button
already says the host isn't connected, so "Connect this host to set up
projects" beside it was saying it twice. Rows without a Connect action keep
their detail, since there it explains why the host can't run.

The Add-host choices go back to two-line cards. Their descriptions explain
what you're picking ("Use an existing machine over SSH" vs "Pair another
Orca runtime"), unlike a host row's detail, which just labels a host you
already recognise. RunTargetRow grows a `stacked` variant for that rather
than making the single-line row do both jobs.

* fix(new-workspace): give Run on the same vertical rhythm as the other fields

Run on is nested inside the Project block so the two share its error and
empty states, which also put it on that block's 4px internal spacing. It
reads as its own field, so it sat noticeably tighter than the 16px gap
every other field in the composer gets. Pad it to match.

* refactor(new-workspace): share the type-ahead machinery between both pickers

Project and Run on were built one after the other, so each grew its own copy
of the same mechanics: query and open state, arming by row key, the
arrow-key walk, scroll-the-armed-row-into-view, the react-remove-scroll
wheel shim, and the closes-drops-the-query rule. Two copies of subtle
behaviour is two places for it to drift.

useTypeAheadCombobox now owns all of it. Callers pass a function that turns
a query into row keys and get back the query, the armed key, and the
movement helpers. Run on layers its submenu state on top by wrapping
`close`, which is the only part that isn't shared.

The two long class strings both files repeated verbatim — the field shell
and the opaque unfaded popover surface — are named constants now, so the
reason they differ from the stock popover recipe is written down once
instead of implied by a duplicated literal.

No behaviour change: 16,456 renderer tests pass, plus the 22-check live
interaction sweep across both pickers in a real dialog.

* fix(new-workspace): drop aria-expanded from option rows, remove the design lab

`aria-expanded` isn't a supported prop on `role="option"`, so the submenu
rows were claiming a state screen readers can't interpret there.
`aria-haspopup` alone already says the row opens a menu.

Removes tools/wt-picker-lab. It was the harness for exploring this redesign
— 12 interactive variants — and it did its job, but the 11 that lost are
dead code, and its prototypes were the only thing failing the react-doctor
gate (5 errors, all in throwaway variants; the shipped pickers had none).

* fix(workspaces): support emoji-only names

* feat(workspaces): derive readable emoji identifiers

* feat(workspaces): add emoji shortcode picker

* fix(terminal): gate the developer menu behind Option and unblock manual parking (#11091)

The Developer submenu shipped visible on every worktree right-click, and its
Park terminal action always refused with "These terminals cannot be parked
safely."

- reveal the Developer submenu only when Option/Alt is held at right-click,
  captured at open time so it can't shift rows mid-menu
- stop a settled pendingActivationSpawn tag from refusing a manual park: first
  activation stamps it on every tab and only a fresh updateTabPtyId consumes it,
  so a reattached tab kept it forever
- resolve the single leaf of a rootless layout for parked watcher coverage, so a
  workspace whose panes never mounted is no longer permanently uncoverable
- restore the !isVisible park guard dropped in #11016, which let the workspace
  being viewed unmount its own terminals
- split manual-park eligibility out of the automatic cold-park policy module

* fix(workspaces): hide false repo error for remote servers (#11050)

* i18n: translate orchestration page and workflow messages (#11097)

Add translations for OrchestrationPage coordinator and child PR names, plus agent workflow status messages (initial states and progress beats) across all supported languages (English, Spanish, Japanese, Korean, Simplified Chinese).

* fix(skills): stop reporting a failed update when the CLI succeeded (#11105)

The Update skills dialog showed "The update didn't finish" / "Some skills
could not be updated" with an armed Retry, directly above the runner's own
log line saying "All global skills are up to date" — on a clean exit 0.

`skills update` compares its lock's recorded hash against the source and
never reads disk (dist/cli.mjs: `latestHash !== entry.skillFolderHash`).
Once the lock has advanced past the installed bytes it prints up-to-date,
exits 0 and writes nothing. The copy left behind is a recognised older
revision, so the post-run re-scan sees `outdated`, skillUpdateFailedNames
counted that as a failed run, and skill-update-run settled to state 'error'.
Retry re-ran the same command, which no-op'd again — a closed loop.

Reclassify `outdated` as "the command did not converge this", not "the run
failed". The freshness badge still marks the copy not-current, so nothing is
hidden; the run just stops being blamed for it.

A botched write is still caught: a half-written bundle hashes to
`unrecognized`, a wholly-degraded or removed copy leaves no convergent
placement, and process-level failure still surfaces via the spawn error.

Reachable by anyone who updated during the stub conversion window — every
bundled skill has a stub -> full -> stub oscillation in its last three
registry revisions.

* perf(terminal): eliminate adverse control and frame-gate cases (#11045)

* perf(terminal): eliminate dense control and frame gate regressions

* test(terminal): keep gate labels in valid expect shape

* test(terminal): expose the surviving sub-threshold control-density case

The only adverse strip fixture sat at 50% control density, which is exactly
where the fallback fires and wins. A shape at 31 controls per 64-unit block
evades the trigger and still loses to the per-character legacy (0.67x), so the
benchmark structurally could not show it.

Add that fixture, pin both density literals in the staleness guard so a retune
fails loudly instead of silently measuring a boundary that moved, and export
the probe constant the equivalence test was hardcoding.

* fix(opencode): harden lifecycle status delivery (#11017)

* fix(agent-status): show Codex v2 subagents (#11059)

* fix(agent-status): track Codex rollout subagents

* fix(agent-status): resolve cross-day Codex child rollouts and unblock CI gate

Codex files each rollout under its own local start date, so a session that
runs past midnight spawns children into a sibling day directory. Scanning
only the parent's directory left 13% of real subagent spawns (48/371 across
local rollouts) permanently unresolved, which pinned a phantom "working" row
and re-ran readdirSync every poll tick forever. Resolve the child's own day
directory from occurred_at_ms, and time-box a child whose rollout stays
unreadable so a deleted or never-written file can't leak a working row.

Also make the hook HTTP handler return void: the changed-code quality gate
keys findings by span overlap, so this PR's added line inside the pre-existing
async createServer callback resurfaced no-misused-promises as a new finding.

Tests cover cross-day resolution, grace-period retirement, and that the poll
re-arms across successive roster changes (the prior tests passed even when
the poll died after its first change).

* fix(agent-status): keep the Codex subagent poll alive across nested hooks

A nested non-codex CLI inherits its parent's ORCA_PANE_KEY, so its hook
POST reached scheduleCodexSubagentPoll and tore the timer down before the
source guard, silently ending polling while a rollout child was still live.

* fix(skills): stop offering an update the CLI provably cannot perform (#11110)

* Revert "fix(skills): stop reporting a failed update when the CLI succeeded (#11105)"

This reverts commit a8660839ee734714d4236fd00d960cfde9d97353.

* fix(skills): stop offering an update the CLI provably cannot perform

The Update skills dialog reported "The update didn't finish" / "Some skills
could not be updated" with an armed Retry, directly above the runner's own
"All global skills are up to date" log line, on a clean exit 0.

`skills update` decides what to do by comparing its lock's `skillFolderHash`
against the source tree and never reads disk (published CLI, dist/cli.mjs:
`latestHash !== entry.skillFolderHash`). So once the lock records a revision
the filesystem does not actually have, it reports up-to-date, exits 0 and
writes nothing. No retry converges it.

Gate eligibility on that instead of blaming the run afterwards: a name stays
updatable only while the lock's hash and the revision the DISK hashes to
agree. Those that disagree fall through to `needs-attention`, which
skill-freshness-display-status.ts already documents as the state for a copy
"out of date somewhere the update command cannot reach". The dialog no longer
offers them, so it can neither claim failure nor claim success.

Deliberately compared against disk, not the bundled manifest: the updater
pulls from the source repo, which legitimately runs ahead of what a build
ships, and gating on the bundle would withhold real updates. Both sides must
also be positively identified — an unplaceable lock hash is not evidence.

Also reverts a8660839ee, which forgave `outdated` post-run. That turned the
false failure into a false success ("Updated 2 skills" over copies nothing
wrote) and let an empty verdict swallow spawnError, so an offline run
published green.

Reachable by anyone who updated during the stub-conversion window — every
bundled skill has a stub -> full -> stub oscillation in its last three
registry revisions.

* fix(skills): do not gate a skill when a placement is unidentifiable

`diskTreeShas` drops digests matching no known revision, so `every` ran over
only the resolved half — one stale copy beside one unidentifiable copy gated
the name, contradicting the unknown-stays-eligible rule the function documents.
Require every observed digest to resolve before treating all placements as
mismatched.

Caught by CodeRabbit on #11110.

* fix(skills): judge convergence only over placements the update command writes

A same-name plugin-cache or repo copy could defeat the gate two ways: an
unidentifiable repack read as an unresolved placement, and a cache copy
parked at the lock's own revision read as an anchor — both re-arming the
unwinnable update on a drifted canonical. Filter to
SUPPORTED_GLOBAL_SKILL_TOPOLOGIES, matching eligibility and outcome.

* perf(lint): consolidate code-quality gates into Oxlint (#11117)

Consolidate standalone code-quality scanners into Oxlint, preserve focused native/type-aware enforcement, add custom plugin coverage, and harden deferred PTY test cleanup.

* fix(browser): keep the address bar editable in a narrow toolbar (#11098)

* fix(browser): keep the address bar editable in a narrow toolbar

Every other browser toolbar control is shrink-0, so the address bar was
the only flexible item and absorbed the entire squeeze: below roughly
420px of pane width it collapsed to the leading globe icon with a
zero-width input. Clicking it only opened the suggestion dropdown, which
inherits `--radix-popover-trigger-width` and so rendered at icon width —
there was no way to type or edit a URL in that tab.

Focusing a squeezed bar now lifts the form out of the toolbar flow and
overlays the row edge to edge, giving a full-width editable field that
navigates on Enter (and a full-width suggestion list for free). A
measured slot stays in flow so the overlay cannot feed back into its own
width, and the slot keeps a min width so the globe remains a real hit
target instead of being overlapped by neighbouring buttons.

Fixes #11090

Claude-Session: https://claude.ai/code/session_01Mx53f7erbtw5NraS8HdXKE

* fix(browser): use the documented floating shadow for the expanded bar

STYLEGUIDE.md defines exactly three elevation levels and forbids a
fourth; shadow-md was not one of them. The overlaid address bar is a
floating surface, so it takes the documented floating shadow already
used by the other floating surfaces in this pane.

Claude-Session: https://claude.ai/code/session_01Mx53f7erbtw5NraS8HdXKE

* test(browser): make the narrow-toolbar regression deterministic

The spec passed only from a clean profile. Two preconditions it set once are
actively undone by the app:

- BrowserPane re-focuses a blank tab's address bar across several animation
  frames plus the blank-url did-finish-load handler, so a single blur() was
  reverted and the bar never reached its squeezed resting state.
- Startup paths re-open the right sidebar. At a fixed 700px window that leaves
  the pane ~70px, so the overlay had nowhere to go and the field measured 0px.

Settling these separately let whichever settled first drift back while the next
one ran. Re-assert them in one loop until they hold simultaneously, and size the
window from the chrome actually measured instead of assuming a fixed 700px.

Verified 8/8 green, and still fails at the overlay assertion when the fix is
disabled, so the regression coverage stays real.

---------

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>

* Improve orchestration migration safety for live legacy workers (#11107)

* fix(orchestration): clarify legacy migration safety

* fix(cli): sanitize legacy formatted messages

* test(runtime): allow near-cap fuzz under shard load

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(lint): restore nested config discovery in changed-code gate (#11130)

* docs: add WeChat group 6 QR with overflow guidance

Show group 5 and group 6 QR codes side by side so people can join group 6 if group 5 is full.

* fix(sidebar): restore legible selected-workspace fill in dark mode (#11139)

#8321 mixed the selected card's wash into the opaque --worktree-sidebar
surface, lifting dark mode to 16% (#4b4b4b). Card text lost too much
contrast against it.

Return both modes to a translucent wash (light 8%, dark 10%) so the
brighter selection border added by #8321 carries the selected state
instead of the fill.

Co-authored-by: Orca <help@stably.ai>

* fix(macos): avoid scene deadlock on app reactivation (#11055)

* fix(macos): avoid redundant focus on app activation

* test(macos): cover passive app activation

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(memory): retune image and orca.yaml ceilings that rejected valid input (#10815)

* fix(orchestration): reveal worker terminals reliably (#11142)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* ci(pr): run E2E when a PR touches tests/e2e paths (advisory) (#11131)

* ci(pr): run E2E when a PR touches tests/e2e paths

Regression specs under tests/e2e never ran on PR CI — only schedule and
release called e2e.yml — so a red regression test could merge green.
Path-filter and workflow_call the E2E suite when E2E-relevant files change.

Use merge-base diffs so base-branch drift does not false-trigger E2E, fail
the detector when git diff cannot compute the PR range, and pin
least-privilege contents:read on both the detector and reusable E2E workflow.

Closes #10518

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>

Co-authored-by: Orca <help@stably.ai>

* ci(pr): make the E2E path gate actually block, and match the real config path

Two fixes to the new path-filtered E2E job.

The gate did not gate. pr.yml's `verify` job is the required check, and it
enumerates its dependencies explicitly — `e2e` was in neither `needs` nor the
result list, so a failing shard left `verify` green. That reproduces the exact
hole this job exists to close: a red spec merges green, just with a red box
further down the page. Add `e2e` to both.

Because the job is path-filtered, `skipped` is the normal result on a PR that
touches no E2E files and has to keep passing. That allowance is checked after
the strict loop rather than inside it, so it can never leak to the six jobs
that are always required.

The `playwright.` pattern matched nothing. The config is
tests/playwright.config.ts — beside tests/e2e/, not inside it — so no tracked
file starts with `playwright.` and editing the runner config would silently
skip E2E. Anchor it at `tests/playwright.`.

Adds a contract test alongside the existing release-e2e one. Verified it fails
when either fix is reverted, and simulated the gate across
success/skipped/failure/cancelled plus the skip-must-not-mask-a-real-failure
case.

* test(ci): close two gaps in the E2E gate contract

CodeRabbit was right on both counts — verified by reverting each and watching
the contract stay green.

The path filter was unasserted, so `e2e` could lose its `if:` and run on every
PR — the cost the filter exists to avoid — without failing anything.

The strict-loop check hardcoded four of the six required jobs, so dropping
GIT_COMPATIBILITY or SHELL_CONTRACTS left them unenforced while the contract
passed. Derive the list from verify.needs instead, so a newly added required
job that misses the loop fails here rather than silently going unchecked.

* ci(pr): land the E2E path gate advisory instead of blocking

The E2E suite is currently failing every scheduled run on main — 22 of the last
22 — so making verify depend on it would block any PR touching tests/e2e/**,
including the PRs that fix the suite. This PR's own run reproduced that: 3 of 12
shards failed on specs unrelated to it (agent-session resume, Jira linking,
plugin containment, terminal artifacts).

So the job runs and reports on E2E-path PRs but is left out of verify.needs for
now. The detector, the tests/playwright. path fix, and the contract tests are
unaffected — those stand on their own and were the substance of the review.

Flipping to blocking is a three-line change once the suite is green; the exact
wiring, including why the skipped allowance must sit outside the strict loop, is
recorded on verify's Require-successful-checks step. The contract test pins the
advisory choice so it reads as deliberate rather than as the unwired-gate bug it
originally caught, and still fails if the path filter, the strict-loop coverage,
or the config path regress.

---------

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
Co-authored-by: Orca <help@stably.ai>

* fix(orchestration): repair version-skewed run schemas (#11150)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(i18n): translate automation cadence labels (#11068)

The cadence picker now resolves Hourly, Daily, Weekdays, Weekly, and Custom cron through the renderer i18n catalog, with corrected zh/ko/es translations.

Supersedes #10044 (thanks @innocarpe) and #10045 (thanks @fsdwen).

Fixes #10043

* chore(i18n): drop orphaned cadence catalog keys (#11154)

Removes the lowercase hourly/weekly/custom entries from the AutomationSchedulePicker catalog node in all five locales. They were superseded by keys derived from the rendered labels in #11068, and the extractor only adds keys, so they stayed behind unreferenced.

Follow-up to #11068.

* test(cli): lock CLI-compatible timeout parse contract (#11206)

parsePositiveSafeIntegerNumericText mirrors the CLI's own Number()
coercion on purpose: text like `600000.000000000000001` is the budget
the CLI will actually wait on, so rejecting it here would leave the
relay and SSH kill timers shorter than the CLI's and cut the request
short. Document that and pin it with regression cases.

* fix(diff): stop file-tree navigation remounting combined diffs; make tree resizable (#11088)

* feat: add Trae CLI as a supported TUI agent (#10763)

* feat: [AI-GEN] add Trae CLI as a supported TUI agent

Closes #10579.

Wire trae-cli into the desktop and mobile agent catalogs following the
same integration pattern as other CLI agents (e.g. Ante, Devin):

- src/shared/types.ts, tui-agent-config.ts: register 'trae' with
  detectCmdAliases (traecli/trae-agent) and argv prompt injection,
  matching trae-cli's `trae-cli [prompt]` contract. The CLI's own
  third documented alias `ta` is intentionally excluded — too generic
  a 2-letter name to use as a PATH-existence detection signal without
  false-positiving on unrelated tools.
- src/shared/trae-headless-command.ts: recognize `--print`/`-p` and
  `--output-format json|stream-json` as one-shot headless invocations
  (same shape as claude-headless-command.ts) so they aren't mistaken
  for a live interactive session.
- agent-kind.ts, telemetry-events.ts, agent-status-types.ts,
  agent-type-label.ts, tui-agent-display-names.ts,
  tui-agent-permissions.ts (YOLO via trae-cli's own --yolo flag),
  tui-agent-selection.ts: standard per-agent registrations.
- agent-catalog.tsx, agent-favicon-assets.ts,
  mobile/src/tasks/mobile-tui-agents.ts,
  mobile/src/components/mobile-agent-icon-assets.ts: catalog entries
  and bundled favicon (fetched from docs.trae.cn, required by mobile's
  offline-icon invariant test).
- i18n: add the "Trae" label to all five locale catalogs (en/es/ja/ko/zh).
- Tests: agent-process-recognition, agent-status, tui-agent-startup.

Verified with `pnpm typecheck` (desktop + mobile), the relevant vitest
suites (869 tests across 12 files, all green), oxlint (clean), and a
real end-to-end launch of the actual trae-cli binary through Orca's
pty.spawn IPC path (confirmed via the OS process table).

* fix: [AI-GEN] point Trae catalog entry at the real CLI quick-start doc

docs.trae.cn/cli (what the installed CLI's own --help text prints as
its "User manual" link) soft-404s — the docs site restructured and the
working page is docs.trae.cn/cli_get-started-with-trae-cli (confirmed
by HTTP fetch: real page title "TRAE CLI 快速开始" vs the old path's
"404 - 页面不存在"). Addresses CodeRabbit's homepageUrl review comment.

* fix: [AI-GEN] detect Trae on traecli, not the ambiguous trae-cli name

Per @AmethystLiang's review: the open-source bytedance/trae-agent
project (MIT, ~12k stars) registers its own console script as
`trae-cli` (pyproject.toml: `trae-cli = "trae_agent.cli:main"`), an
entirely unrelated CLI with a different contract (`trae-cli run
"task"`, `-p` short for `--provider`). Detecting on bare `trae-cli`
would false-positive on that project's installs and break launch for
anyone who has it instead of the actual TRAE CN CLI.

- tui-agent-config.ts: detectCmd/launchCmd/expectedProcess -> `traecli`
  (TRAE CN's own installer symlinks this alias too, but the other
  project does not ship it). Dropped the `trae-agent` alias entirely —
  it's the colliding project's literal repo name, the highest
  false-positive string available.
- agent-catalog.tsx: cmd -> `traecli` to match; faviconDomain ->
  `www.trae.cn` (bare `trae.cn` 404s on Google's favicon service;
  `www.trae.cn` is the product-root domain that actually resolves).
- mobile-tui-agents.ts: faviconDomain -> `www.trae.cn` to match.
- Tests updated: agent-process-recognition now asserts `trae-cli` and
  `trae-agent` are NOT recognized as Trae (regression guard against
  reintroducing the collision); tui-agent-startup updated for the new
  launch command.

promptInjectionMode stays `argv` and the headless-command file stays
as-is — both verified against the real TRAE CN CLI's actual --help
output (pasted in the PR review thread), not assumptions.

* refactor: [AI-GEN] share one print-mode headless matcher across agents

trae-headless-command.ts was a rename-only fork of claude-headless-command.ts,
and ante-headless-command.ts carried a third copy of optionName. Collapse both
print-mode files into print-mode-headless-command.ts, dispatch from a
Partial<Record<TuiAgent, ...>> table instead of an if-chain, and compress the
Trae comments to the repo's one-line style.

* fix: [AI-GEN] terminate Trae flag parsing before the positional prompt

`traecli` is a Cobra CLI with subcommands, so an argv prompt starting with
`help`, `config`, `-…` was dispatched as a subcommand or flag instead of being
run as the task. Add `argvPromptSeparator: '--'` (same reason Grok has it), and
stop the shared print-mode headless matcher at `--` so a prompt that reads like
`--print` no longer drops the pane out of agent recognition.

* docs: [AI-GEN] name both Trae CLIs explicitly in the detect-name comment

Co-authored-by: Orca <help@stably.ai>

* docs: [AI-GEN] drop the vendor tag from the Trae union comment

Co-authored-by: Orca <help@stably.ai>

* fix: [AI-GEN] guard the nullable startup plan in the Trae separator test

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: 陈泽榜 <chenzebang@jianzhikeji.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>

* chore: remove orchestration structured-output draft design doc from repo root

* fix(codex): re-confirm spurious shell readings before skipping the restart card (#11076)

An account switch decides pane eligibility from a single cached
inspectProcess read. When that read reports the pane's shell for a live
Codex session, the pane silently loses its restart card - no error, no
retry. Re-check shell readings on Orca-launched Codex panes with the
existing fresh-scan confirmForegroundProcess before trusting them; only
an affirmative codex answer flips the decision, so a genuine exit to the
shell stays uncarded and unsupported providers keep today's behavior.

* feat(dictation): add stop button and shortcut hint to Listening indicator (#11152)

* feat: bound direct SSH reconnect fan-out and recovery (#11003)

* docs: design for direct SSH reconnect fan-out

Capture the implementation-ready plan for host-qualified, epoch-fenced
SSH reconnect recovery after two rounds of multi-model LLM counsel review.

* docs: reconcile SSH reconnect fan-out design

* docs: close reconnect design consistency gaps

* feat: implement bounded direct SSH reconnect recovery

* fix: bound direct SSH retry settlement

* fix: harden direct SSH reconnect authority

* fix: preserve split SSH retry ownership

* fix: preserve SSH split continuation authority

* docs: record final SSH reconnect validation

* fix: preserve SSH authority through retained and detached state

* fix: retain SSH authority across delayed split mounts

* fix: close SSH authority recovery gaps

* fix: fence stale SSH transport replacement

* fix: serialize SSH target teardown

* fix: settle SSH teardown failures before reconnect

* fix: retire failed SSH reset sessions

* test: reconcile current main E2E contracts

* fix: close direct SSH reconnect review gaps

* fix: fence stale SSH reconnect side effects

* fix: close final SSH reconnect lifecycle gaps

* test: stabilize current-main reliability gates

* test: prove plugin navigation containment

* test: make plugin navigation oracle authoritative

* test: make plugin navigation oracle deterministic

* ci: allow sharded e2e suite to finish

* test: wait for runtime pane publication

* test: classify pane readiness by error code

* test: select close persistence terminal by tab identity

* docs: mark reconnect implementation validated

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* Improve translations for resource manager and related UI elements (#11205)

* Improve translations for resource manager and related UI elements

Standardize terminology ("daemon" vs "service"), complete missing translations, and refine wording across Spanish, Japanese, Korean, and Chinese locales for consistency and clarity.

* Improve translations for resource manager and related UI elements

* fix(test): update zh name-mode label expectation after translation fix

The resource-manager translation pass correctly changed the Chinese
"Name" label from 姓名 to 名称; update the localized options unit test
to match so CI passes.

* fix(native-chat): surface draft launch context in desktop and mobile chat composers (#9802)

* fix(native-chat): surface draft launch context in chat composers

Creating a workspace from a GitHub issue delivers the issue link only into
the agent TUI's input buffer (argv prefill or startup paste), so the chat
view showed no trace of it on desktop or mobile.

Desktop: draft launches now seed an in-memory launch draft keyed by tab id
(direct work-item launches, background GitHub work-item creates, quick-create
composer, and new-tab draft deliveries). The chat composer adopts the seed
once as its editable draft, declines permanently if the composer already has
text, and drops an untouched copy when any user turn lands (the one-line TUI
input means the prefill was submitted or deliberately cleared) or on its own
send, whose existing input pre-clear retires the TUI copy.

Mobile: the host publishes the draft as an optional launchDraft field on the
mobile terminal tab snapshot (additive, no protocol bump) and the mobile
composer adopts it with the same once-only/decline/resolve semantics. Mobile
chat sends now also pre-clear the TUI input line (Ctrl+U, desktop parity) so
a pending prefill cannot concatenate with the sent message.

Completion seeding resolves the launch tab from the synced store tabs when
the backend spawned the terminal and activation reports no primaryTabId.

Split the Windows shell-quoting tests into their own file to stay within the
max-lines budget.

* revert(mobile): drop incidental pnpm-lock churn from the launch-draft branch

The libc binding fields and the @typescript-eslint peer re-resolution came from
a local install, not from this change; mobile/package.json is untouched.

* fix(native-chat): resolve launch drafts without trusting cross-host clocks

The rule required a user turn stamped at or after the seed. Grok omits row
timestamps, so a Grok launch draft never resolved; and the seed time is a
renderer clock while the stamp comes from the executing host's JSONL, so a
remote workspace whose clock trailed never resolved either. Both left the
composer adopting an already-submitted prefill, which re-sends it as a
duplicate turn.

Resolve on any user turn that is not PROVABLY older than the seed (a launch
draft's session starts with zero user turns), with the existing cross-host
skew slack, plus a timestamp-free backstop for wider skew: a new tail user
turn since the draft was first observed. "Load earlier" prepends, so it
cannot move the tail and cannot over-resolve.

Split out of native-chat-pending.ts to stay under the max-lines ratchet.

* fix(worktrees): seed the launch draft on the agent's own tab, never on tabs[0]

Two defects in the completion seed:

- The tab was resolved by array position. buildStartupOpt returns undefined on
  the backend-spawn path, so applyDefaultTerminalTabs stamps launchAgent on no
  tab and the launchAgent guard was dead there. A repo with default terminal
  tabs ("dev server", "logs", ...) got the draft on a tab that runs no agent,
  and then published it to mobile as THAT tab's launchDraft. Correlate on the
  backend startup tab, then on a launchAgent-stamped tab, then on primaryTabId
  (which is the agent tab whenever the renderer owns startup); never tabs[0].

- Runtime-owned worktrees mirror their session tabs async, so tabsByWorktree
  was empty at seed time and the seed was silently dropped for that whole host
  class. Defer to the first mirrored tab via the existing delayed-delivery
  queue, which now holds every pending delivery for a worktree instead of one
  (setup/issue commands and the seed both wait on the same first tab).

* fix(store): evict nativeChatLaunchDraftByTabId on every teardown path

The new map was absent from all four paths its sibling
nativeChatLaunchPromptByTabId participates in: tab close, the orphan terminal
sweep, the bulk worktree purge, and the removeWorktree teardown. A stranded
entry is worse than a plain leak here because sync-runtime-graph keeps
publishing it to mobile as that tab's launchDraft.

* fix(native-chat): only seed single-line unsubmitted launch drafts

The unsubmitted-delivery branch seeded on every draft delivery, which also
caught the agent-session-fork path whose prompt is multi-line scraped context.
The chat send pre-clears the TUI with Ctrl+U (kill-to-start-of-LINE), so a
multi-line prefill cannot be fully cleared and its earlier lines would glue
onto the next message. The GitHub work-item draft this feature targets is a
bare issue URL, so narrowing costs it nothing.

Also assert the composer retires the seed after a send — deleting that call
previously failed no test.

* fix(mobile): stop the chat pre-clear from wiping a just-pasted image

The text write set clearInputFirst unconditionally. On the image path that
Ctrl+U lands AFTER pasteMobileNativeChatImagePaths already pasted the image,
so the agent receives the text alone while acceptSend still renders the
thumbnail on the sent bubble — silent image loss.

Desktop's image path clears exactly once, before the paste, and never again;
mobile now matches: pre-clear only when nothing was deliberately pasted first.
The image paste already leads with its own Ctrl+U, so a launch-draft prefill
parked on the input line still cannot glue onto the message.

Pinned at both levels: the controller test drives the real send hook and
asserts clearInputFirst per branch, and the send module asserts the wire text
carries no leading \x15. The image-attachments test injects its own baseSend,
so it structurally could not observe this.

* fix(mobile): hold the launch-draft prefill until the transcript settles

session.tabs delivers launchDraft before the transcript read resolves, so the
seed effect could run against an empty in-flight message list and miss the
user-turn decline. Launching from an issue, submitting the prefill in the TUI,
and never opening desktop chat (nothing else clears the host seed) then
prefilled the mobile composer with the already-sent issue link — a send tapped
before it retracted duplicated it to the agent.

Thread the session's loading state through and skip the seed while the read is
in flight. idle/waiting-session still seed: no session means no user turns.

* fix(runtime): publish a launch draft to mobile only for the tab's own agent

The publish had no agent check while the desktop consumer declines on
mismatch. The seed is keyed by tab id, which survives a pane's agent switch, so
mobile could adopt a draft desktop refuses — seed for claude, never open
desktop chat, switch the pane to Codex, and mobile prefills the Codex chat with
the Claude-era issue link. Align publish with the consumer.

* fix(native-chat): take the launch-draft baseline only after the transcript loads

The timestamp-free backstop snapshotted the transcript's user turns on first
observation of the draft, which can happen while the read is still in flight and
`messages` is []. A pane bound to a session that already had user turns then
backfilled above that zero baseline with a different tail id, so clause 2
resolved and silently dropped the seed — the launch context never appeared, and
the feature no-oped for exactly the panes it was meant to serve. Clause 1 was
already correct there (that history is provably older than the seed).

Gate baseline capture and resolution on the transcript read settling, the same
shape mobile's drafts hook uses. Clause 1 is unchanged; while loading the merged
list is empty anyway, and a pane with live appends is never reported 'loading'.

Also restore clause 1's short-circuit: it scans with .some() again and only
allocates the user-turn list when falling through to the backstop.

NativeChatView sat at exactly the 400-line cap, so the composer's two
launch-draft props are now spread from the hook result they already mirror.

* fix(native-chat): reject multi-line launch drafts inside the seed helper

The single-line guard lived in deliverLaunchPromptToAgentTab, so the two
other seeding entry points (worktree create, direct work-item launch)
bypassed it — and every Linear launch is multi-line by construction
("Linked Linear issue: STA-…" + url). The chat send pre-clears the TUI
with Ctrl+U, which kills to start of LINE, so those earlier lines stay
parked to glue onto the next message.

* fix(worktrees): keep the deferred agent seed off ambiguous mirrored tabs

The runtime-owned deferred path fell back to tabs[0], which the module's
own docstring forbids: with repo default tabs ("dev server", "logs") the
seed lands on a tab running no agent, where mobile withholds it and
desktop's agent check ignores it — the feature is silently dead for that
create and the entry leaks until tab close.

The queue entry is consumed before delivery, so there is no retry to fall
back on; accept the first mirrored tab only when it is the worktree's
only one and so unambiguously the agent's.

* fix(mobile): treat a launch-draft-only session-tab frame as a change

mobileSessionTabEqual's terminal branch never compared launchDraft, and
the route keeps `prev` when tabs compare equal — so a publish whose only
delta is the draft appearing or retracting was discarded and never
reached the composer. Live QA passed only because agentStatus happened to
change in the same frame.

MobileSessionTab's terminal variant did not declare the field either
(the controller read it through the structurally wider
MobileNativeChatTab), which is why TypeScript never flagged it.

* fix(mobile): judge a launch prefill only from its own settled transcript

Two ways the drafts hook was reading a transcript that was not the active
chat's:

- transcriptLoading came from `status`, a plain useState written by a
  passive effect declared before the drafts hook. On the commit where the
  tab identity changes it still holds the previous tab's value, so the
  guard was off on exactly the render that seeds: first entry saw
  status 'idle' with an empty list and seeded an already-submitted link,
  and a tab switch declined the new tab's prefill from the old tab's
  turns. The session hook now tracks the identity its messages describe
  and reports transcriptLoading until they agree; the retire effect gates
  on it too.
- Leaving chat view nulled launchDraft while draftKey stayed the same,
  which the hook could not tell from a host retraction — it declined the
  prefill permanently, so peeking at the terminal dropped the context.
  The controller now passes the raw field plus an explicit chatActive
  flag, and both effects hold their state when the tab is not on chat.

The controller wiring was previously unasserted: replacing both props
with constants left all 795 mobile session tests green.

* fix(native-chat): keep the launch-draft baseline across a transcript reload

baselineKey went null whenever the transcript was loading, and the null
branch DISCARDED an already-valid baseline taken from a settled read. It
was then re-taken from the fuller list, swallowing the very user turn
that resolves the draft — so a stale prefill gets re-adopted as a
duplicate turn. Key the baseline on draft identity alone and gate only
the capture.

session.status is also not a truthful read-in-flight signal: a live
'working' hook outranks 'loading', so the guard could be off over an
in-flight empty list. Expose the read phase itself and gate on that.

* test: cover the launch-draft reducers and the sync-key skip gate

Every consumer test injects the three launch-draft reducers as bare
vi.fn()s, so reducing markNativeChatLaunchDraftAdopted to a no-op left
2609 tests green — while in the app the composer would resurrect the
prefill after every manual clear.

canSkipRuntimeMobileSessionSyncKeyBuild had no launch-draft case either:
when it skips, the sync key is never even built, so the existing
getRuntimeMobileSessionSyncKey case cannot catch its removal.

* fix(native-chat): hold the launch-draft baseline in state, not a render-mutated ref

react-compiler rejects reading or writing a ref during render. Adjust the held
baseline with the sanctioned render-time setState instead, keeping the local
copy so the render that first sees a settled transcript resolves against it.

* fix(mobile): carry the transcript identity in the session read state

react-doctor flags the separate loadedIdentity state as an extra render for a
derivable value. Hold status alongside the identity it describes in one state
written by the subscription effect, so transcriptLoading derives from it.

* test(native-chat): assert the readPhase contract without the hook-status race

The test asserted status === 'working', which depends on liveStatusOverride
winning over ambient transcript state — green locally, red under CI load. The
contract is that readPhase stays 'loading' once live content unmasks status,
so assert exactly that; it still fails if readPhase derives from status.

* fix(mobile): derive pre-read chat status instead of writing it from the effect

react-doctor's no-derived-state-effect flags idle/waiting-session/loading being
set in the subscription effect: all three are pure functions of the props. Derive
them during render and keep state only for the genuinely async outcome, tagged
with the identity it describes.

The tag now gates `messages` too, so a just-switched tab never sees the previous
tab's transcript at all rather than seeing it behind a loading flag.

* fix(mobile): drop a settled chat read once its subscription is torn down

The settled outcome was only ever replaced by a newly arriving frame, so any
effect re-run that landed back on an already-settled identity resurfaced it over
a list the same effect had just cleared: 'ready' with no messages and
transcriptLoading false. Toggling out of chat view and back hit this every time
(the agent goes null, then returns), flashing the "start a chat" empty state over
a real conversation and opening the launch-draft seed's decline check on an empty
transcript. A reconnect did the same via the client dep.

Identity and client are the effect's only inputs, so tagging the read with both
and dropping it during render when either moves covers every re-run.

* fix: pr-bug-scan validated finding from #6471 (#6512)

* fix: address pr-bug-scan validated finding from #6471

stripTags now removes real markup (closing/self-closing/attributed/custom tags) outside the allow-list; only bare identifier-glued generics like Array<string> are kept. Blocks svg/center/custom leak a

* fix: address pr-bug-scan validated finding from #6471

stripTags now removes real markup (closing/self-closing/attributed/custom tags) outside the allow-list; only bare identifier-glued generics like Array<string> are kept. Blocks svg/center/custom leak a

* fix(mobile): harden markdown preview tag stripping

* fix(mobile): preserve angle-bracket prose while stripping tags

---------

Co-authored-by: orca-bug-scan-bot <orca-bug-scan-bot@stably.ai>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* feat(worktrees): support project-level worktree.sharedDirectories in orca.yaml (#10459)

* feat(worktrees): support project-level worktree.sharedDirectories in orca.yaml

Follow-up to #7549: `.worktreeinclude` copies gitignored paths into each new
worktree, which is right for `.env`/`.vscode/` but wrong for large rebuildable
directories. Copying `node_modules` per worktree is slow and duplicates disk,
and each worktree's install then diverges.

Adds `worktree.sharedDirectories` to `orca.yaml` — a versioned, in-repo list of
gitignored directories that are symlinked (shared) into every new local
worktree, so one install serves them all. Adds to, never replaces, the per-user
Worktree Shared Paths setting.

`createWorktreeSharedPaths` uses a new 'share' materialization mode that always
symlinks. The existing 'link' mode APFS clone-copies on macOS, which would give
each worktree an independent node_modules and defeat the point; 'link' and
'copy' behavior are unchanged.

Entries must exist as gitignored directories in the primary checkout; absolute
paths, `..` traversal, and `.git` are rejected. Resolution never throws, so a
malformed orca.yaml cannot block worktree creation. Remote (SSH) creation skips
this, as it does symlink paths and `.worktreeinclude`.

Closes #10451

* fix(worktrees): keep worktrees deletable after sharing a directory

A directory-only ignore rule (`node_modules/`, the common spelling) matches
the primary checkout's real directory, so the shared directory resolves and
gets symlinked — but it never matches the worktree's symlink, so Git reports
that link as untracked. Deletion only tolerated the per-user shared paths, so
every worktree in such a repo became permanently dirty: the clean preflight
threw "uncommitted or untracked changes" and `git worktree remove` refused
without --force.

Feed the configured `orca.yaml` shared directories into the same
tolerate-and-unlink machinery the per-user shared paths already use, at both
deletion call sites. The names are read unfiltered, since the create-time
resolver drops exactly the entry deletion needs most.

* test(worktrees): register createWorktreeSharedPaths in the runtime symlink mock

orca-runtime.ts imports createWorktreeSharedPaths, but the vi.mock factory for
../ipc/worktree-symlinks never listed it. Vitest resolves omitted exports
lazily, so this only stays green because no runtime test configures a repo with
worktree.sharedDirectories — the first one that does would fail on a mock
resolution error rather than on its own assertion.

* fix(source-control): don't count shared symlinks as uncommitted changes

A directory-only ignore rule (`node_modules/`) matches the primary checkout's
real directory but never the worktree's symlink, so Git reports the shared link
as untracked for the life of the worktree. That made every affected worktree
read as dirty: a phantom row in the diff view, and Create PR blocked with
`blockedReason: 'dirty'` telling the user to commit an entry they cannot
commit, because it is a symlink Orca created.

Status and the review-creation preflight now drop untracked entries that are
both declared shared (per-user shared paths or orca.yaml sharedDirectories) and
actually symlinks on disk. Both conditions are required, so a regular file at a
declared name, or a symlink nobody declared, still counts as user work. The
decision fails closed: anything not positively identified stays dirty.

The preflight moves to `--porcelain -z` so paths with spaces or non-ASCII bytes
are compared raw rather than C-quoted, with a parser that consumes the origin
field a rename emits instead of reading it as its own record.

Symlink detection moves to a leaf module: importing it from ipc/worktree-symlinks
would pull APFS cloning, and its child_process dependency, into the status graph.

SSH is unaffected and left alone — remote worktree creation skips the symlink
and shared-directory passes, so a remote worktree never has one.

* fix(source-control): wire shared links into local status

* fix(worktrees): resolve the status repo once and reject uncollapsed shared paths

`git:status` resolved the registered worktree's repo twice per call — once
inside `getLocalGitOptionsForRegisteredWorktree` and again for the shared-link
lookup — walking every repo's worktree meta on a polling path.

`apps/./web` also survived `sharedDirectories` normalization: `resolve()`
collapses it when the symlink is created but Git reports the collapsed path, so
every later comparison misses and the link reads as permanent untracked work.

Also stop resolving shared links for SSH repos in review creation: `repo.path`
names a path on the remote host.

Adds the missing wiring coverage for review creation and runtime status, plus
the untracked-only conjunct in both filters — all four were mutation-verified
to leave the suite green before these tests.

* test(worktrees): pin the resolver-to-status seam for shared directories

The resolver's output and the status filter were only tested apart — status
used a hardcoded `['node_modules']`. Feed the resolved directories back through
`getWorktreeSharedLinkPaths` into a real `getStatus` so a resolver that ever
returned a differently-spelled path can no longer leave the link showing as a
phantom untracked row.

* fix(worktrees): try a directory junction before a symlink on Windows

A plain `fs.symlink` needs Developer Mode or admin on Windows, so an ordinary
Windows user got EPERM, the per-path catch logged and continued, and the
worktree came up with no shared directory and no signal. A directory junction
needs no privilege, and the rest of the codebase already uses one for win32
directory links.

The symlink stays as a fallback rather than being replaced: a junction cannot
target a UNC path, and a WSL project's repo lives behind one, so replacing it
outright would trade the local-volume bug for a WSL regression.

Safe for the removal path either way — Windows reports a junction as both a
symlink and a directory, so the `isSymbolicLink()` unlink that runs before
`git worktree remove` still fires and still refuses to follow it.

* fix(worktrees): keep NUL bytes and tolerated links out of the removal error

The removal preflight switches to `git status --porcelain -z` whenever it has
shared links to tolerate, then attached that raw stdout to the error. `.trim()`
does not strip interior NULs, so the message reached the user as
`?? node_modules<NUL>?? precious.txt<NUL>` — raw control bytes, and it named the
shared link, the one entry that is not the user's work and cannot be committed
away.

Parse the NUL-delimited output once and use it for both the clean verdict and
the error text, so the two can never disagree about what blocks removal. The
`-z` switch stays: it is what keeps paths with spaces or non-ASCII names
comparable against the configured entry.

* chore(worktrees): drop stray reformatting and note why the SSH guard exists

Committing the merge staged 792 files, so lint-staged ran the formatter across
all of them and rewrapped three renderer files that were already unformatted on
main. Nothing was lost — they were byte-identical to main ignoring whitespace —
but they showed up in the pull request as unrelated changed files. Restored to
main's exact bytes.

Committed with --no-verify on purpose: the pre-commit formatter is what
introduced the rewrapping, so letting it run again would simply reapply it.
Every check it would have run was run by hand instead — lint, typecheck, and the
IPC and source-control suites all pass, and the three restored files are
expected to fail a format check because that is main's current state.

Also records why the connection guard on the shared-link lookup is not dead
code: the remote dirty check ignores those paths, so the guard's only effect is
avoiding a stray local read and the bad cache entry it would leave behind.

* refactor(source-control): drop a scan-everything guard and freeze the cached list

The dirty check built a filtered array only to read its length, so it always
scanned every status record; asking whether any record is untracked stops at the
first one and reads the same either way.

The cached shared-directory list was also handhanded out by reference, so a
caller that mutated it would corrupt every read for the rest of the cache
window. Marking the return readonly prevents that at compile time; copying on
return would work too but would allocate on the status-polling path, and there
is exactly one caller, which only spreads it.

* fix(mobile): exclude proxy fake-ip addresses from pairing QR (#10498)

* fix(mobile): exclude proxy fake-ip addresses from pairing QR

Clash/mihomo TUN interfaces in 198.18.0.0/15 were enumerated as pairing
candidates and could become the default QR endpoint. Phones then retry an
unroutable address forever. Drop those addresses from the pickable list (#10404).

* refactor(mobile): keep fake-ip filtering local

* test(mobile): cover fake-ip range boundaries

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* Bug floating workspace shortcuts route to main w (#10433)

* fix(floating-workspace): route panel shortcuts to the floating panel, not the main window

Floating-workspace close/index keyboard shortcuts leaked to the main
window behind the panel. Route them through the floating panel across all
four keydown layers via an atomic focus signal, panel-owned indexed
switching with a tri-state outcome, an event-target-aware close guard, and
a floating-scoped guest IPC bridge.

Changes A-E and findings F2/F3/F4/F6/F7/F8/F9/F11/F-adv/F-dl/F-feas.

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: feelgom <littlestork4@gmail.com>
Co-authored-by: Wooseong Kim <innocarpe@gmail.com>

* fix(review): clear stale floating-panel reclaim intent on panel close

The module-singleton reclaim intent (F3) is armed at an emptying-close but only
consumed by the visibleFloatingItemCount->0 effect. If a concurrent tab-create
keeps the panel from reaching 0, the intent stays armed and could survive to a
later empty-panel mount and steal keyboard focus. The !open release effect now
clears it (defense-in-depth), matching the outside-pointerdown/window-blur paths.

Flagged by 4 review personas (correctness, adversarial, julik-races, maintainability).

Co-authored-by: Orca <help@stably.ai>

* test(floating-workspace): cover L1 index-chord yield and deferred-close reclaim-arm timing

Two additive R2-review tests for the #10288 floating-workspace shortcut
routing change set:

- createMainWindow: assert L1 yields the initial indexed-switch chord
  (tab-index and worktree-index) to the floating panel without
  preventDefault or dispatch, and contains held-key auto-repeats in main
  (preventDefault, no dispatch). Closes the untested Change B (F4) path.

- FloatingTerminalPanel: assert an emptying, panel-owned close whose
  closeTerminalTab defers/cancels (onClosed never fires) leaves the
  reclaim intent unarmed, so no later empty-panel mount can reclaim focus
  for a close that never happened. The prior mock fired onClosed
  unconditionally, so this arm-timing (F3) branch was uncovered.

Co-authored-by: Orca <help@stably.ai>

* fix(review): resolve round-1 findings F-1..F-6

- F-1: re-derive panel emptiness from live store at arm time; clear stale
  reclaim intent on repopulating create so an unrelated later close can't
  consume it and steal keyboard focus from the main workspace.
- F-2/F-5a: single-source the panel's non-creation shortcut claims via
  matchFloatingWorkspacePanelShortcut(); shared isTerminalPaneCloseChord()
  predicate for L2/L3; App.tsx gate + both FloatingTerminalPanel call sites
  now call the SSOT so index/rename/max-min ownership can't drift.
- F-4: L2 keydown gate is event-target-aware (matches L1 yield) so an
  L1-yielded chord is still consumed during a transient panel blur.
- F-5b: export clearReportedFloatingFocusCache() + reset it in test setup.
- F-5c: split floating-workspace-item-actions.ts into focus-reclaim +
  guest-bridge modules (AGENTS.md file-naming).
- F-6: trim verbose design-code comments to single-line WHY.

Co-authored-by: Orca <help@stably.ai>

* fix(floating-workspace): remove finding reference labels

These internal review labels (F1–F7) and change identifiers were used during development and are no longer needed in the code.

* fix(…
brennanb2025 added a commit that referenced this pull request Aug 28, 2026
`ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote`
that predates #11003. Commit a401833 gave `fetchWorktrees` a host-qualified
authority gate that short-circuits to `return false` for an SSH host with no
complete `directSshAuthority`, and updated the shared
`connectDockerSshRelayTarget` helper in the same commit -- but never touched
this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)`
-> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is
empty, `[0]` is undefined, and setup throws
`No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the
spec reaches a single title assertion.

Differential across 5 lane runs (~130 SSH connects): the shared helper's guard
errors fired 0 times; `No remote worktree found` fired 3 times, always via the
fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher
isolation`.

The spec now calls the shared helper. Every helper default matches what the
fork passed (`relayGracePeriodSeconds: 1`, `remotePath`
DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`);
the helper additionally uses `target.host` rather than a hardcoded
`127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`.

No assertion changed; no retry, sleep, or timeout was added anywhere.
brennanb2025 added a commit that referenced this pull request Aug 28, 2026
`ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote`
that predates #11003. Commit a401833 gave `fetchWorktrees` a host-qualified
authority gate that short-circuits to `return false` for an SSH host with no
complete `directSshAuthority`, and updated the shared
`connectDockerSshRelayTarget` helper in the same commit -- but never touched
this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)`
-> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is
empty, `[0]` is undefined, and setup throws
`No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the
spec reaches a single title assertion.

Differential across 5 lane runs (~130 SSH connects): the shared helper's guard
errors fired 0 times; `No remote worktree found` fired 3 times, always via the
fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher
isolation`.

The spec now calls the shared helper. Every helper default matches what the
fork passed (`relayGracePeriodSeconds: 1`, `remotePath`
DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`);
the helper additionally uses `target.host` rather than a hardcoded
`127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`.

No assertion changed; no retry, sleep, or timeout was added anywhere.
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 30, 2026
…ai#17017)

`ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote`
that predates stablyai#11003. Commit a401833 gave `fetchWorktrees` a host-qualified
authority gate that short-circuits to `return false` for an SSH host with no
complete `directSshAuthority`, and updated the shared
`connectDockerSshRelayTarget` helper in the same commit -- but never touched
this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)`
-> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is
empty, `[0]` is undefined, and setup throws
`No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the
spec reaches a single title assertion.

Differential across 5 lane runs (~130 SSH connects): the shared helper's guard
errors fired 0 times; `No remote worktree found` fired 3 times, always via the
fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher
isolation`.

The spec now calls the shared helper. Every helper default matches what the
fork passed (`relayGracePeriodSeconds: 1`, `remotePath`
DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`);
the helper additionally uses `target.host` rather than a hardcoded
`127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`.

No assertion changed; no retry, sleep, or timeout was added anywhere.

(cherry picked from commit 774ce22)
nwparker pushed a commit that referenced this pull request Sep 8, 2026
The retention guard was applied to every caller of the shared retirement
closure, including the one where a live transport refuses the id it was
handed (admitPtyId, the direct-SSH retry admission). That transport is the
pane's only one, so nothing else can own the PTY, and the guard always
answered "retain" there because the pane doing the refusing is live. Every
refused retry PTY would have leaked — the case #11003 added the kill for.

Split the two retirements: retireDisposedSpawn consults the pane surface,
killFreshSpawn does not. The admission tests now build the transport with
retainDisposedSpawn supplied, as installPtyInputRecovery does, so they fail
on the previous guard.

Exclude a worktree being deleted from retention: its tabs are still in the
store, but the teardown kills from the bound-id ledger, which never learned
an in-flight spawn's id.

Measured the preserved tab in ssh-reconnect-tab-destruction rather than
asserting it: 2 misses in 5 and 1 in 6 on this fix, with a live shell on the
host and an empty pane — a different shape, recorded as still open. The new
spec's loop pointed at a real Ubuntu host (ssh openclaw) was 4/4 live.
OrcaWin added a commit that referenced this pull request Sep 26, 2026
…as still spawning (#22578)

* fix(terminal): a pane disposed mid-spawn no longer kills its successor's shell

A new terminal tab whose pane remounts while its first pty:spawn is in flight
is handed the SAME PTY by main's pane-spawn reservation. The disposed first
transport then killed that PTY as an orphan, so the tab closed on pty-exit
(focus fell back to tab 1) or stayed bound to a dead shell. Reported on SSH
worktrees (scan 22).

A transport destroyed mid-spawn now asks the pane surface first and keeps the
PTY while the tab exists, the worktree is not being deleted, and any layout
still names the leaf (leak-over-kill). A live transport refusing the id via
admitPtyId still kills unconditionally (#11003).

Adds rate-limited, id-hashed crash breadcrumbs for the next report:
terminal_fresh_spawn_retired (killed vs retained), terminal_tab_pty_exit
(host kind, ms since spawn, synthetic), terminal_active_tab_auto_move
(active-terminal repair, createTab orphan sweep). The two duplicated tab
pty-exit handlers now share handleTerminalTabPtyExit, and the FNV id hash
used by two crumbs moves to crash-breadcrumb-id-hash.ts.

Ports and supersedes #19386 (disposed-spawn-retention and its unit tests,
credit to its author); its Docker SSH e2e specs are not included.

* fix(terminal): scope spawn retention to its host and keep the PR focused

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* docs: design for direct SSH reconnect fan-out

Capture the implementation-ready plan for host-qualified, epoch-fenced
SSH reconnect recovery after two rounds of multi-model LLM counsel review.

* docs: reconcile SSH reconnect fan-out design

* docs: close reconnect design consistency gaps

* feat: implement bounded direct SSH reconnect recovery

* fix: bound direct SSH retry settlement

* fix: harden direct SSH reconnect authority

* fix: preserve split SSH retry ownership

* fix: preserve SSH split continuation authority

* docs: record final SSH reconnect validation

* fix: preserve SSH authority through retained and detached state

* fix: retain SSH authority across delayed split mounts

* fix: close SSH authority recovery gaps

* fix: fence stale SSH transport replacement

* fix: serialize SSH target teardown

* fix: settle SSH teardown failures before reconnect

* fix: retire failed SSH reset sessions

* test: reconcile current main E2E contracts

* fix: close direct SSH reconnect review gaps

* fix: fence stale SSH reconnect side effects

* fix: close final SSH reconnect lifecycle gaps

* test: stabilize current-main reliability gates

* test: prove plugin navigation containment

* test: make plugin navigation oracle authoritative

* test: make plugin navigation oracle deterministic

* ci: allow sharded e2e suite to finish

* test: wait for runtime pane publication

* test: classify pane readiness by error code

* test: select close persistence terminal by tab identity

* docs: mark reconnect implementation validated

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…stablyai#11065)

* fix(worktree): use local base after offline refresh failure

* docs: add git worktree bug queue report

* fix(skills): require updater registration (#11051)

* fix(skills): require updater registration

* fix(skills): reject incomplete updater registrations

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* test(worktree): satisfy changed-code quality gate

* docs: record #11065 CI repair status

* docs: record CI rate-limit evidence

* chore: keep bug category report out of product diff

* release: v1.4.160-rc.3

* fix(quality): enforce performance-safe lint baseline (#11074)

* fix(quality): clear safe existing lint findings

* fix(quality): keep lint cleanup allocation-free

* fix(quality): enforce performance-safe baseline

* test(terminal): drain deferred confirmation cleanup

* fix(preflight): refresh Windows PATH on forced CLI checks (#10091)

Refresh the persisted Windows PATH during preflight without blocking Electron's main thread. Bound and deduplicate registry reads, preserve the last good cache on failure, skip host refresh for WSL, and add Windows regression coverage.

* feat(new-workspace): type-ahead Project and Run-on pickers (#11062)

* feat(new-workspace): make the project picker a type-ahead field

The Create-worktree Project slot read as bulky and unpolished: a label row,
an add-project icon, a 36px outline trigger and a chevron, all spent before
choosing anything — then a popover carrying its own *second* search box,
two-line rows, and a footer that scrolled out of reach.

The field is now the search. Typing filters in place, so the nested search
box is gone. Exactly one row is armed at any time and Enter takes it;
hovering arms, so pointer and keyboard drive one cursor rather than two
competing highlights. Armed is tracked by row key, not index, so a list
arriving late over SSH cannot slide a different project under a keypress
the user already aimed.

Rows are single-line at 28px with an on-row Enter cap that takes space only
while armed, and "Add a new project" is pinned to the popover edge so it
survives every state — scrolled, filtered to nothing, or no projects at all.

Long names and deep paths degrade deliberately: the name keeps up to half
the row and the path elides from its middle, so two monorepo siblings stay
distinguishable as …/services/checkout-api vs -web where a flat truncate
rendered both identically.

Recency is derived from when each project last had a workspace created,
which is the action this picker is about to repeat — no new store field.

The shell keeps data-project-combobox-root + role=combobox and stays
focusable, so the composer's initial-focus and project-required handlers
still land on it.

* fix(new-workspace): align, scroll and loosen the project picker

Five fixes to the type-ahead picker, three reported and two found while
checking for related breakage.

Alignment: the name and its smaller detail line were centred as boxes, so
the 12px path sat visibly high against the 14px name. Both now share a
baseline, in the committed field and in every row. The dot mark and the
Enter cap are chips rather than text, so they stay centred on the row.

Scrolling: the mouse wheel did nothing over the list. The composer is a
Radix Dialog, and react-remove-scroll cancels wheel events for portaled
content outside the dialog's DOM tree — the scrollbar dragged fine but the
wheel was dead. The old cmdk list carried a shim for exactly this; the
plain scroll pane that replaced it did not, so it has its own now.

Density: rows go 28px -> 32px, row text 13px -> 14px and detail 11px ->
12px, with a taller Add row and more air above section headings.

Escape stranded a query: with the list closed but text still typed, Escape
was ignored (it was gated on the list being open), leaving the field
showing text that matched nothing and hid the committed project. Escape now
always restores the committed display, and only bubbles when there is
nothing to undo.

Listbox ownership: options sat inside unroled section and scroll wrappers,
which breaks the listbox -> option relationship assistive tech relies on.
Sections are groups carrying the heading as their label, and the scroll
pane is presentational.

Both new behaviours are covered by tests verified to fail without the fix.

* chore(tools): keep the project-picker design lab

The exploration harness behind the picker rewrite: 16 interactive design
variants rendered against the app's real tokens and shadcn primitives, so a
prototype is a drop-in ProjectCombobox rather than a mockup.

Worth keeping because the frames encode bugs that only reproduce in
context. DialogFrame renders the picker inside a real Radix Dialog, which
is the only way the react-remove-scroll wheel bug shows up; the fixtures
carry duplicate display names and deep sibling paths that a naive truncate
renders identically.

Run with: npx vite --config tools/wt-picker-lab/vite.config.ts

* fix(new-workspace): stop the project list flashing open, shrink its empty state

Opening the picker read as a double flash. The shared popover surface is
translucent and fades 0 -> 1, which is right over the app canvas but wrong
here: this popover lands directly on the composer dialog, so for the length
of the fade the Name field underneath showed straight through the list and
you saw two layers at once. The list now uses an opaque surface and zooms
without fading, so it is solid from the first frame. Every other popover
keeps the blur and fade.

The "No projects match your search." state was a 60px centred block sitting
next to 32px rows, which read as a different kind of surface and made an
empty result feel like an error. It is now sized and aligned like a row.

The lab's dialog frame focused whatever Radix picked first, which popped the
Add-project tooltip on open and masked the real problem; it now focuses the
name field the way the real composer does.

* fix(new-workspace): square mark, centred empty state, and keep the list open on tab-focus

Four fixes, three reported and one found while sweeping for others.

Square mark: the option dot had a `rounded-full` override, so a project read
as a circle here and a square everywhere else (jump palette, sidebar). Drop
the override and use RepoBadgeMark's own shape.

Centred empty state: "No projects match your search." was left-aligned after
being shrunk to row height; centre it.

Tab-focus blinked the list shut: the field lives in the popover's anchor, not
inside its content, so Radix's dismissable layer saw focus land "outside" and
closed the list the instant you tabbed in. Focus and pointer events within
this control no longer dismiss it; genuine outside events still do.

Junk text could strand the field: typing a query that matched nothing and
then clicking away left the text sitting there with the list closed, showing
no project and no error. A query only means something while the list is open,
so closing without committing now clears it.

On pressing Create with no project: no change needed. The create gate has not
depended on project selection since #4991, and both submit paths already call
showProjectRequiredError(), which sets the inline message and turns the field
red via aria-invalid. Verified end to end: the button is pressable, the press
paints the field destructive, and the message appears beneath it.

* feat(new-workspace): rebuild the Run-on picker to match the project picker

"Run on" was the last composer field still built the old way: an outline
trigger wrapping a cmdk list, two-line rows, and no way to search. It now
matches the project picker, so the two fields in the same form read as one
control.

The field is the search — type to filter hosts, paths and recipes with no
nested search box. Exactly one row is armed at a time and Enter takes it;
hovering arms, so pointer and keyboard drive one cursor. Rows are 32px with
the label and its path on a shared baseline, the path eliding from its
middle so two deep sibling paths stay distinguishable. The popover surface
is opaque and unfaded because it lands on the composer dialog, where a
translucent fade shows the form underneath.

Two behaviours the project picker doesn't have are preserved. Disconnected
hosts keep their inline Connect action, tracked per host so one stalled
connect never blocks the others, and the list stays open so the connecting
state is visible. Two rows open nested lists rather than committing: VM
recipes, and "Add host" pinned to the popover edge so it survives every
state — scrolled, filtered to nothing, or with no hosts at all. Enter and
ArrowRight open a submenu; Escape backs out one layer at a time.

Extracted from NewWorkspaceComposerCard (-563 lines) into files that each
stay under the line limit without a suppression.

Tests: the run-target cases asserted cmdk internals (`[cmdk-item]`,
aria-disabled, cmdk-separator) that no longer exist. Rewritten against
behaviour and the listbox roles instead. All 22 composer tests pass,
plus a live sweep of 11 interactions in a real dialog.

* fix(new-workspace): drop the Enter cap, fix submenu hover, match the Add rows

Three follow-ups on the two composer pickers.

The ↵ cap on the hovered row is gone from both. On a run-target row it sat
next to the Connect action and read as a second, competing affordance; the
highlight already says what Enter will take.

Submenu rows never highlighted under the pointer. They passed a hardcoded
`armed={false}`, so the recipe list and the Add-host choices were the only
rows in either picker with no hover state. They now track their own hover.

"Add a new project" used a chunky FolderPlus where "Add host" uses a plain
Plus. Both rows were already the same height and type, so matching the glyph
is the whole difference.

* fix(new-workspace): restore the folder glyph, two-line Add-host cards, quiet Connect rows

Three follow-ups.

"Add a new project" goes back to FolderPlus — matching "Add host"'s plain
Plus made the two consistent but lost the glyph that says which kind of
thing is being added.

A disconnected host row no longer repeats its status. The Connect button
already says the host isn't connected, so "Connect this host to set up
projects" beside it was saying it twice. Rows without a Connect action keep
their detail, since there it explains why the host can't run.

The Add-host choices go back to two-line cards. Their descriptions explain
what you're picking ("Use an existing machine over SSH" vs "Pair another
Orca runtime"), unlike a host row's detail, which just labels a host you
already recognise. RunTargetRow grows a `stacked` variant for that rather
than making the single-line row do both jobs.

* fix(new-workspace): give Run on the same vertical rhythm as the other fields

Run on is nested inside the Project block so the two share its error and
empty states, which also put it on that block's 4px internal spacing. It
reads as its own field, so it sat noticeably tighter than the 16px gap
every other field in the composer gets. Pad it to match.

* refactor(new-workspace): share the type-ahead machinery between both pickers

Project and Run on were built one after the other, so each grew its own copy
of the same mechanics: query and open state, arming by row key, the
arrow-key walk, scroll-the-armed-row-into-view, the react-remove-scroll
wheel shim, and the closes-drops-the-query rule. Two copies of subtle
behaviour is two places for it to drift.

useTypeAheadCombobox now owns all of it. Callers pass a function that turns
a query into row keys and get back the query, the armed key, and the
movement helpers. Run on layers its submenu state on top by wrapping
`close`, which is the only part that isn't shared.

The two long class strings both files repeated verbatim — the field shell
and the opaque unfaded popover surface — are named constants now, so the
reason they differ from the stock popover recipe is written down once
instead of implied by a duplicated literal.

No behaviour change: 16,456 renderer tests pass, plus the 22-check live
interaction sweep across both pickers in a real dialog.

* fix(new-workspace): drop aria-expanded from option rows, remove the design lab

`aria-expanded` isn't a supported prop on `role="option"`, so the submenu
rows were claiming a state screen readers can't interpret there.
`aria-haspopup` alone already says the row opens a menu.

Removes tools/wt-picker-lab. It was the harness for exploring this redesign
— 12 interactive variants — and it did its job, but the 11 that lost are
dead code, and its prototypes were the only thing failing the react-doctor
gate (5 errors, all in throwaway variants; the shipped pickers had none).

* fix(workspaces): support emoji-only names

* feat(workspaces): derive readable emoji identifiers

* feat(workspaces): add emoji shortcode picker

* fix(terminal): gate the developer menu behind Option and unblock manual parking (#11091)

The Developer submenu shipped visible on every worktree right-click, and its
Park terminal action always refused with "These terminals cannot be parked
safely."

- reveal the Developer submenu only when Option/Alt is held at right-click,
  captured at open time so it can't shift rows mid-menu
- stop a settled pendingActivationSpawn tag from refusing a manual park: first
  activation stamps it on every tab and only a fresh updateTabPtyId consumes it,
  so a reattached tab kept it forever
- resolve the single leaf of a rootless layout for parked watcher coverage, so a
  workspace whose panes never mounted is no longer permanently uncoverable
- restore the !isVisible park guard dropped in #11016, which let the workspace
  being viewed unmount its own terminals
- split manual-park eligibility out of the automatic cold-park policy module

* fix(workspaces): hide false repo error for remote servers (#11050)

* i18n: translate orchestration page and workflow messages (#11097)

Add translations for OrchestrationPage coordinator and child PR names, plus agent workflow status messages (initial states and progress beats) across all supported languages (English, Spanish, Japanese, Korean, Simplified Chinese).

* fix(skills): stop reporting a failed update when the CLI succeeded (#11105)

The Update skills dialog showed "The update didn't finish" / "Some skills
could not be updated" with an armed Retry, directly above the runner's own
log line saying "All global skills are up to date" — on a clean exit 0.

`skills update` compares its lock's recorded hash against the source and
never reads disk (dist/cli.mjs: `latestHash !== entry.skillFolderHash`).
Once the lock has advanced past the installed bytes it prints up-to-date,
exits 0 and writes nothing. The copy left behind is a recognised older
revision, so the post-run re-scan sees `outdated`, skillUpdateFailedNames
counted that as a failed run, and skill-update-run settled to state 'error'.
Retry re-ran the same command, which no-op'd again — a closed loop.

Reclassify `outdated` as "the command did not converge this", not "the run
failed". The freshness badge still marks the copy not-current, so nothing is
hidden; the run just stops being blamed for it.

A botched write is still caught: a half-written bundle hashes to
`unrecognized`, a wholly-degraded or removed copy leaves no convergent
placement, and process-level failure still surfaces via the spawn error.

Reachable by anyone who updated during the stub conversion window — every
bundled skill has a stub -> full -> stub oscillation in its last three
registry revisions.

* perf(terminal): eliminate adverse control and frame-gate cases (#11045)

* perf(terminal): eliminate dense control and frame gate regressions

* test(terminal): keep gate labels in valid expect shape

* test(terminal): expose the surviving sub-threshold control-density case

The only adverse strip fixture sat at 50% control density, which is exactly
where the fallback fires and wins. A shape at 31 controls per 64-unit block
evades the trigger and still loses to the per-character legacy (0.67x), so the
benchmark structurally could not show it.

Add that fixture, pin both density literals in the staleness guard so a retune
fails loudly instead of silently measuring a boundary that moved, and export
the probe constant the equivalence test was hardcoding.

* fix(opencode): harden lifecycle status delivery (#11017)

* fix(agent-status): show Codex v2 subagents (#11059)

* fix(agent-status): track Codex rollout subagents

* fix(agent-status): resolve cross-day Codex child rollouts and unblock CI gate

Codex files each rollout under its own local start date, so a session that
runs past midnight spawns children into a sibling day directory. Scanning
only the parent's directory left 13% of real subagent spawns (48/371 across
local rollouts) permanently unresolved, which pinned a phantom "working" row
and re-ran readdirSync every poll tick forever. Resolve the child's own day
directory from occurred_at_ms, and time-box a child whose rollout stays
unreadable so a deleted or never-written file can't leak a working row.

Also make the hook HTTP handler return void: the changed-code quality gate
keys findings by span overlap, so this PR's added line inside the pre-existing
async createServer callback resurfaced no-misused-promises as a new finding.

Tests cover cross-day resolution, grace-period retirement, and that the poll
re-arms across successive roster changes (the prior tests passed even when
the poll died after its first change).

* fix(agent-status): keep the Codex subagent poll alive across nested hooks

A nested non-codex CLI inherits its parent's ORCA_PANE_KEY, so its hook
POST reached scheduleCodexSubagentPoll and tore the timer down before the
source guard, silently ending polling while a rollout child was still live.

* fix(skills): stop offering an update the CLI provably cannot perform (#11110)

* Revert "fix(skills): stop reporting a failed update when the CLI succeeded (#11105)"

This reverts commit 9297ab6eefce847a19066c6508faa31c3e7595d3.

* fix(skills): stop offering an update the CLI provably cannot perform

The Update skills dialog reported "The update didn't finish" / "Some skills
could not be updated" with an armed Retry, directly above the runner's own
"All global skills are up to date" log line, on a clean exit 0.

`skills update` decides what to do by comparing its lock's `skillFolderHash`
against the source tree and never reads disk (published CLI, dist/cli.mjs:
`latestHash !== entry.skillFolderHash`). So once the lock records a revision
the filesystem does not actually have, it reports up-to-date, exits 0 and
writes nothing. No retry converges it.

Gate eligibility on that instead of blaming the run afterwards: a name stays
updatable only while the lock's hash and the revision the DISK hashes to
agree. Those that disagree fall through to `needs-attention`, which
skill-freshness-display-status.ts already documents as the state for a copy
"out of date somewhere the update command cannot reach". The dialog no longer
offers them, so it can neither claim failure nor claim success.

Deliberately compared against disk, not the bundled manifest: the updater
pulls from the source repo, which legitimately runs ahead of what a build
ships, and gating on the bundle would withhold real updates. Both sides must
also be positively identified — an unplaceable lock hash is not evidence.

Also reverts 9297ab6eef, which forgave `outdated` post-run. That turned the
false failure into a false success ("Updated 2 skills" over copies nothing
wrote) and let an empty verdict swallow spawnError, so an offline run
published green.

Reachable by anyone who updated during the stub-conversion window — every
bundled skill has a stub -> full -> stub oscillation in its last three
registry revisions.

* fix(skills): do not gate a skill when a placement is unidentifiable

`diskTreeShas` drops digests matching no known revision, so `every` ran over
only the resolved half — one stale copy beside one unidentifiable copy gated
the name, contradicting the unknown-stays-eligible rule the function documents.
Require every observed digest to resolve before treating all placements as
mismatched.

Caught by CodeRabbit on #11110.

* fix(skills): judge convergence only over placements the update command writes

A same-name plugin-cache or repo copy could defeat the gate two ways: an
unidentifiable repack read as an unresolved placement, and a cache copy
parked at the lock's own revision read as an anchor — both re-arming the
unwinnable update on a drifted canonical. Filter to
SUPPORTED_GLOBAL_SKILL_TOPOLOGIES, matching eligibility and outcome.

* perf(lint): consolidate code-quality gates into Oxlint (#11117)

Consolidate standalone code-quality scanners into Oxlint, preserve focused native/type-aware enforcement, add custom plugin coverage, and harden deferred PTY test cleanup.

* fix(browser): keep the address bar editable in a narrow toolbar (#11098)

* fix(browser): keep the address bar editable in a narrow toolbar

Every other browser toolbar control is shrink-0, so the address bar was
the only flexible item and absorbed the entire squeeze: below roughly
420px of pane width it collapsed to the leading globe icon with a
zero-width input. Clicking it only opened the suggestion dropdown, which
inherits `--radix-popover-trigger-width` and so rendered at icon width —
there was no way to type or edit a URL in that tab.

Focusing a squeezed bar now lifts the form out of the toolbar flow and
overlays the row edge to edge, giving a full-width editable field that
navigates on Enter (and a full-width suggestion list for free). A
measured slot stays in flow so the overlay cannot feed back into its own
width, and the slot keeps a min width so the globe remains a real hit
target instead of being overlapped by neighbouring buttons.

Fixes #11090

Claude-Session: https://claude.ai/code/session_01Mx53f7erbtw5NraS8HdXKE

* fix(browser): use the documented floating shadow for the expanded bar

STYLEGUIDE.md defines exactly three elevation levels and forbids a
fourth; shadow-md was not one of them. The overlaid address bar is a
floating surface, so it takes the documented floating shadow already
used by the other floating surfaces in this pane.

Claude-Session: https://claude.ai/code/session_01Mx53f7erbtw5NraS8HdXKE

* test(browser): make the narrow-toolbar regression deterministic

The spec passed only from a clean profile. Two preconditions it set once are
actively undone by the app:

- BrowserPane re-focuses a blank tab's address bar across several animation
  frames plus the blank-url did-finish-load handler, so a single blur() was
  reverted and the bar never reached its squeezed resting state.
- Startup paths re-open the right sidebar. At a fixed 700px window that leaves
  the pane ~70px, so the overlay had nowhere to go and the field measured 0px.

Settling these separately let whichever settled first drift back while the next
one ran. Re-assert them in one loop until they hold simultaneously, and size the
window from the chrome actually measured instead of assuming a fixed 700px.

Verified 8/8 green, and still fails at the overlay assertion when the fix is
disabled, so the regression coverage stays real.

---------

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>

* Improve orchestration migration safety for live legacy workers (#11107)

* fix(orchestration): clarify legacy migration safety

* fix(cli): sanitize legacy formatted messages

* test(runtime): allow near-cap fuzz under shard load

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(lint): restore nested config discovery in changed-code gate (#11130)

* docs: add WeChat group 6 QR with overflow guidance

Show group 5 and group 6 QR codes side by side so people can join group 6 if group 5 is full.

* fix(sidebar): restore legible selected-workspace fill in dark mode (#11139)

#8321 mixed the selected card's wash into the opaque --worktree-sidebar
surface, lifting dark mode to 16% (#4b4b4b). Card text lost too much
contrast against it.

Return both modes to a translucent wash (light 8%, dark 10%) so the
brighter selection border added by #8321 carries the selected state
instead of the fill.

Co-authored-by: Orca <help@stably.ai>

* fix(macos): avoid scene deadlock on app reactivation (#11055)

* fix(macos): avoid redundant focus on app activation

* test(macos): cover passive app activation

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(memory): retune image and orca.yaml ceilings that rejected valid input (#10815)

* fix(orchestration): reveal worker terminals reliably (#11142)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* ci(pr): run E2E when a PR touches tests/e2e paths (advisory) (#11131)

* ci(pr): run E2E when a PR touches tests/e2e paths

Regression specs under tests/e2e never ran on PR CI — only schedule and
release called e2e.yml — so a red regression test could merge green.
Path-filter and workflow_call the E2E suite when E2E-relevant files change.

Use merge-base diffs so base-branch drift does not false-trigger E2E, fail
the detector when git diff cannot compute the PR range, and pin
least-privilege contents:read on both the detector and reusable E2E workflow.

Closes #10518

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>

Co-authored-by: Orca <help@stably.ai>

* ci(pr): make the E2E path gate actually block, and match the real config path

Two fixes to the new path-filtered E2E job.

The gate did not gate. pr.yml's `verify` job is the required check, and it
enumerates its dependencies explicitly — `e2e` was in neither `needs` nor the
result list, so a failing shard left `verify` green. That reproduces the exact
hole this job exists to close: a red spec merges green, just with a red box
further down the page. Add `e2e` to both.

Because the job is path-filtered, `skipped` is the normal result on a PR that
touches no E2E files and has to keep passing. That allowance is checked after
the strict loop rather than inside it, so it can never leak to the six jobs
that are always required.

The `playwright.` pattern matched nothing. The config is
tests/playwright.config.ts — beside tests/e2e/, not inside it — so no tracked
file starts with `playwright.` and editing the runner config would silently
skip E2E. Anchor it at `tests/playwright.`.

Adds a contract test alongside the existing release-e2e one. Verified it fails
when either fix is reverted, and simulated the gate across
success/skipped/failure/cancelled plus the skip-must-not-mask-a-real-failure
case.

* test(ci): close two gaps in the E2E gate contract

CodeRabbit was right on both counts — verified by reverting each and watching
the contract stay green.

The path filter was unasserted, so `e2e` could lose its `if:` and run on every
PR — the cost the filter exists to avoid — without failing anything.

The strict-loop check hardcoded four of the six required jobs, so dropping
GIT_COMPATIBILITY or SHELL_CONTRACTS left them unenforced while the contract
passed. Derive the list from verify.needs instead, so a newly added required
job that misses the loop fails here rather than silently going unchecked.

* ci(pr): land the E2E path gate advisory instead of blocking

The E2E suite is currently failing every scheduled run on main — 22 of the last
22 — so making verify depend on it would block any PR touching tests/e2e/**,
including the PRs that fix the suite. This PR's own run reproduced that: 3 of 12
shards failed on specs unrelated to it (agent-session resume, Jira linking,
plugin containment, terminal artifacts).

So the job runs and reports on E2E-path PRs but is left out of verify.needs for
now. The detector, the tests/playwright. path fix, and the contract tests are
unaffected — those stand on their own and were the substance of the review.

Flipping to blocking is a three-line change once the suite is green; the exact
wiring, including why the skipped allowance must sit outside the strict loop, is
recorded on verify's Require-successful-checks step. The contract test pins the
advisory choice so it reads as deliberate rather than as the unwired-gate bug it
originally caught, and still fails if the path filter, the strict-loop coverage,
or the config path regress.

---------

Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
Co-authored-by: Orca <help@stably.ai>

* fix(orchestration): repair version-skewed run schemas (#11150)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* fix(i18n): translate automation cadence labels (#11068)

The cadence picker now resolves Hourly, Daily, Weekdays, Weekly, and Custom cron through the renderer i18n catalog, with corrected zh/ko/es translations.

Supersedes #10044 (thanks @innocarpe) and #10045 (thanks @fsdwen).

Fixes #10043

* chore(i18n): drop orphaned cadence catalog keys (#11154)

Removes the lowercase hourly/weekly/custom entries from the AutomationSchedulePicker catalog node in all five locales. They were superseded by keys derived from the rendered labels in #11068, and the extractor only adds keys, so they stayed behind unreferenced.

Follow-up to #11068.

* test(cli): lock CLI-compatible timeout parse contract (#11206)

parsePositiveSafeIntegerNumericText mirrors the CLI's own Number()
coercion on purpose: text like `600000.000000000000001` is the budget
the CLI will actually wait on, so rejecting it here would leave the
relay and SSH kill timers shorter than the CLI's and cut the request
short. Document that and pin it with regression cases.

* fix(diff): stop file-tree navigation remounting combined diffs; make tree resizable (#11088)

* feat: add Trae CLI as a supported TUI agent (#10763)

* feat: [AI-GEN] add Trae CLI as a supported TUI agent

Closes #10579.

Wire trae-cli into the desktop and mobile agent catalogs following the
same integration pattern as other CLI agents (e.g. Ante, Devin):

- src/shared/types.ts, tui-agent-config.ts: register 'trae' with
  detectCmdAliases (traecli/trae-agent) and argv prompt injection,
  matching trae-cli's `trae-cli [prompt]` contract. The CLI's own
  third documented alias `ta` is intentionally excluded — too generic
  a 2-letter name to use as a PATH-existence detection signal without
  false-positiving on unrelated tools.
- src/shared/trae-headless-command.ts: recognize `--print`/`-p` and
  `--output-format json|stream-json` as one-shot headless invocations
  (same shape as claude-headless-command.ts) so they aren't mistaken
  for a live interactive session.
- agent-kind.ts, telemetry-events.ts, agent-status-types.ts,
  agent-type-label.ts, tui-agent-display-names.ts,
  tui-agent-permissions.ts (YOLO via trae-cli's own --yolo flag),
  tui-agent-selection.ts: standard per-agent registrations.
- agent-catalog.tsx, agent-favicon-assets.ts,
  mobile/src/tasks/mobile-tui-agents.ts,
  mobile/src/components/mobile-agent-icon-assets.ts: catalog entries
  and bundled favicon (fetched from docs.trae.cn, required by mobile's
  offline-icon invariant test).
- i18n: add the "Trae" label to all five locale catalogs (en/es/ja/ko/zh).
- Tests: agent-process-recognition, agent-status, tui-agent-startup.

Verified with `pnpm typecheck` (desktop + mobile), the relevant vitest
suites (869 tests across 12 files, all green), oxlint (clean), and a
real end-to-end launch of the actual trae-cli binary through Orca's
pty.spawn IPC path (confirmed via the OS process table).

* fix: [AI-GEN] point Trae catalog entry at the real CLI quick-start doc

docs.trae.cn/cli (what the installed CLI's own --help text prints as
its "User manual" link) soft-404s — the docs site restructured and the
working page is docs.trae.cn/cli_get-started-with-trae-cli (confirmed
by HTTP fetch: real page title "TRAE CLI 快速开始" vs the old path's
"404 - 页面不存在"). Addresses CodeRabbit's homepageUrl review comment.

* fix: [AI-GEN] detect Trae on traecli, not the ambiguous trae-cli name

Per @AmethystLiang's review: the open-source bytedance/trae-agent
project (MIT, ~12k stars) registers its own console script as
`trae-cli` (pyproject.toml: `trae-cli = "trae_agent.cli:main"`), an
entirely unrelated CLI with a different contract (`trae-cli run
"task"`, `-p` short for `--provider`). Detecting on bare `trae-cli`
would false-positive on that project's installs and break launch for
anyone who has it instead of the actual TRAE CN CLI.

- tui-agent-config.ts: detectCmd/launchCmd/expectedProcess -> `traecli`
  (TRAE CN's own installer symlinks this alias too, but the other
  project does not ship it). Dropped the `trae-agent` alias entirely —
  it's the colliding project's literal repo name, the highest
  false-positive string available.
- agent-catalog.tsx: cmd -> `traecli` to match; faviconDomain ->
  `www.trae.cn` (bare `trae.cn` 404s on Google's favicon service;
  `www.trae.cn` is the product-root domain that actually resolves).
- mobile-tui-agents.ts: faviconDomain -> `www.trae.cn` to match.
- Tests updated: agent-process-recognition now asserts `trae-cli` and
  `trae-agent` are NOT recognized as Trae (regression guard against
  reintroducing the collision); tui-agent-startup updated for the new
  launch command.

promptInjectionMode stays `argv` and the headless-command file stays
as-is — both verified against the real TRAE CN CLI's actual --help
output (pasted in the PR review thread), not assumptions.

* refactor: [AI-GEN] share one print-mode headless matcher across agents

trae-headless-command.ts was a rename-only fork of claude-headless-command.ts,
and ante-headless-command.ts carried a third copy of optionName. Collapse both
print-mode files into print-mode-headless-command.ts, dispatch from a
Partial<Record<TuiAgent, ...>> table instead of an if-chain, and compress the
Trae comments to the repo's one-line style.

* fix: [AI-GEN] terminate Trae flag parsing before the positional prompt

`traecli` is a Cobra CLI with subcommands, so an argv prompt starting with
`help`, `config`, `-…` was dispatched as a subcommand or flag instead of being
run as the task. Add `argvPromptSeparator: '--'` (same reason Grok has it), and
stop the shared print-mode headless matcher at `--` so a prompt that reads like
`--print` no longer drops the pane out of agent recognition.

* docs: [AI-GEN] name both Trae CLIs explicitly in the detect-name comment

Co-authored-by: Orca <help@stably.ai>

* docs: [AI-GEN] drop the vendor tag from the Trae union comment

Co-authored-by: Orca <help@stably.ai>

* fix: [AI-GEN] guard the nullable startup plan in the Trae separator test

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: 陈泽榜 <chenzebang@jianzhikeji.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>

* chore: remove orchestration structured-output draft design doc from repo root

* fix(codex): re-confirm spurious shell readings before skipping the restart card (#11076)

An account switch decides pane eligibility from a single cached
inspectProcess read. When that read reports the pane's shell for a live
Codex session, the pane silently loses its restart card - no error, no
retry. Re-check shell readings on Orca-launched Codex panes with the
existing fresh-scan confirmForegroundProcess before trusting them; only
an affirmative codex answer flips the decision, so a genuine exit to the
shell stays uncarded and unsupported providers keep today's behavior.

* feat(dictation): add stop button and shortcut hint to Listening indicator (#11152)

* feat: bound direct SSH reconnect fan-out and recovery (#11003)

* docs: design for direct SSH reconnect fan-out

Capture the implementation-ready plan for host-qualified, epoch-fenced
SSH reconnect recovery after two rounds of multi-model LLM counsel review.

* docs: reconcile SSH reconnect fan-out design

* docs: close reconnect design consistency gaps

* feat: implement bounded direct SSH reconnect recovery

* fix: bound direct SSH retry settlement

* fix: harden direct SSH reconnect authority

* fix: preserve split SSH retry ownership

* fix: preserve SSH split continuation authority

* docs: record final SSH reconnect validation

* fix: preserve SSH authority through retained and detached state

* fix: retain SSH authority across delayed split mounts

* fix: close SSH authority recovery gaps

* fix: fence stale SSH transport replacement

* fix: serialize SSH target teardown

* fix: settle SSH teardown failures before reconnect

* fix: retire failed SSH reset sessions

* test: reconcile current main E2E contracts

* fix: close direct SSH reconnect review gaps

* fix: fence stale SSH reconnect side effects

* fix: close final SSH reconnect lifecycle gaps

* test: stabilize current-main reliability gates

* test: prove plugin navigation containment

* test: make plugin navigation oracle authoritative

* test: make plugin navigation oracle deterministic

* ci: allow sharded e2e suite to finish

* test: wait for runtime pane publication

* test: classify pane readiness by error code

* test: select close persistence terminal by tab identity

* docs: mark reconnect implementation validated

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>

* Improve translations for resource manager and related UI elements (#11205)

* Improve translations for resource manager and related UI elements

Standardize terminology ("daemon" vs "service"), complete missing translations, and refine wording across Spanish, Japanese, Korean, and Chinese locales for consistency and clarity.

* Improve translations for resource manager and related UI elements

* fix(test): update zh name-mode label expectation after translation fix

The resource-manager translation pass correctly changed the Chinese
"Name" label from 姓名 to 名称; update the localized options unit test
to match so CI passes.

* fix(native-chat): surface draft launch context in desktop and mobile chat composers (#9802)

* fix(native-chat): surface draft launch context in chat composers

Creating a workspace from a GitHub issue delivers the issue link only into
the agent TUI's input buffer (argv prefill or startup paste), so the chat
view showed no trace of it on desktop or mobile.

Desktop: draft launches now seed an in-memory launch draft keyed by tab id
(direct work-item launches, background GitHub work-item creates, quick-create
composer, and new-tab draft deliveries). The chat composer adopts the seed
once as its editable draft, declines permanently if the composer already has
text, and drops an untouched copy when any user turn lands (the one-line TUI
input means the prefill was submitted or deliberately cleared) or on its own
send, whose existing input pre-clear retires the TUI copy.

Mobile: the host publishes the draft as an optional launchDraft field on the
mobile terminal tab snapshot (additive, no protocol bump) and the mobile
composer adopts it with the same once-only/decline/resolve semantics. Mobile
chat sends now also pre-clear the TUI input line (Ctrl+U, desktop parity) so
a pending prefill cannot concatenate with the sent message.

Completion seeding resolves the launch tab from the synced store tabs when
the backend spawned the terminal and activation reports no primaryTabId.

Split the Windows shell-quoting tests into their own file to stay within the
max-lines budget.

* revert(mobile): drop incidental pnpm-lock churn from the launch-draft branch

The libc binding fields and the @typescript-eslint peer re-resolution came from
a local install, not from this change; mobile/package.json is untouched.

* fix(native-chat): resolve launch drafts without trusting cross-host clocks

The rule required a user turn stamped at or after the seed. Grok omits row
timestamps, so a Grok launch draft never resolved; and the seed time is a
renderer clock while the stamp comes from the executing host's JSONL, so a
remote workspace whose clock trailed never resolved either. Both left the
composer adopting an already-submitted prefill, which re-sends it as a
duplicate turn.

Resolve on any user turn that is not PROVABLY older than the seed (a launch
draft's session starts with zero user turns), with the existing cross-host
skew slack, plus a timestamp-free backstop for wider skew: a new tail user
turn since the draft was first observed. "Load earlier" prepends, so it
cannot move the tail and cannot over-resolve.

Split out of native-chat-pending.ts to stay under the max-lines ratchet.

* fix(worktrees): seed the launch draft on the agent's own tab, never on tabs[0]

Two defects in the completion seed:

- The tab was resolved by array position. buildStartupOpt returns undefined on
  the backend-spawn path, so applyDefaultTerminalTabs stamps launchAgent on no
  tab and the launchAgent guard was dead there. A repo with default terminal
  tabs ("dev server", "logs", ...) got the draft on a tab that runs no agent,
  and then published it to mobile as THAT tab's launchDraft. Correlate on the
  backend startup tab, then on a launchAgent-stamped tab, then on primaryTabId
  (which is the agent tab whenever the renderer owns startup); never tabs[0].

- Runtime-owned worktrees mirror their session tabs async, so tabsByWorktree
  was empty at seed time and the seed was silently dropped for that whole host
  class. Defer to the first mirrored tab via the existing delayed-delivery
  queue, which now holds every pending delivery for a worktree instead of one
  (setup/issue commands and the seed both wait on the same first tab).

* fix(store): evict nativeChatLaunchDraftByTabId on every teardown path

The new map was absent from all four paths its sibling
nativeChatLaunchPromptByTabId participates in: tab close, the orphan terminal
sweep, the bulk worktree purge, and the removeWorktree teardown. A stranded
entry is worse than a plain leak here because sync-runtime-graph keeps
publishing it to mobile as that tab's launchDraft.

* fix(native-chat): only seed single-line unsubmitted launch drafts

The unsubmitted-delivery branch seeded on every draft delivery, which also
caught the agent-session-fork path whose prompt is multi-line scraped context.
The chat send pre-clears the TUI with Ctrl+U (kill-to-start-of-LINE), so a
multi-line prefill cannot be fully cleared and its earlier lines would glue
onto the next message. The GitHub work-item draft this feature targets is a
bare issue URL, so narrowing costs it nothing.

Also assert the composer retires the seed after a send — deleting that call
previously failed no test.

* fix(mobile): stop the chat pre-clear from wiping a just-pasted image

The text write set clearInputFirst unconditionally. On the image path that
Ctrl+U lands AFTER pasteMobileNativeChatImagePaths already pasted the image,
so the agent receives the text alone while acceptSend still renders the
thumbnail on the sent bubble — silent image loss.

Desktop's image path clears exactly once, before the paste, and never again;
mobile now matches: pre-clear only when nothing was deliberately pasted first.
The image paste already leads with its own Ctrl+U, so a launch-draft prefill
parked on the input line still cannot glue onto the message.

Pinned at both levels: the controller test drives the real send hook and
asserts clearInputFirst per branch, and the send module asserts the wire text
carries no leading \x15. The image-attachments test injects its own baseSend,
so it structurally could not observe this.

* fix(mobile): hold the launch-draft prefill until the transcript settles

session.tabs delivers launchDraft before the transcript read resolves, so the
seed effect could run against an empty in-flight message list and miss the
user-turn decline. Launching from an issue, submitting the prefill in the TUI,
and never opening desktop chat (nothing else clears the host seed) then
prefilled the mobile composer with the already-sent issue link — a send tapped
before it retracted duplicated it to the agent.

Thread the session's loading state through and skip the seed while the read is
in flight. idle/waiting-session still seed: no session means no user turns.

* fix(runtime): publish a launch draft to mobile only for the tab's own agent

The publish had no agent check while the desktop consumer declines on
mismatch. The seed is keyed by tab id, which survives a pane's agent switch, so
mobile could adopt a draft desktop refuses — seed for claude, never open
desktop chat, switch the pane to Codex, and mobile prefills the Codex chat with
the Claude-era issue link. Align publish with the consumer.

* fix(native-chat): take the launch-draft baseline only after the transcript loads

The timestamp-free backstop snapshotted the transcript's user turns on first
observation of the draft, which can happen while the read is still in flight and
`messages` is []. A pane bound to a session that already had user turns then
backfilled above that zero baseline with a different tail id, so clause 2
resolved and silently dropped the seed — the launch context never appeared, and
the feature no-oped for exactly the panes it was meant to serve. Clause 1 was
already correct there (that history is provably older than the seed).

Gate baseline capture and resolution on the transcript read settling, the same
shape mobile's drafts hook uses. Clause 1 is unchanged; while loading the merged
list is empty anyway, and a pane with live appends is never reported 'loading'.

Also restore clause 1's short-circuit: it scans with .some() again and only
allocates the user-turn list when falling through to the backstop.

NativeChatView sat at exactly the 400-line cap, so the composer's two
launch-draft props are now spread from the hook result they already mirror.

* fix(native-chat): reject multi-line launch drafts inside the seed helper

The single-line guard lived in deliverLaunchPromptToAgentTab, so the two
other seeding entry points (worktree create, direct work-item launch)
bypassed it — and every Linear launch is multi-line by construction
("Linked Linear issue: STA-…" + url). The chat send pre-clears the TUI
with Ctrl+U, which kills to start of LINE, so those earlier lines stay
parked to glue onto the next message.

* fix(worktrees): keep the deferred agent seed off ambiguous mirrored tabs

The runtime-owned deferred path fell back to tabs[0], which the module's
own docstring forbids: with repo default tabs ("dev server", "logs") the
seed lands on a tab running no agent, where mobile withholds it and
desktop's agent check ignores it — the feature is silently dead for that
create and the entry leaks until tab close.

The queue entry is consumed before delivery, so there is no retry to fall
back on; accept the first mirrored tab only when it is the worktree's
only one and so unambiguously the agent's.

* fix(mobile): treat a launch-draft-only session-tab frame as a change

mobileSessionTabEqual's terminal branch never compared launchDraft, and
the route keeps `prev` when tabs compare equal — so a publish whose only
delta is the draft appearing or retracting was discarded and never
reached the composer. Live QA passed only because agentStatus happened to
change in the same frame.

MobileSessionTab's terminal variant did not declare the field either
(the controller read it through the structurally wider
MobileNativeChatTab), which is why TypeScript never flagged it.

* fix(mobile): judge a launch prefill only from its own settled transcript

Two ways the drafts hook was reading a transcript that was not the active
chat's:

- transcriptLoading came from `status`, a plain useState written by a
  passive effect declared before the drafts hook. On the commit where the
  tab identity changes it still holds the previous tab's value, so the
  guard was off on exactly the render that seeds: first entry saw
  status 'idle' with an empty list and seeded an already-submitted link,
  and a tab switch declined the new tab's prefill from the old tab's
  turns. The session hook now tracks the identity its messages describe
  and reports transcriptLoading until they agree; the retire effect gates
  on it too.
- Leaving chat view nulled launchDraft while draftKey stayed the same,
  which the hook could not tell from a host retraction — it declined the
  prefill permanently, so peeking at the terminal dropped the context.
  The controller now passes the raw field plus an explicit chatActive
  flag, and both effects hold their state when the tab is not on chat.

The controller wiring was previously unasserted: replacing both props
with constants left all 795 mobile session tests green.

* fix(native-chat): keep the launch-draft baseline across a transcript reload

baselineKey went null whenever the transcript was loading, and the null
branch DISCARDED an already-valid baseline taken from a settled read. It
was then re-taken from the fuller list, swallowing the very user turn
that resolves the draft — so a stale prefill gets re-adopted as a
duplicate turn. Key the baseline on draft identity alone and gate only
the capture.

session.status is also not a truthful read-in-flight signal: a live
'working' hook outranks 'loading', so the guard could be off over an
in-flight empty list. Expose the read phase itself and gate on that.

* test: cover the launch-draft reducers and the sync-key skip gate

Every consumer test injects the three launch-draft reducers as bare
vi.fn()s, so reducing markNativeChatLaunchDraftAdopted to a no-op left
2609 tests green — while in the app the composer would resurrect the
prefill after every manual clear.

canSkipRuntimeMobileSessionSyncKeyBuild had no launch-draft case either:
when it skips, the sync key is never even built, so the existing
getRuntimeMobileSessionSyncKey case cannot catch its removal.

* fix(native-chat): hold the launch-draft baseline in state, not a render-mutated ref

react-compiler rejects reading or writing a ref during render. Adjust the held
baseline with the sanctioned render-time setState instead, keeping the local
copy so the render that first sees a settled transcript resolves against it.

* fix(mobile): carry the transcript identity in the session read state

react-doctor flags the separate loadedIdentity state as an extra render for a
derivable value. Hold status alongside the identity it describes in one state
written by the subscription effect, so transcriptLoading derives from it.

* test(native-chat): assert the readPhase contract without the hook-status race

The test asserted status === 'working', which depends on liveStatusOverride
winning over ambient transcript state — green locally, red under CI load. The
contract is that readPhase stays 'loading' once live content unmasks status,
so assert exactly that; it still fails if readPhase derives from status.

* fix(mobile): derive pre-read chat status instead of writing it from the effect

react-doctor's no-derived-state-effect flags idle/waiting-session/loading being
set in the subscription effect: all three are pure functions of the props. Derive
them during render and keep state only for the genuinely async outcome, tagged
with the identity it describes.

The tag now gates `messages` too, so a just-switched tab never sees the previous
tab's transcript at all rather than seeing it behind a loading flag.

* fix(mobile): drop a settled chat read once its subscription is torn down

The settled outcome was only ever replaced by a newly arriving frame, so any
effect re-run that landed back on an already-settled identity resurfaced it over
a list the same effect had just cleared: 'ready' with no messages and
transcriptLoading false. Toggling out of chat view and back hit this every time
(the agent goes null, then returns), flashing the "start a chat" empty state over
a real conversation and opening the launch-draft seed's decline check on an empty
transcript. A reconnect did the same via the client dep.

Identity and client are the effect's only inputs, so tagging the read with both
and dropping it during render when either moves covers every re-run.

* fix: pr-bug-scan validated finding from #6471 (#6512)

* fix: address pr-bug-scan validated finding from #6471

stripTags now removes real markup (closing/self-closing/attributed/custom tags) outside the allow-list; only bare identifier-glued generics like Array<string> are kept. Blocks svg/center/custom leak a

* fix: address pr-bug-scan validated finding from #6471

stripTags now removes real markup (closing/self-closing/attributed/custom tags) outside the allow-list; only bare identifier-glued generics like Array<string> are kept. Blocks svg/center/custom leak a

* fix(mobile): harden markdown preview tag stripping

* fix(mobile): preserve angle-bracket prose while stripping tags

---------

Co-authored-by: orca-bug-scan-bot <orca-bug-scan-bot@stably.ai>
Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* feat(worktrees): support project-level worktree.sharedDirectories in orca.yaml (#10459)

* feat(worktrees): support project-level worktree.sharedDirectories in orca.yaml

Follow-up to #7549: `.worktreeinclude` copies gitignored paths into each new
worktree, which is right for `.env`/`.vscode/` but wrong for large rebuildable
directories. Copying `node_modules` per worktree is slow and duplicates disk,
and each worktree's install then diverges.

Adds `worktree.sharedDirectories` to `orca.yaml` — a versioned, in-repo list of
gitignored directories that are symlinked (shared) into every new local
worktree, so one install serves them all. Adds to, never replaces, the per-user
Worktree Shared Paths setting.

`createWorktreeSharedPaths` uses a new 'share' materialization mode that always
symlinks. The existing 'link' mode APFS clone-copies on macOS, which would give
each worktree an independent node_modules and defeat the point; 'link' and
'copy' behavior are unchanged.

Entries must exist as gitignored directories in the primary checkout; absolute
paths, `..` traversal, and `.git` are rejected. Resolution never throws, so a
malformed orca.yaml cannot block worktree creation. Remote (SSH) creation skips
this, as it does symlink paths and `.worktreeinclude`.

Closes #10451

* fix(worktrees): keep worktrees deletable after sharing a directory

A directory-only ignore rule (`node_modules/`, the common spelling) matches
the primary checkout's real directory, so the shared directory resolves and
gets symlinked — but it never matches the worktree's symlink, so Git reports
that link as untracked. Deletion only tolerated the per-user shared paths, so
every worktree in such a repo became permanently dirty: the clean preflight
threw "uncommitted or untracked changes" and `git worktree remove` refused
without --force.

Feed the configured `orca.yaml` shared directories into the same
tolerate-and-unlink machinery the per-user shared paths already use, at both
deletion call sites. The names are read unfiltered, since the create-time
resolver drops exactly the entry deletion needs most.

* test(worktrees): register createWorktreeSharedPaths in the runtime symlink mock

orca-runtime.ts imports createWorktreeSharedPaths, but the vi.mock factory for
../ipc/worktree-symlinks never listed it. Vitest resolves omitted exports
lazily, so this only stays green because no runtime test configures a repo with
worktree.sharedDirectories — the first one that does would fail on a mock
resolution error rather than on its own assertion.

* fix(source-control): don't count shared symlinks as uncommitted changes

A directory-only ignore rule (`node_modules/`) matches the primary checkout's
real directory but never the worktree's symlink, so Git reports the shared link
as untracked for the life of the worktree. That made every affected worktree
read as dirty: a phantom row in the diff view, and Create PR blocked with
`blockedReason: 'dirty'` telling the user to commit an entry they cannot
commit, because it is a symlink Orca created.

Status and the review-creation preflight now drop untracked entries that are
both declared shared (per-user shared paths or orca.yaml sharedDirectories) and
actually symlinks on disk. Both conditions are required, so a regular file at a
declared name, or a symlink nobody declared, still counts as user work. The
decision fails closed: anything not positively identified stays dirty.

The preflight moves to `--porcelain -z` so paths with spaces or non-ASCII bytes
are compared raw rather than C-quoted, with a parser that consumes the origin
field a rename emits instead of reading it as its own record.

Symlink detection moves to a leaf module: importing it from ipc/worktree-symlinks
would pull APFS cloning, and its child_process dependency, into the status graph.

SSH is unaffected and left alone — remote worktree creation skips the symlink
and shared-directory passes, so a remote worktree never has one.

* fix(source-control): wire shared links into local status

* fix(worktrees): resolve the status repo once and reject uncollapsed shared paths

`git:status` resolved the registered worktree's repo twice per call — once
inside `getLocalGitOptionsForRegisteredWorktree` and again for the shared-link
lookup — walking every repo's worktree meta on a polling path.

`apps/./web` also survived `sharedDirectories` normalization: `resolve()`
collapses it when the symlink is created but Git reports the collapsed path, so
every later comparison misses and the link reads as permanent untracked work.

Also stop resolving shared links for SSH repos in review creation: `repo.path`
names a path on the remote host.

Adds the missing wiring coverage for review creation and runtime status, plus
the untracked-only conjunct in both filters — all four were mutation-verified
to leave the suite green before these tests.

* test(worktrees): pin the resolver-to-status seam for shared directories

The resolver's output and the status filter were only tested apart — status
used a hardcoded `['node_modules']`. Feed the resolved directories back through
`getWorktreeSharedLinkPaths` into a real `getStatus` so a resolver that ever
returned a differently-spelled path can no longer leave the link showing as a
phantom untracked row.

* fix(worktrees): try a directory junction before a symlink on Windows

A plain `fs.symlink` needs Developer Mode or admin on Windows, so an ordinary
Windows user got EPERM, the per-path catch logged and continued, and the
worktree came up with no shared directory and no signal. A directory junction
needs no privilege, and the rest of the codebase already uses one for win32
directory links.

The symlink stays as a fallback rather than being replaced: a junction cannot
target a UNC path, and a WSL project's repo lives behind one, so replacing it
outright would trade the local-volume bug for a WSL regression.

Safe for the removal path either way — Windows reports a junction as both a
symlink and a directory, so the `isSymbolicLink()` unlink that runs before
`git worktree remove` still fires and still refuses to follow it.

* fix(worktrees): keep NUL bytes and tolerated links out of the removal error

The removal preflight switches to `git status --porcelain -z` whenever it has
shared links to tolerate, then attached that raw stdout to the error. `.trim()`
does not strip interior NULs, so the message reached the user as
`?? node_modules<NUL>?? precious.txt<NUL>` — raw control bytes, and it named the
shared link, the one entry that is not the user's work and cannot be committed
away.

Parse the NUL-delimited output once and use it for both the clean verdict and
the error text, so the two can never disagree about what blocks removal. The
`-z` switch stays: it is what keeps paths with spaces or non-ASCII names
comparable against the configured entry.

* chore(worktrees): drop stray reformatting and note why the SSH guard exists

Committing the merge staged 792 files, so lint-staged ran the formatter across
all of them and rewrapped three renderer files that were already unformatted on
main. Nothing was lost — they were byte-identical to main ignoring whitespace —
but they showed up in the pull request as unrelated changed files. Restored to
main's exact bytes.

Committed with --no-verify on purpose: the pre-commit formatter is what
introduced the rewrapping, so letting it run again would simply reapply it.
Every check it would have run was run by hand instead — lint, typecheck, and the
IPC and source-control suites all pass, and the three restored files are
expected to fail a format check because that is main's current state.

Also records why the connection guard on the shared-link lookup is not dead
code: the remote dirty check ignores those paths, so the guard's only effect is
avoiding a stray local read and the bad cache entry it would leave behind.

* refactor(source-control): drop a scan-everything guard and freeze the cached list

The dirty check built a filtered array only to read its length, so it always
scanned every status record; asking whether any record is untracked stops at the
first one and reads the same either way.

The cached shared-directory list was also handhanded out by reference, so a
caller that mutated it would corrupt every read for the rest of the cache
window. Marking the return readonly prevents that at compile time; copying on
return would work too but would allocate on the status-polling path, and there
is exactly one caller, which only spreads it.

* fix(mobile): exclude proxy fake-ip addresses from pairing QR (#10498)

* fix(mobile): exclude proxy fake-ip addresses from pairing QR

Clash/mihomo TUN interfaces in 198.18.0.0/15 were enumerated as pairing
candidates and could become the default QR endpoint. Phones then retry an
unroutable address forever. Drop those addresses from the pickable list (#10404).

* refactor(mobile): keep fake-ip filtering local

* test(mobile): cover fake-ip range boundaries

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>

* Bug floating workspace shortcuts route to main w (#10433)

* fix(floating-workspace): route panel shortcuts to the floating panel, not the main window

Floating-workspace close/index keyboard shortcuts leaked to the main
window behind the panel. Route them through the floating panel across all
four keydown layers via an atomic focus signal, panel-owned indexed
switching with a tri-state outcome, an event-target-aware close guard, and
a floating-scoped guest IPC bridge.

Changes A-E and findings F2/F3/F4/F6/F7/F8/F9/F11/F-adv/F-dl/F-feas.

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: feelgom <littlestork4@gmail.com>
Co-authored-by: Wooseong Kim <innocarpe@gmail.com>

* fix(review): clear stale floating-panel reclaim intent on panel close

The module-singleton reclaim intent (F3) is armed at an emptying-close but only
consumed by the visibleFloatingItemCount->0 effect. If a concurrent tab-create
keeps the panel from reaching 0, the intent stays armed and could survive to a
later empty-panel mount and steal keyboard focus. The !open release effect now
clears it (defense-in-depth), matching the outside-pointerdown/window-blur paths.

Flagged by 4 review personas (correctness, adversarial, julik-races, maintainability).

Co-authored-by: Orca <help@stably.ai>

* test(floating-workspace): cover L1 index-chord yield and deferred-close reclaim-arm timing

Two additive R2-review tests for the #10288 floating-workspace shortcut
routing change set:

- createMainWindow: assert L1 yields the initial indexed-switch chord
  (tab-index and worktree-index) to the floating panel without
  preventDefault or dispatch, and contains held-key auto-repeats in main
  (preventDefault, no dispatch). Closes the untested Change B (F4) path.

- FloatingTerminalPanel: assert an emptying, panel-owned close whose
  closeTerminalTab defers/cancels (onClosed never fires) leaves the
  reclaim intent unarmed, so no later empty-panel mount can reclaim focus
  for a close that never happened. The prior mock fired onClosed
  unconditionally, so this arm-timing (F3) branch was uncovered.

Co-authored-by: Orca <help@stably.ai>

* fix(review): resolve round-1 findings F-1..F-6

- F-1: re-derive panel emptiness from live store at arm time; clear stale
  reclaim intent on repopulating create so an unrelated later close can't
  consume it and steal keyboard focus from the main workspace.
- F-2/F-5a: single-source the panel's non-creation shortcut claims via
  matchFloatingWorkspacePanelShortcut(); shared isTerminalPaneCloseChord()
  predicate for L2/L3; App.tsx gate + both FloatingTerminalPanel call sites
  now call the SSOT so index/rename/max-min ownership can't drift.
- F-4: L2 keydown gate is event-target-aware (matches L1 yield) so an
  L1-yielded chord is still consumed during a transient panel blur.
- F-5b: export clearReportedFloatingFocusCache() + reset it in test setup.
- F-5c: split floating-workspace-item-actions.ts into focus-reclaim +
  guest-bridge modules (AGENTS.md file-naming).
- F-6: trim verbose design-code comments to single-line WHY.

Co-authored-by: Orca <help@stably.ai>

* fix(floating-workspace): remove finding reference labels

These internal review labels (F1–F7) and change identifiers were used during development and are no longer needed in the code.

* fix(…
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ai#17017)

`ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote`
that predates stablyai#11003. Commit 57d3b79 gave `fetchWorktrees` a host-qualified
authority gate that short-circuits to `return false` for an SSH host with no
complete `directSshAuthority`, and updated the shared
`connectDockerSshRelayTarget` helper in the same commit -- but never touched
this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)`
-> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is
empty, `[0]` is undefined, and setup throws
`No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the
spec reaches a single title assertion.

Differential across 5 lane runs (~130 SSH connects): the shared helper's guard
errors fired 0 times; `No remote worktree found` fired 3 times, always via the
fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher
isolation`.

The spec now calls the shared helper. Every helper default matches what the
fork passed (`relayGracePeriodSeconds: 1`, `remotePath`
DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`);
the helper additionally uses `target.host` rather than a hardcoded
`127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`.

No assertion changed; no retry, sleep, or timeout was added anywhere.
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.

3 participants