Skip to content

Fix paired web creation failure handling (STA-4024, STA-4025, STA-4063) - #14100

Merged
Jinwoo-H merged 18 commits into
mainfrom
aug12-blocker-paired-web
Aug 13, 2026
Merged

Jinwoo-H merged 18 commits into
mainfrom
aug12-blocker-paired-web

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes STA-4024, STA-4025, and STA-4063.

  • Add Project selects only hosts accepted by canSelectAddRepoHost; no eligible host keeps Browse, Clone, and Create disabled.
  • Paired browser creation returns success only after the exact host page materializes in the requested client split.
  • Known-page reconciliation failures close and confirm removal of the canonical host page; ambiguous outcomes reject without local fallback.
  • Capability rejection is inside the shared creation cleanup boundary, so absent, unknown, or mixed-version browser capability reports failure and removes only a caller-declared new empty split.

Audited main: bc2e30000b; rebased base: origin/main@150cc6f50c (includes merged #13909). Final evidence head: 27557590fc.

What #13909 and the original #14100 covered

#13909 supplied the sound provider-policy boundary, visible duplicate-failure path, and no-local-fallback rule. It did not remove Add Project's raw first-host fallback or make browser creation/materialization transactional.

The original #14100 side-preview caller already preflighted browser availability, caught asynchronous rejection, and removed a newly-created split. STA-4063 was only partially covered: direct createWebRuntimeSessionBrowserTab still asserted capability before its cleanup try, so a caller that handed it a new split received the unsupported rejection but the split remained.

Root causes and design

STA-4024

The selector preferred eligible hosts but finally accepted selectableHostOptions[0] without applying canSelectAddRepoHost. Removing that fallback keeps eligibility authoritative in the selection hook and makes null the existing disabled-action state.

STA-4025

browser.tabCreate success was treated as operation success even when eager session-tab reconciliation failed. Creation now checks exact environment/page/worktree/group materialization after a post-current snapshot. A known page enters bounded compensating recovery: exact close, confirming snapshot, placement release, empty-split cleanup, then failure. Unknown create/cleanup outcomes throw and fail closed.

STA-4063

Capability assertion happened before the shared create transaction's cleanup boundary. It now runs inside that boundary and before placement, selection, focus, or RPC side effects. Pre-create rejection preserves the original unsupported error, performs zero runtime RPCs, and removes only a group explicitly marked as newly created. Caller preflight remains for immediate UX and its empty-group callback covers the earlier inactive-runtime false return.

This shared transaction owner is safer than duplicating cleanup policy across every caller. Pending placement entries carry transferable, worktree/group-scoped cleanup ownership: snapshot construction only peeks, teardown retains the sole owner until its bounded operation settles, successful materialization cancels delayed cleanup, and final arbitration occurs immediately before closing the empty group. Admission rejects a 129th concurrent placement instead of evicting live ownership. This avoids a new wire field/opcode and preserves browserless hosts, older paired clients/hosts, SSH/folder ownership, and desktop/web behavior.

Deterministic red/green proof

The same five-assertion STA-4063 oracle checks three direct-create capability states and two HTML side-preview caller states. Its independent signals are the original error or visible toast, zero RPC before creation, and absence of a newly-created empty split.

State Ref STA-4063 result
Scan target e4c278eb52 + unchanged oracle 5/5 failed
Latest main bc2e30000b + unchanged oracle 5/5 failed
Original #14100 7e0b8f0745 3 direct failed; 2 caller passed
Rebased candidate 27557590fc 5/5 passed
Final candidate with only capability cleanup boundary disabled a9e6fb7716 3 direct failed; 2 caller passed
Restored final candidate 27557590fc 5/5 passed

The disabled control moved only the capability assertion/fault back outside the cleanup try; the unchanged assertions then proved closeEmptyGroup was never called in all three direct cases.

STA-4024's blocked/unavailable sole-host oracle and STA-4025's exact materialization/rollback oracle remain green on the rebased candidate.

Validation

  • Focused coherent suite: 9 files, 215/215 passed.
  • pnpm run lint: passed, including type-aware/native audits, 77 reliability gates, max-lines ratchet, skills, and localization checks.
  • pnpm run typecheck: passed.
  • Full paired Electron STA-4025 + STA-4063 spec, visible headed desktop host: 2/2 passed in 23.5s.
  • Same isolated headless orca serve journey: 1/1 passed in 10.3s; both injected faults run against one live host.
  • STA-4024 headed paired Electron: 1/1 passed in 7.2s.
  • STA-4024 headless parity: 1/1 passed in 4.2s, then 1/1 under the exact CI environment after CI registration was fixed.
  • STA-4063 E2E forces capability rejection after caller preflight, observes the failure toast, and compares exact host/client browser, group, editor, and terminal inventories to baseline. No host page is created.
  • Exact-head CI: running on 27557590fc.

Visual proof: N/A. The failure path is transient; deterministic Electron assertions cover the rendered toast and exact UI/host inventory restoration, with screenshots retained in Playwright output.

Compatibility and tradeoffs

  • No RPC schema, stream opcode, persistence schema, dependency, Git command, or provider-specific review contract changes.
  • Desktop/web, headed/headless/browserless runtime, mixed paired versions, folder workspaces, SSH ownership, and platform-neutral selection retain existing boundaries.
  • Capability rejection adds zero RPCs and one bounded empty-group close. Successful creation keeps one confirming list; known-page failure adds one exact close and one confirming list. There is no retry loop.
  • Placement/cleanup arbitration scans at most 128 live entries. A 129th simultaneous placement fails visibly rather than silently evicting active cleanup ownership.
  • A known-page adverse-network failure can consume sequential bounded RPC deadlines while recovery settles.
  • A create timeout before a canonical page ID remains deliberately ambiguous: the client reports failure and refuses local fallback because it cannot safely identify a page to close.
  • Live paired validation is macOS; Linux/Windows behavior is covered by platform-neutral contracts and CI rather than new physical journeys.

Review state

Five internal review rounds fixed every proven P0-P2 finding: duplicate caller cleanup, cross-host reservation loss, both-fail orphaning, rollback TOCTOU, cap eviction, snapshot/teardown ownership loss, and a paired-web CI false-green. Fresh adversarial and performance/resource reviews are clean on the production head; readiness is clean after the CI registration follow-up. Existing CodeRabbit actionable comments are addressed; its current pause is not a merge gate. Do not merge automatically—this PR is for human merge decision after final-head CI completes.

@Jinwoo-H
Jinwoo-H force-pushed the aug12-blocker-paired-web branch 3 times, most recently from bd0481f to ef473ec Compare August 12, 2026 20:26
@Jinwoo-H
Jinwoo-H marked this pull request as ready for review August 12, 2026 20:26
@coderabbitai

coderabbitai Bot commented Aug 12, 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

Paired browser creation now validates client materialization, classifies creation outcomes, and cleans up unreconciled host pages. E2E fault controls and headed/headless rollback tests cover reconciliation failures. Runtime preview and browser-tab failures now show errors, clean up empty groups, and avoid local fallback. Editor previews and file explorer browser actions now require workspace browser capability. Add Project host selection now excludes blocked or errored hosts, with unit tests, E2E coverage, and expanded reliability gates.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: paired web creation failure handling across the linked issues.
Description check ✅ Passed The description is comprehensive and covers changes, rationale, linked issues, visual proof, testing, compatibility, and review status.
✨ Finishing Touches 💡 1
📝 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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 40ce6b52-c28f-4040-9717-cbc51961e615

📥 Commits

Reviewing files that changed from the base of the PR and between fc7c2a1 and ef473ec.

📒 Files selected for processing (17)
  • config/reliability-gates.jsonc
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/tab-group/useTabGroupWorkspaceModel.ts
  • src/renderer/src/hooks/useIpcEvents.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts
  • src/renderer/src/lib/workspace-browser-tab-open.test.ts
  • src/renderer/src/runtime/web-runtime-browser-creation-e2e-fault.ts
  • src/renderer/src/runtime/web-runtime-browser-materialization.test.ts
  • src/renderer/src/runtime/web-runtime-browser-materialization.ts
  • src/renderer/src/runtime/web-runtime-session.test.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • tests/e2e/paired-browser-creation-reconciliation-failure.spec.ts
  • tests/e2e/paired-web-add-project-unavailable-host.spec.ts

Comment thread config/reliability-gates.jsonc Resolved
Comment thread config/reliability-gates.jsonc Resolved
@Jinwoo-H
Jinwoo-H force-pushed the aug12-blocker-paired-web branch from ef473ec to 8abf0f5 Compare August 12, 2026 21:00

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

🧹 Nitpick comments (1)
src/renderer/src/lib/file-preview.ts (1)

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

Correct dual-path failure handling.

The function runs onFailure?.() before toast.error in both the resolved-false and rejected paths. This matches the test expectations for both outcomes.

Consider consolidating the duplicated toast.error(FILE_BROWSER_OPEN_FAILED_MESSAGE) call into a single shared failure handler for .then/.catch, since both branches now perform the same two steps in the same order.

♻️ Optional refactor to remove the duplicated toast call
 function reportRemoteFileBrowserOpen(result: Promise<boolean>, onFailure?: () => void): void {
+  const reportFailure = (): void => {
+    onFailure?.()
+    toast.error(FILE_BROWSER_OPEN_FAILED_MESSAGE)
+  }
   void result
     .then((created) => {
-      if (!created) {
-        onFailure?.()
-        toast.error(FILE_BROWSER_OPEN_FAILED_MESSAGE)
-      }
+      if (!created) {
+        reportFailure()
+      }
     })
-    .catch(() => {
-      onFailure?.()
-      toast.error(FILE_BROWSER_OPEN_FAILED_MESSAGE)
-    })
+    .catch(reportFailure)
 }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6007a25d-13f2-4bbb-8332-c2e41e8fd246

📥 Commits

Reviewing files that changed from the base of the PR and between 8abf0f5 and d408802b070eb6effe36e4bd6ab922c4d0ae6e35.

📒 Files selected for processing (3)
  • config/reliability-gates.jsonc
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/lib/file-preview.test.ts

@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: 3df206ca-d717-4201-b40c-b71a5b363dcb

📥 Commits

Reviewing files that changed from the base of the PR and between 6f2cc01e7c4ec47334107c49aa7dba17c24ec3b8 and 879b94cf3ff9cf6aabac93290a9222577fc353ed.

📒 Files selected for processing (9)
  • src/renderer/src/components/editor/CombinedDiffViewer.tsx
  • src/renderer/src/components/editor/EditorPanel.tsx
  • src/renderer/src/components/editor/diff-section-preview.test.ts
  • src/renderer/src/components/editor/diff-section-preview.ts
  • src/renderer/src/components/editor/editor-panel-render-model.test.ts
  • src/renderer/src/components/editor/editor-panel-render-model.ts
  • src/renderer/src/components/right-sidebar/FileExplorerRow.tsx
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts

Comment on lines +484 to +487
const activeWorktreeId = useAppStore((s) => s.activeWorktreeId)
const canOpenInOrcaBrowser = useAppStore((s) =>
activeWorktreeId ? canShowWorkspaceFileBrowserAction(s, activeWorktreeId) : false
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Resolve the active workspace key before gating this action.

Folder workspaces store activeWorktreeId as null, while activeWorkspaceKey contains the folder:<id> key. This code therefore hides the browser action at Line 770, and handleOpenInOrcaBrowser also cannot pass a workspace ID at Lines 512-520. Resolve the current workspace with getActiveSidebarWorkspaceId(activeWorkspaceKey, activeWorktreeId). Use the resolved key for the capability check, menu guard, and openFileInBrowserTab call. Add a folder-workspace regression test.

As per coding guidelines: “All changes must support folder workspaces as well as Git worktrees; do not assume every workspace is a Git worktree.” Based on learnings: folder selection stores activeWorkspaceKey: folder:<id> with activeWorktreeId: null; derive the current workspace with getActiveSidebarWorkspaceId(activeWorkspaceKey, activeWorktreeId).

Also applies to: 770-771

Sources: Coding guidelines, Learnings

@Jinwoo-H
Jinwoo-H force-pushed the aug12-blocker-paired-web branch 2 times, most recently from 7e0b8f0 to 14b5877 Compare August 13, 2026 01:55
@Jinwoo-H Jinwoo-H changed the title Fix paired web creation failure handling (STA-4024, STA-4025) Fix paired web creation failure handling (STA-4024, STA-4025, STA-4063) Aug 13, 2026
@Jinwoo-H
Jinwoo-H force-pushed the aug12-blocker-paired-web branch from 864d0cc to b454987 Compare August 13, 2026 02:35
@Jinwoo-H
Jinwoo-H merged commit de729d6 into main Aug 13, 2026
47 checks passed
@Jinwoo-H
Jinwoo-H deleted the aug12-blocker-paired-web branch August 13, 2026 04:35
AmethystLiang pushed a commit that referenced this pull request Aug 13, 2026
hyoteis pushed a commit to hyoteis/orca that referenced this pull request Aug 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant