Repository navigation
Fix paired web creation failure handling (STA-4024, STA-4025, STA-4063) - #14100
Conversation
bd0481f to
ef473ec
Compare
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPaired 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)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (17)
config/reliability-gates.jsoncsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/sidebar/use-add-repo-host-selection.test.tssrc/renderer/src/components/sidebar/use-add-repo-host-selection.tssrc/renderer/src/components/tab-group/useTabGroupWorkspaceModel.tssrc/renderer/src/hooks/useIpcEvents.tssrc/renderer/src/lib/file-preview.test.tssrc/renderer/src/lib/file-preview.tssrc/renderer/src/lib/workspace-browser-tab-open.test.tssrc/renderer/src/runtime/web-runtime-browser-creation-e2e-fault.tssrc/renderer/src/runtime/web-runtime-browser-materialization.test.tssrc/renderer/src/runtime/web-runtime-browser-materialization.tssrc/renderer/src/runtime/web-runtime-session.test.tssrc/renderer/src/runtime/web-runtime-session.tssrc/renderer/src/runtime/web-session-tabs-sync.tstests/e2e/paired-browser-creation-reconciliation-failure.spec.tstests/e2e/paired-web-add-project-unavailable-host.spec.ts
ef473ec to
8abf0f5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/file-preview.ts (1)
14-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCorrect dual-path failure handling.
The function runs
onFailure?.()beforetoast.errorin both the resolved-falseand 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.jsoncsrc/renderer/src/lib/file-preview.test.tssrc/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
There was a problem hiding this comment.
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.tsxsrc/renderer/src/components/editor/EditorPanel.tsxsrc/renderer/src/components/editor/diff-section-preview.test.tssrc/renderer/src/components/editor/diff-section-preview.tssrc/renderer/src/components/editor/editor-panel-render-model.test.tssrc/renderer/src/components/editor/editor-panel-render-model.tssrc/renderer/src/components/right-sidebar/FileExplorerRow.tsxsrc/renderer/src/lib/file-preview.test.tssrc/renderer/src/lib/file-preview.ts
| const activeWorktreeId = useAppStore((s) => s.activeWorktreeId) | ||
| const canOpenInOrcaBrowser = useAppStore((s) => | ||
| activeWorktreeId ? canShowWorkspaceFileBrowserAction(s, activeWorktreeId) : false | ||
| ) |
There was a problem hiding this comment.
🎯 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
7e0b8f0 to
14b5877
Compare
864d0cc to
b454987
Compare
…3) (stablyai#14100) (cherry picked from commit de729d6)
Summary
Fixes STA-4024, STA-4025, and STA-4063.
canSelectAddRepoHost; no eligible host keeps Browse, Clone, and Create disabled.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
createWebRuntimeSessionBrowserTabstill asserted capability before its cleanuptry, 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 applyingcanSelectAddRepoHost. Removing that fallback keeps eligibility authoritative in the selection hook and makesnullthe existing disabled-action state.STA-4025
browser.tabCreatesuccess 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
falsereturn.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.
e4c278eb52+ unchanged oraclebc2e30000b+ unchanged oracle7e0b8f074527557590fca9e6fb771627557590fcThe disabled control moved only the capability assertion/fault back outside the cleanup
try; the unchanged assertions then provedcloseEmptyGroupwas 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
pnpm run lint: passed, including type-aware/native audits, 77 reliability gates, max-lines ratchet, skills, and localization checks.pnpm run typecheck: passed.orca servejourney: 1/1 passed in 10.3s; both injected faults run against one live host.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
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.