Skip to content

Conflict review shows the file's live unsaved text from any workspace (read-only) - #31990

Merged
nwparker merged 19 commits into
mainfrom
nwparker/editor-buffer-switch-g4
Oct 22, 2026
Merged

nwparker merged 19 commits into
mainfrom
nwparker/editor-buffer-switch-g4

Conversation

@nwparker

@nwparker nwparker commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​530 $\color{#cf222e}{\Huge{\mathbf{−}}}$​30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​500
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​240 $\color{#cf222e}{\Huge{\mathbf{−}}}$​71 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​169

ELI5

When a file has a conflict (it changed on disk while you had unsaved edits), the conflict-review overview shows your side. It used to show the text from one tab in the same workspace, or the disk text if the file was only open in another workspace. Now it shows the file's current unsaved text from whichever tab holds it — read-only, and updating live as you type there.

What Changed

  • The overview finds the file's shared unsaved-edit record and borrows one of its open tabs (preferring this workspace's tab, then this workspace's own edit tab, then another workspace's), mounting that record's text read-only. If no tab is open, it falls back to the disk text, as before.
  • It never edits, saves or prompts; it doesn't move the borrowed tab's cursor line or consume its pending "jump to line"; Retry reloads through the borrowed tab's own workspace.
  • It reloads when the borrowed tab opens, closes, re-keys or rejoins in any workspace, so it can't get stuck on "Loading…".

Why

Last step of moving to one editor buffer per file (after #31974). With tabs of a file sharing one record, the overview can show exactly the text that Overwrite/Reload would act on, which is what the conflict decision needs.

Linked Issue

Follow-up to #31974.

Visual Proof

N/A: the overview looks the same; it now shows the shared unsaved text instead of one tab's or disk text. Covered by tests against a real two-workspace store.

Testing

  • New tests: overview shows the other workspace's unsaved text on the same model; typing there updates it; read-only (change/save handlers don't touch the store); closing it leaves the record, drafts and prompts unchanged; disk fallback; reload when the borrowed tab changes; Retry uses the borrowed tab's workspace; no cursor-line or reveal side effects; lookup order and cache.
  • pnpm tc, ratchets, check:code-quality:changed, oxfmt pass; editor/store/hooks/runtime/sidebar suites pass.
  • Reviewed by Opus; findings applied.

Known gaps: a file whose last tab closed with unsaved text kept for recovery shows disk text here; if every tab of the file is mirrored from an older remote host, the overview uses the previous same-workspace behaviour.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

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

Notes

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

Checklist

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

nwparker and others added 19 commits October 21, 2026 14:42
…oved tabs

Delete the pendingDiskBaselineVerification and pendingLiveDiskVerification
pause flags. Every editor save is already a guarded write; a refusal raises
the changed-on-disk banner, which is what stops autosave until an explicit
save.

A guarded write now succeeds when disk changed but already holds exactly the
text being saved (local/host compare is byte-exact; client-side fallbacks
compare decoded text and refuse when it holds U+FFFD), so a restored draft
that matches disk goes clean instead of showing a banner.

The restore scan only raises the banner early for tabs that arrive dirty; a
watch resync no longer re-checks dirty tabs.

Co-Authored-By: Claude <[email protected]>
Return a compatible optional no-op result from hosts and client fallbacks, clean the tab, and clear its provisional self-write stamp without rewriting identical bytes.

Co-Authored-By: Claude <[email protected]>
…er hosts, flag dirty tabs on resync

- Autosave and pre-restart saves refuse when disk text can't be decoded losslessly, so a
  baseline that decoded to U+FFFD can't authorize overwriting different bytes.
- New files.write.identical-noop.v1 capability; for hosts with only the v1 guarded write the
  client compares first, skips identical saves, then delegates to the host's guarded write.
- Watch resync compares dirty tabs against disk and shows the changed-on-disk banner.
- Local guarded writes check for identical content before the write-only regular-file probe.

Co-Authored-By: Claude <[email protected]>
…false resync banners

- Local guarded writes judge losslessness by bytes, so a valid UTF-8 file containing U+FFFD
  autosaves again. A file that really isn't UTF-8 is refused with its own reason, 'not-utf8'
  (older clients read it as 'changed'), which pauses autosave for that file with one notice
  until an explicit save converts it.
- A watch resync whose disk read fails leaves dirty tabs alone; the guarded save still catches
  a real conflict.
- Resync and restored-tab checks treat disk holding the tab's own just-written save as an echo.
- On hosts with only the v1 guarded write, only automatic saves read the file first; explicit
  saves go straight to the host's guard.

Co-Authored-By: Claude <[email protected]>
…d report disk changes first

- The pause is released once no dirty tab of the file remains (close, reload from disk,
  discard), so a reopened or reloaded file's next autosave asks the host again and notifies.
- Client-side precondition checks compare the signature before looking for U+FFFD, so an
  external rewrite shows the changed-on-disk banner rather than the non-UTF-8 notice.

Co-Authored-By: Claude <[email protected]>
…e sharing switch uses

First of the stacked sharing-switch PRs (G1). Inert while every record has
one view, which is all main produces today; tests drive the shared shape
through hand-built view indexes.

- Autosave timers are decided per record by its first view that may
  autosave, so a read-only or preview view of a record no longer cancels
  the record's timer, and a timer survives the view that scheduled it
  closing (it resolves a live view of the record when it fires).
- A view of a detached record gets its own model owner key, so divergent
  dirty drafts never share text with the file's other record.
- Pure join and rejoin rules: rekey / attach / adopt (dirty wins) / merge
  (identical dirty) / detach (divergent dirty); a detached pair rejoins
  only once one side is clean.
- Mirrored host tabs: a record's dirty flag is the OR of its host-owned
  views, since an older host publishes it per tab; the dev invariant
  tolerates exactly that disagreement.

Co-Authored-By: Claude <[email protected]>
…e view for autosave

- A merge needs equal drafts, baselines, conflict and owner-migration state;
  anything else detaches, so a paused record never resumes autosave by joining.
  A side whose text is still pending (no draft) never counts as identical.
- A clean-flagged view that still holds a draft counts as dirty in joins.
- The invariant tolerates a clean host-owned view on a dirty record only when
  another host-owned view of that record reads dirty.
- Autosave and restart skip CSV-preview and read-only views when picking the
  view a record writes through.

Co-Authored-By: Claude <[email protected]>
…r-switch-g1-fixes

# Conflicts:
#	src/renderer/src/components/editor/editor-save-queue.ts
A dirty view with no draft no longer pushes disk text into the shared model; merge and
deleted-banner joins mirror the record; web-session sync honours detached views.

Co-Authored-By: Claude <[email protected]>
…ompt closes, restore merges

- Rich Markdown, notebook and CSV commits also edit the record's models no editor shows, as one
  undoable edit; a save moves every loaded view's panel text to the written disk text, so a stale
  dirty check can't mark the record clean over unsaved edits.
- A detached pair rejoins once one side is clean (save, Discard, reload) or the partner closes:
  the clean side attaches, a dirty side wins with its own baseline, so its next save is refused
  and the banner shows on every view. Rejoin runs on the next microtask, after the caller has
  finished settling the record; doing it mid-settle let the settle clear the adopted draft.
- A dirty record whose last view a no-prompt removal closed is kept with its draft and model;
  reopening the file joins it, it never autosaves, and dismissing the removal notice drops it.
- Restored identical drafts merge; divergent ones detach with their own models and timers.

Co-Authored-By: Claude <[email protected]>
…e a record through its writable view

Adds save-queue and store tests for rename and owner-resolution re-keys carrying a conflict, a
read-only sibling joining a dirty record, retired-runtime quarantine, runtime-in-SSH identity, the
reconnect writer, restart once per record, and a 200-tab index.

Fix: restart picked a record's first dirty view, so a read-only view listed first refused the
whole restart; it now picks the record's first view that may autosave.

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

- A no-prompt removal's keep request rides in the write that closes the tabs
  (editorBufferKeepRequest, consumed by the record middleware), so a removal
  closing tabs over several writes keeps every dirty record it closes.
- Kept records carry their removal notice's token; dismissing a notice, or
  failing to show it, releases only that notice's records.
- A divergent dirty view reopening a kept record stays detached on its own
  model; a rename onto a kept record's path drops the kept record.
- Each rich/notebook/CSV commit into a retained model is its own undo step.
- The saved event names the record's views, so the panel updates them even
  when the saving tab closed mid-save.
- A queued save compares the discard epoch of the record it was queued under.
- Typing no longer runs the rejoin check; only clearing a side's draft does.

Co-Authored-By: Claude <[email protected]>
…r-switch-g3

# Conflicts:
#	src/renderer/src/components/editor/editor-model-owner.test.ts
#	src/renderer/src/components/editor/editor-model-owner.ts
#	src/renderer/src/components/editor/editor-save-queue-records.test.ts
#	src/renderer/src/store/editor-buffer-record-lifecycle.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-join.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-mirrored-dirty.test.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-record.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-views.ts
…, read-only and live

The overview of a conflict review now reads each file through any open view of its
shared buffer record (this workspace's first), so it shows the record's current unsaved
text and model and follows typing in another workspace. It stays read-only and is never
a view itself: it loads as that view would and never pushes text. With no view open it
still shows disk text.

Co-Authored-By: Claude <[email protected]>
…ever acts as it

- The overview's load reruns when the view it reads through opens, closes, re-keys,
  detaches or rejoins in any workspace, so it no longer sticks on "Loading...".
- Retry reloads through the borrowed view's own workspace, and the editor resolves
  through that workspace, so this workspace never re-owns the other's tab.
- Overview editors are passive mirrors: they don't move the borrowed tab's cursor
  line or take a reveal meant for it.
- This workspace's own tab (even a detached one with its own edits) wins over
  another workspace's view.
- The panel's draft selector re-resolves when tabs or record views change, not only
  when drafts do; overview lookups are memoized per tabs/views/routes, and the
  stand-in cache evicts least recently used entries instead of clearing.

Co-Authored-By: Claude <[email protected]>
…r-switch-g4

# Conflicts:
#	src/renderer/src/runtime/web-session-tabs-sync/apply-final-patch.ts
#	src/renderer/src/store/editor-buffer-record-lifecycle.test.ts
#	src/renderer/src/store/editor-buffer-record-lifecycle.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-identity-cache.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-mirrored-dirty.test.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile-write.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile.ts
#	src/renderer/src/store/slices/editor/buffers/editor-buffer-record.ts
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Conflict-review overviews now resolve conflict files to existing editor views when available. Loading and draft selection use those views’ IDs, paths, and worktrees. Read-only overview content renders as a passive Monaco mirror that does not update the borrowed view’s cursor line or consume pending reveals. Tests cover view resolution, loading, draft selection, retries, and preservation of borrowed-view state.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 49143

After a workspace route change, conflict review can show the wrong tab’s unsaved draft. Fix the draft selector’s cache guard before merging, or accept this narrow risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main user-facing change: conflict review displays live unsaved text from any workspace in read-only mode.
Description check Passed The description is mostly complete. It explains the user impact, implementation, rationale, testing, known gaps, and checklist status. The linked issue is referenced as #31974 but is not provided as a…
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.
Full details: Description check

Explanation

The description is mostly complete. It explains the user impact, implementation, rationale, testing, known gaps, and checklist status. The linked issue is referenced as #31974 but is not provided as an actual link, and manual testing and full command checks remain unchecked.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6779b139-186f-415d-9464-0744e428f4bf
📥 Commits

Reviewing files that changed from the base of the PR and between 885cd6f and 49143d1.

📒 Files selected for processing: 20
  • src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx
  • src/renderer/src/components/editor/EditorConflictReviewSurface.tsx
  • src/renderer/src/components/editor/MonacoEditor.tsx
  • src/renderer/src/components/editor/editor-panel-draft-selector.test.ts
  • src/renderer/src/components/editor/editor-panel-draft-selector.ts
  • src/renderer/src/components/editor/monaco-editor-mount-params.ts
  • src/renderer/src/components/editor/use-monaco-editor-mount.cursor-owner.test.tsx
  • src/renderer/src/components/editor/use-monaco-editor-mount.ts
  • src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.overview.test.tsx
  • src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.ts
  • src/renderer/src/components/editor/useEditorPanelContentState.test.tsx
  • src/renderer/src/components/editor/useEditorPanelContentState.ts
  • src/renderer/src/components/editor/useEditorPanelFloatingTabContentState.test.tsx
  • src/renderer/src/components/editor/useEditorPanelHostUnresolvedContentState.test.tsx
  • src/renderer/src/components/editor/useEditorPanelRemoteSiblingContentState.test.tsx
  • src/renderer/src/components/editor/useEditorPanelVisibilityContentState.test.tsx
  • src/renderer/src/store/slices/editor/buffers/editor-buffer-conflict-overview.test.ts
  • src/renderer/src/store/slices/editor/buffers/editor-buffer-conflict-overview.ts
  • src/renderer/src/store/slices/editor/buffers/editor-buffer-identity-cache.ts
  • src/renderer/src/store/slices/editor/file-ids/editor-file-ids.ts
💤 Files with no reviewable changes: 2
  • src/renderer/src/components/editor/useEditorPanelContentState.ts
  • src/renderer/src/store/slices/editor/file-ids/editor-file-ids.ts

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

Comment on lines 44 to +73
let previousDrafts: AppState['editorDrafts'] | null = null
let previousOpenFiles: EditorDraftState['openFiles'] | null = null
let previousViews: EditorDraftState['editorBufferViews'] | null = null
let previousSelection = EMPTY_EDITOR_PANEL_DRAFTS

return (state) => {
// Why: every Zustand write reruns the selector. The slice identity guard
// keeps unrelated terminal/status traffic allocation-free.
if (previousDrafts === state.editorDrafts) {
// keeps unrelated terminal/status traffic allocation-free; overview ids
// also move with the tabs and record views they resolve through.
if (
previousDrafts === state.editorDrafts &&
(overviewPaths.length === 0 ||
(previousOpenFiles === state.openFiles && previousViews === state.editorBufferViews))
) {
return previousSelection
}
previousDrafts = state.editorDrafts
previousOpenFiles = state.openFiles
previousViews = state.editorBufferViews

const ids = selectedFileIds(state)
const changed = ids.some((fileId) => {
const draft = state.editorDrafts[fileId]
return (
draft !== previousSelection[fileId] ||
(draft === undefined && Object.hasOwn(previousSelection, fileId))
)
})
const idSet = new Set(ids)
const changed =
ids.some((fileId) => {
const draft = state.editorDrafts[fileId]
return (
draft !== previousSelection[fileId] ||
(draft === undefined && Object.hasOwn(previousSelection, fileId))
)
}) || Object.keys(previousSelection).some((fileId) => !idSet.has(fileId))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,130p' src/renderer/src/components/editor/editor-panel-draft-selector.ts
sed -n '1,135p' src/renderer/src/store/slices/editor/buffers/editor-buffer-conflict-overview.ts
sed -n '20,85p' src/renderer/src/store/slices/editor/buffers/editor-buffer-identity-cache.ts

Repository: stablyai/orca

Length of output: 9506


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- route inputs and declarations ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'EDITOR_BUFFER_ROUTE_INPUT_KEYS' -e 'EditorBufferRouteState' -e 'editorBufferRouteInputsChanged' src/ || true
printf '%s\n' '--- route input key names ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'runtimeEnvironments' -e 'editorBufferIdentityRevision' -e 'editorBufferIdentityOf' src/renderer/src/store src/renderer/src/components/editor || true
printf '%s\n' '--- conflict overview selector/callers ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'createEditorPanelDraftSelector' -e 'conflictOverviewView(' -e 'conflictOverviewViewsKey' src/renderer/src || true
printf '%s\n' '--- candidate changed-file diff ---'
git diff --no-ext-diff --unified=40 885cd6ff44f115dab642839c3b19549ef55335a2 -- src/renderer/src/components/editor/editor-panel-draft-selector.ts src/renderer/src/store/slices/editor/buffers/editor-buffer-identity-cache.ts src/renderer/src/store/slices/editor/buffers/editor-buffer-conflict-overview.ts

Repository: stablyai/orca

Length of output: 41604


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- route state and identity implementation ---'
sed -n '1,240p' src/renderer/src/lib/worktree-operation-route.ts
sed -n '1,240p' src/renderer/src/store/slices/editor/buffers/editor-buffer-identity.ts
printf '%s\n' '--- identity action and lifecycle implementations ---'
sed -n '1,280p' src/renderer/src/store/slices/editor/actions/editor-buffer-identity-actions.ts
sed -n '1,260p' src/renderer/src/store/editor-buffer-record-lifecycle.ts
printf '%s\n' '--- direct route-input writes ---'
rg -n -U --glob '*.ts' --glob '*.tsx' '(set\\(|setState\\(|\\.setState\\().{0,500}(repos|worktreesByRepo|detectedWorktreesByRepo|folderWorkspaces|projectGroups|restoredRuntimeHostIdByWorkspaceSessionKey|runtimeEnvironmentCatalogHydrated|removedRuntimeEnvironmentIds|runtimeEnvironments|settings|editorBufferIdentityRevision)' src/renderer/src/store src/renderer/src/components || true

Repository: stablyai/orca

Length of output: 25281


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- route-input writes by key ---'
for key in repos worktreesByRepo detectedWorktreesByRepo folderWorkspaces projectGroups restoredRuntimeHostIdByWorkspaceSessionKey runtimeEnvironmentCatalogHydrated removedRuntimeEnvironmentIds runtimeEnvironments settings editorBufferIdentityRevision; do
  printf '%s\n' "### $key"
  rg -n -F --glob '*.ts' --glob '*.tsx' -- "$key:" src/renderer/src/store src/renderer/src/components src/renderer/src/hooks || true
done
printf '%s\n' '--- route update APIs and state setters ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'setRuntimeEnvironmentCatalogHydrated' -e 'runtimeEnvironmentCatalogHydrated' -e 'reconcileEditorBufferIdentities' -e 'setRepos' -e 'setWorktrees' src/renderer/src/store src/renderer/src/components src/renderer/src/hooks || true
printf '%s\n' '--- conflict overview tests ---'
sed -n '1,180p' src/renderer/src/store/slices/editor/buffers/editor-buffer-conflict-overview.test.ts
printf '%s\n' '--- draft selector tests ---'
sed -n '1,230p' src/renderer/src/components/editor/editor-panel-draft-selector.test.ts
printf '%s\n' '--- relevant lifecycle/reconcile tests ---'
rg -n -F --glob '*test.ts' --glob '*test.tsx' -e 'route' -e 'identityRevision' -e 'reconcileEditorBufferIdentities' src/renderer/src/store/slices/editor/buffers src/renderer/src/components/editor | head -200 || true

Repository: stablyai/orca

Length of output: 45665


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- production writes: hydration and identity revision ---'
rg -n -F --glob '*.ts' --glob '*.tsx' --glob '!*.test.ts' --glob '!*.test.tsx' --glob '!*.spec.ts' --glob '!*.spec.tsx' \
  -e 'runtimeEnvironmentCatalogHydrated:' -e 'editorBufferIdentityRevision:' -e 'reconcileEditorBufferIdentities(' \
  src/renderer/src || true
printf '%s\n' '--- production writes: route object fields ---'
rg -n -F --glob '*.ts' --glob '*.tsx' --glob '!*.test.ts' --glob '!*.test.tsx' --glob '!*.spec.ts' --glob '!*.spec.tsx' \
  -e 'worktreesByRepo:' -e 'detectedWorktreesByRepo:' -e 'folderWorkspaces:' -e 'projectGroups:' \
  -e 'restoredRuntimeHostIdByWorkspaceSessionKey:' -e 'removedRuntimeEnvironmentIds:' -e 'runtimeEnvironments:' -e 'settings:' \
  src/renderer/src/store src/renderer/src/hooks || true
printf '%s\n' '--- route re-key test block ---'
sed -n '1,245p' src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile-identity.test.ts
printf '%s\n' '--- shared-record route test block ---'
sed -n '280,360p' src/renderer/src/components/editor/editor-save-queue-shared-records.test.ts

Repository: stablyai/orca

Length of output: 44772


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- editor model owner ---'
sed -n '1,260p' src/renderer/src/components/editor/editor-model-owner.ts
printf '%s\n' '--- runtime catalog hydration transition ---'
sed -n '1,190p' src/renderer/src/store/slices/runtime-status.ts
printf '%s\n' '--- view rekey implementation ---'
rg -n -F --glob '*.ts' -e 'function reconcileEditorBufferRecords' -e 'editorBufferViews' -e 'viewMirrors' src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile.ts src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile-write.ts src/renderer/src/store/slices/editor/buffers/editor-buffer-views.ts
sed -n '1,300p' src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile.ts
sed -n '1,260p' src/renderer/src/store/slices/editor/buffers/editor-buffer-reconcile-write.ts

Repository: stablyai/orca

Length of output: 28716


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- numbered selector and owner blocks ---'
nl -ba src/renderer/src/components/editor/editor-panel-draft-selector.ts | sed -n '24,82p'
nl -ba src/renderer/src/components/editor/editor-model-owner.ts | sed -n '8,54p'
printf '%s\n' '--- numbered route resolver entry and route-state types ---'
rg -n -F -- 'export function resolveWorktreeOperationRoute' src/renderer/src/lib/worktree-operation-route.ts
nl -ba src/renderer/src/lib/worktree-operation-route.ts | sed -n '220,390p'
printf '%s\n' '--- numbered lifecycle route guard and state write ---'
nl -ba src/renderer/src/store/editor-buffer-record-lifecycle.ts | sed -n '45,110p'
nl -ba src/renderer/src/store/editor-buffer-record-lifecycle.ts | sed -n '180,214p'
printf '%s\n' '--- numbered reachable route writers ---'
nl -ba src/renderer/src/store/slices/runtime-status.ts | sed -n '104,148p'
nl -ba src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts | sed -n '205,292p'

Repository: stablyai/orca

Length of output: 23647


🏁 Script executed:

set -o pipefail
rg -n -F -- 'function resolveExplicitWorktreeOperationRouteResult' src/renderer/src/lib
rg -n -F -- 'runtimeOwnerEnvironmentId' src/renderer/src/lib src/renderer/src/store/slices/worktrees | head -40

Repository: stablyai/orca

Length of output: 5559


🏁 Script executed:

nl -ba src/renderer/src/lib/worktree-operation-catalog-route.ts | sed -n '1,105p'

Repository: stablyai/orca

Length of output: 4653


🏁 Script executed:

nl -ba src/renderer/src/lib/worktree-owner-route.ts | sed -n '1,180p'

Repository: stablyai/orca

Length of output: 3614


Include the route epoch in the overview draft selector guard.

A worktree owner update can change conflictOverviewView from one explicit-runtime tab to another while editorDrafts, openFiles, and editorBufferViews keep the same references. The selector then returns previousSelection without resolving the new view, so the overview can display the previous tab’s draft.

Suggested fix
 import {
   conflictOverviewView,
   type ConflictOverviewState
 } from '@/store/slices/editor/buffers/editor-buffer-conflict-overview'
+import { editorBufferRouteEpochOf } from '@/store/slices/editor/buffers/editor-buffer-identity-cache'
@@
   let previousDrafts: AppState['editorDrafts'] | null = null
   let previousOpenFiles: EditorDraftState['openFiles'] | null = null
   let previousViews: EditorDraftState['editorBufferViews'] | null = null
+  let previousRouteEpoch: object | null = null
   let previousSelection = EMPTY_EDITOR_PANEL_DRAFTS
 
   return (state) => {
+    const routeEpoch = overviewPaths.length === 0 ? null : editorBufferRouteEpochOf(state)
     // Why: every Zustand write reruns the selector. The slice identity guard
@@
       previousDrafts === state.editorDrafts &&
       (overviewPaths.length === 0 ||
-        (previousOpenFiles === state.openFiles && previousViews === state.editorBufferViews))
+        (previousOpenFiles === state.openFiles &&
+          previousViews === state.editorBufferViews &&
+          previousRouteEpoch === routeEpoch))
@@
     previousDrafts = state.editorDrafts
     previousOpenFiles = state.openFiles
     previousViews = state.editorBufferViews
+    previousRouteEpoch = routeEpoch

@nwparker
nwparker merged commit 8556d11 into main Oct 22, 2026
32 checks passed
jordanyeo pushed a commit to Statvis/orca that referenced this pull request Oct 23, 2026
…orkspace (read-only) (stablyai#31990)"

This reverts commit 8556d11 for the release ad hoc build only. stablyai#31990 builds on stablyai#31974, which is reverted next.
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