orca/tools
Crosery 90255ab112
[Bug]: Defer full worktree scan until after session restore (#9446)
* perf(startup): defer full worktree scan until after session restore

* fix(startup): normalize worktree recovery session keys

* fix(startup): preserve persisted workspace hydration

* fix(startup): keep SSH repos in pre-hydration worktree fetch

Round 1 review fixes for the selective pre-hydration fetch:

- The prefetch filter gated on LOCAL_EXECUTION_HOST_ID, which excluded
  SSH repos. Old full-scan code populated worktreesByRepo for disconnected
  SSH repos via the local metadata fallback (no network), so hydrateTabsSession
  / editor / browser preserved their chrome. Excluding SSH dropped that chrome
  at hydration and setHydrationSucceeded made the loss durable. Include SSH by
  excluding only runtime-owned repos (which hydrate via placeholders instead).
- collectWorktreeHydrationRepoIdsFromSession never collected activeRepoId, so a
  repo referenced only by active-repo state (no active worktree, no tabs) was
  not prefetched, breaking hydrateWorkspaceSession's main-worktree fallback.

* fix(startup): re-prune visit timestamps after deferred full worktree scan

Round 2 review fix. The selective pre-hydration fetch only populates
session-referenced repos, so the one-shot pruneLastVisitedTimestamps at
startup no longer sees non-session repos and keeps their deleted-worktree
entries (the prune defers unloaded repos to preserve SSH focus recency).
The old full pre-hydration scan had populated all local repos before the
prune. Re-run the prune after the deferred fetchAllWorktrees so stale
lastVisitedAtByWorktreeId entries are dropped once every repo is
authoritative; disconnected SSH stays non-authoritative and is kept.

* fix(startup): exclude unbounded history maps from hydration repo enumeration

Round 3 review fix. collectWorktreeHydrationRepoIdsFromSession collected
repo ids from lastVisitedAtByWorktreeId and defaultTerminalTabsAppliedByWorktreeId,
which accumulate one entry per worktree ever focused / given default tabs.
On the long-lived large profile this fix targets (#9441), those maps
reference nearly every repo, so the 'selective' pre-hydration fetch
degenerated back toward the full all-repos scan the fix removed.

Split the keyed-field list: repo enumeration now scans only chrome-bearing
fields (open tabs/editors/browser), while folder-key detection keeps
scanning all fields. The history maps hydrate unfiltered regardless, and
the deferred re-prune reaps their stale entries, so no data or recency is
lost. Also pin the round-2 re-prune ordering in the routing test.

* fix(startup): prevent competing full worktree scans

* fix(startup): keep selective hydration scans bounded

* fix(startup): ignore stale tab selection markers

* fix(startup): keep deferred worktree recovery selective

* test(windows): dismiss startup overlays before terminal setup

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-07-23 16:29:59 -07:00
..
benchmarks feat(codex): real-home routing + self-contained multi-account homes (#9501) 2026-07-20 14:34:53 -07:00
daemon-relocation-spike Windows terminal update-survival (single consolidated PR) (#7538) 2026-07-07 19:21:07 -04:00
repro-watcher-crash-7547 fix(watcher): isolate @parcel/watcher in a forked process so native crashes can't kill the app (#7547) (#7757) 2026-07-07 22:10:22 -04:00
spikes
win-crash-survival-e2e test(e2e): prove the terminal daemon survives a main-process crash on Windows (#7742) (#9311) 2026-07-19 11:27:29 -07:00
win-update-e2e [Bug]: Defer full worktree scan until after session restore (#9446) 2026-07-23 16:29:59 -07:00
repro-macos-renderer-close-teardown.cjs Suppress macOS renderer teardown crash reports (#4655) 2026-06-04 13:02:51 -07:00
repro-orchestration-long-prompt.mjs Fix orchestration agent prompt injection (#7758) 2026-07-07 19:50:57 -07:00
terminal-garble-frame-analysis.mjs fix(terminal): invalidate cached glyphs when WebGL atlas changes (#8899) 2026-07-17 16:16:17 -07:00
terminal-garble-production-repro.mjs fix(terminal): invalidate cached glyphs when WebGL atlas changes (#8899) 2026-07-17 16:16:17 -07:00
terminal-garble-react-terminal-recovery.mjs fix(terminal): invalidate cached glyphs when WebGL atlas changes (#8899) 2026-07-17 16:16:17 -07:00
terminal-garble-session-replay.mjs fix(terminal): invalidate cached glyphs when WebGL atlas changes (#8899) 2026-07-17 16:16:17 -07:00