Repository navigation
Description
Repo: stablyai/orca
Version: 1.4.183 (installed 2026-08-15). Latest at time of writing: 1.4.217.
OS: Windows 11 Pro 26200
State file: %APPDATA%\orca\profiles\local-default\orca-data.json
Summary
workspaceSession.openFilesByWorktree and workspaceSession.unifiedTabs are appended to
rather than replaced/deduplicated when the session is persisted. Every launch re-adds the same
files, so the editor fills with duplicate tabs of a handful of documents.
Closing a tab does not help: the user is closing one of ~17 identical copies, so the same
document reappears immediately. Editing the JSON while Orca runs does not help either — the
in-memory session is authoritative and is written back on exit.
Measured state (2026-09-30)
Two workspaces, 5 real files total:
| workspace | openFiles entries |
unique files | editor tabs | unique tab ids |
|---|---|---|---|---|
| A | 71 | 4 | 24 | 16 |
| B | 8 | 1 | 8 | 6 |
| total | 79 | 5 | 32 | 22 |
Per-file counts in workspace A:
20 PM-DECISIONS-20260923.html
17 20260805-gcp-deploy-topology.md
17 20260818-tra-front-noti-group-mapping.txt
17 WISH_CHAR_SEED_SAMPLE_MARIADB.sql
Growth observed over four days (same 4–5 files throughout):
09-27 18 entries
09-28 37 entries
09-28 94 entries
09-30 79 entries (after a manual cleanup on 09-28)
Three distinct defects
1. runtimeEnvironmentId is part of the tab identity
Editor tab ids are built as:
editor:<worktreeId>:<runtimeEnvironmentId>:<urlencoded filePath>
Two distinct runtimeEnvironmentId values were present for the same files in one workspace —
842ee5ff-… (22 entries) and 1456a0bf-… (49 entries). Because the id differs, dedup does not
match and the whole file set is duplicated per environment.
This is expected to worsen with remote/paired runtimes: connecting from another machine
introduces another environment id and therefore another full copy of every open file.
2. Path separators are inconsistent within the same id scheme
For the same file, some ids encode the path with forward slashes and some with backslashes:
…%3A%3AD%3A%5Cworkspace_idle%5Cclaude-task:…:D%3A%5Cworkspace_idle%5Cclaude-task%5Chandoffs%5C20260805-gcp-deploy-topology.md
… :…:…%2Fhandoffs%2F20260818-tra-front-noti-group-mapping.txt
%5C = \, %2F = /. String comparison therefore treats one file as two.
3. Exactly-identical ids appear more than once in unifiedTabs
Independent of (1) and (2), the same tab id occurs twice in the array (observed id ×2 for three
different files). This is a plain missing-dedup on append, not an identity problem.
tabGroups[worktreeKey].tabOrder mirrors the duplication (length 18 for 4 real files).
Expected behaviour
On persist, openFilesByWorktree and unifiedTabs should be replaced by the current set, and
identity for an open file should be a normalized file path (case- and separator-normalized),
independent of runtimeEnvironmentId. tabOrder should not contain repeated ids.
Reproduction
- Open a workspace and open 3–4 files in the editor.
- Quit and relaunch Orca several times (ideally with more than one runtime environment,
e.g. local plus a paired remote). - Inspect
workspaceSession.openFilesByWorktree[<worktreeKey>]— the array grows each launch
while the set of distinctfilePathvalues stays constant.
Workaround in use
A script run while Orca is closed that, per workspace:
- dedups
openFilesByWorktreeby normalizedfilePath, - keeps the first editor tab per normalized
entityIdinunifiedTabs, - removes dropped ids from
tabGroups[].tabOrderand repointsactiveTabId/
activeTabIdByWorktree/activeFileIdByWorktree, - leaves terminal and browser tabs untouched.
Result: openFiles 79 → 5, editor tabs 32 → 5, with every actually-open document preserved.
It has to run before launch, because a running Orca overwrites the file from memory on exit.
Note
Release notes for 1.4.215–1.4.217 do not mention editor tabs, open files or session restore, so
this may still be present on latest. Happy to re-measure on 1.4.217 if useful.
Activity
ggbdpq commentedon Sep 30, 2026
Taking this one. I traced the write path with a probe driving the real store (
hydrateTabsSession→hydrateEditorSession→ mirror apply /openFile→buildWorkspaceSessionPayload), and the growth loop is:Root cause in one sentence: an open file's identity is the raw path string ×
runtimeEnvironmentId, and hydration recasts every persisted row to an owned id (editor:<wt>:<env>:<encoded path>), so the session mirror's lookup by raw path always misses and re-appends a(raw path, current env)row each launch — while rows from older environments are never re-keyed or culled, so they only accumulate. Probe evidence: with the env id changing between launches, row count grew 2→3→4→5→6 (+1 per launch, zero user interaction); with a stable env, the mirror settles into two byte-identical persisted rows per file — matching defect 3's "exactly identical ids ×2".I'm splitting this into two PRs, because the full fix needs a semantic decision:
Stop-the-bleeding (PR incoming shortly): fold exact duplicate
(filePath, worktreeId, runtimeEnvironmentId)tuples on the persist side (buildEditorSessionData), aligned with what hydration already does —hydrate-editor-session.tstreats repeated records for the same owner as corruption and keeps one row (fix(session): deduplicate editor records during restore #17370), so folding them at persist is lossless for restore. This stops new identical-tuple rows and cleans existing ones on the next save. Your shutdown dedup script (79 → 5 with every document preserved) is empirical evidence this fold is safe. Split-tab sharing is unaffected — it lives inunifiedTabs(multiple tabs sharing one OpenFile's entityId), not in repeated open-file rows.Real fix (follow-up, needs a maintainer decision): converge identity across environment changes — re-key old-owner rows to the current owner at env transitions or mirror apply, plus normalize path separators (defect 2,
%5Cvs%2F). One caution on the "normalized path independent of runtimeEnvironmentId" proposal in the issue: the same absolute path on a different machine's runtime is a genuinely different file, so cross-environment folding must be limited to a same-worktree ownership migration, not applied globally by path. I'll open a separate issue with the data and two candidate approaches for that decision.Defect 3's
tabOrderduplicates mirror the open-file row duplication (the unified-tab layer already dedupes on hydrate), so PR 1 shrinks it as a side effect; the tab layer itself needs no change.AmethystLiang commentedon Sep 30, 2026
We're improving how the environment is wired in. This will be fixed later this week
kyeolee89 commentedon Oct 3, 2026
Same on macOS with 1.4.219, and I think I found what drives the growth: connected peers re-inject each other's
openFilesByWorktreeon every connect. Clearing one machine never sticks, because the copies live on the other machines.Setup
A laptop (client) paired with two remote Orca servers over a private VPN — call them peer A (a workstation) and peer B (a desktop). All three run the desktop app.
Measurements
I ran a read-only watcher polling
profile-state.dbevery 20s, logging per-file entry counts for bothworkspaceSession.openFilesByWorktreeandworkspaceSessionsByHostId[*].openFilesByWorktree, together with the state of the 6768 sockets at each change.1. Closed tabs come back the moment a peer connects
One minute after being closed, the same files were back at
x3.2. Direction does not matter
I first assumed only inbound connections (a peer dialing me) did this. It isn't so — after emptying both domains to 0 with the app stopped:
Peer A was powered down at this point. Peer B alone restored 32 entries, including peer A's host session (
hostA/projC|script1.shand friends) — so a peer also propagates third-party host sessions it is holding.3. The copies are sitting on the peers
I opened a terminal on peer A (
orca terminal create --environment …) and read its ownprofile-state.db:Peer A was holding 37 entries of my laptop's session — the exact files I had been deleting locally all evening. Peer B held an equivalent snapshot.
So the per-file count is not a local accumulator. Each peer keeps its own stale copy and merges it in additively on connect, which is why counts climb by +2/+3/+5 in one step rather than +1, and why clearing a single machine is always undone by whichever peer connects next. Emptying them one at a time cannot converge; every peer has to be emptied in the same window.
This looks like the additive-union hydration described in #21341, but applied to
openFilesByWorktreerather thantabsByWorktree.Also worth noting for anyone scripting around this
38 -> 12, every file collapsing tox1), so a restart is not what drives the growth.pgrep -f /Applications/Orca.app/Contents/MacOS/Orcadoes not match the main process on macOS (only the Helpers), presumably because the hardened bundle's argv isn't readable.ps -A -o pid=,comm=does. A liveness check built onpgrepsilently reports the app as stopped while it is still running.Version
Reproduced on 1.4.219 / macOS. The 1.4.217–219 release notes contain no fix for this.
BearMett commentedon Oct 6, 2026
@kyeolee89 thanks for the measurements. They match what I found: a paired desktop republished the tabs it was only mirroring from a peer, so each peer kept handing your laptop's session back. #25877 stops that, and the mirror marker now survives restart.
Two caveats from your setup: every paired machine needs the fix before the loop fully stops, and rows already saved before the fix are not cleaned by it (#21125 / #24191 cover those).
4riel commentedon Oct 8, 2026
Still present on 1.4.216 (Windows 11 desktop) with a paired macOS remote — reproduced today, 2026-10-08.
Measured from the live store (
profile-state.db,workspaceSessiondomain, rev 36589):…::C:/Users/ariel/Code/Tradifypoc-multilogin-seed.sql×2,report.md×2,2026-09-17-…-poc.md×2…::C:/Users/ariel/Code/Tradify/workdeck…::…/orca/worktreeREADME.md×4So the unbounded growth isn't limited to editor tabs — automation-run terminal tabs accumulate identically and nothing prunes them.
Live repro: clicking the X on an editor tab (
report.md) returns success but the tab stays — an identical stored copy takes its place instantly. Middle-click is also a no-op.Adjacent symptom (happy to split into its own issue): after
orca project setup-delete+project setup-existing-folderre-add — which created a new repoId1fa2faec…—workspaceSession.activeRepoId/activeWorktreeId/activeTabIdstill point at the deleted repoId71d7fff8…, and the sidebar option is still keyed to it (worktree-list-option-repo%3A71d7fff8…); clicking it doesn't navigate. The orphaned editor tabs now render "Unable to load file — The host couldn't find this file's workspace" and still can't be closed from the tab strip. Deleting/re-adding a workspace therefore never resets its session state — the ghost keeps the stale tabs alive.Local workaround I used: while Orca is fully closed, dedupe
unifiedTabs/openFilesByWorktreeby normalized path inprofile_state_documents, remap the session keys from the deleted repoId onto the re-added one, and scrub dropped tab ids fromtabGroups[].tabOrder+ theactive*pointers. Verified: 7 → 5 tabs with the duplicates gone and the workspace rebound to the live repoId.fix(editor): fold duplicate open-file owner tuples on session persist
fix(editor): remap active file pointers onto the retained tuple row
fix(editor): fold duplicate open-file owner tuples on session persist
fix(editor): remap active file pointers onto the retained tuple row
nwparker commentedon Dec 1, 2026
Fixed by PR #19444 (
253fa43256a0), PR #31925 (ea60ec5d7cb9), and PR #33259 (917899bf8df8):buildHydratedEditorSessionState(src/renderer/src/store/slices/editor/hydration/hydrated-editor-session-state.ts) anddedupeEditorTabsWithinGroups(src/renderer/src/store/slices/tabs/tab-hydration-records.ts) deduplicate persistedopenFilesByWorktreeand editor tabs on hydration, andisMobilePublishableOpenFileskips mirrored tabs so paired desktops no longer republish each other's editor tabs across restarts.