Skip to content

fix(repos): every repo catalog uses the host-catalog fence - #27116

Merged
OrcaWin merged 2 commits into
mainfrom
np/p395-hbi-d1-repo-fence
Oct 10, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
np/p395-hbi-d1-repo-fence

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​131 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​122
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39 $\color{#cf222e}{\Huge{\mathbf{−}}}$​100 $\color{#cf222e}{\Huge{\mathbf{−}}}$​61

ELI5

Orca asks each paired server for its list of projects. If the connection to a server dropped and came back while a request was still out, the answer from the old connection could arrive late and overwrite the fresh list, bringing back stale or moved projects.

What Changed

  • Before: only the "Connect" flow checked whether the server connection had been replaced while waiting. The startup/all-hosts load and the active-server refresh only checked "is this the newest request", so a late answer from a replaced connection still landed (two existing tests even pinned that behaviour as the "current contract").
  • After: all three project-list loaders use the same per-host fence the project-group and folder loaders already use (claimHostCatalogFence in src/renderer/src/store/host-catalog-fencing.ts, now with a 'repos' kind). It checks the request generation, the server's SSH-state generation and its connection generation, plus the removed-server tombstone. A dropped answer counts as "no answer", so the all-hosts load does not use it to clean up saved project filters.
  • Deleted: the repo-only per-host generation map in repo-catalog-fencing.ts (the local-startup settlement and the all-hosts batch generation stay there) and the Connect flow's module-global generation map and inline connection checks. Net about -65 lines.

Why

The root cause was a parallel, weaker fence: the repo loaders had their own generation-only check next to a shared fence that already handled replaced connections. Reusing the shared fence fixes every repo loader in one place and removes the duplicate. Loss of contact still preserves rows: a dropped catalog changes nothing, it never removes a host's projects.

Linked Issue

Fixes #20811

Visual Proof

N/A: background catalog fencing; no UI change.

Testing

  • repos-catalog-connection-fence.test.ts: for the all-hosts, Connect and active-server loaders, a catalog whose server connection was replaced mid-fetch is not applied, and the all-hosts load keeps saved repo filters. The all-hosts and active-server cases fail on origin/main.

  • repos-all-hosts-generation.test.ts: the two "started before a reconnect" characterization tests that pinned the bug now assert the fresh catalog survives.

  • repos-module-lifetime-coordinators.test.ts: the cross-store case became a same-store case, because fences are per store (the old module-global map was an artifact of the slice split).

  • 96 store/app-shell/ipc-event test files green; pnpm tc:web, oxlint, pnpm run check:code-quality:changed.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

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

SSH/paired servers: loss of contact is not treated as absence; nothing is removed when a catalog is dropped. No wire change.

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)

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 83f0a05a-1f01-4ffc-bc2a-2892f9fb9935

📥 Commits

Reviewing files that changed from the base of the PR and between 0e59e8838a7d9c1f445ece2f555a5a4b2aeb1097 and 5b3cb84.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e8aaec16-b116-44f7-9876-6e1697967451


📥 Commits

Reviewing files that changed from the base of the PR and between ae610005f7c0be23d7c9bea2e085ffffaf297ab4 and 0e59e8838a7d9c1f445ece2f555a5a4b2aeb1097.



📒 Files selected for processing (2)
  • src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
  • src/renderer/src/store/slices/repos-catalog-connection-fence.test.ts


🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
  • src/renderer/src/store/slices/repos-catalog-connection-fence.test.ts


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




📝 Walkthrough
📝 Walkthrough

Walkthrough

Repository catalog loaders now use host catalog fences to reject results from connections that are no longer current. All-host loading checks the fence before applying runtime worktree visibility defaults and treats rejected catalogs as failed fetches. The change removes older per-host and per-environment generation fencing. Tests cover stale results after reconnects and fetch supersession within one store.



Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 0e59e

The previously reported catalog-loading race is addressed. No actionable merge-blocking issue remains from the reviewed evidence.

Pre-merge checks | Passed 4 | Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: repository catalogs now use the shared host-catalog fence.
Description check Passed The description is complete and focused. It explains the problem, the before-and-after behavior, the implementation, linked issue, lack of UI changes, testing, and compatibility considerations. Manual…
Linked Issues check Passed Issue #20811 requires the all-hosts repo catalog loader to discard results from a replaced SSH state or runtime connection. The PR applies claimHostCatalogFence to the loader and checks request, SSH…
Out of Scope Changes check Passed The changes stay within the catalog-fencing objective. The Connect and active-server loaders use the same shared fence for the same stale-connection failure mode. The removed generation maps eliminate…



✨ 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
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af4f86ae-b513-4e16-851c-2efc79d64486
📥 Commits

Reviewing files that changed from the base of the PR and between 440cde0 and a689667ecb182bb37e302a3fcdbd524c1d832ed8.

📒 Files selected for processing (8)
  • src/renderer/src/store/host-catalog-fencing.ts
  • src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
  • src/renderer/src/store/repos/repo-catalog-actions.ts
  • src/renderer/src/store/repos/repo-catalog-fencing.ts
  • src/renderer/src/store/repos/runtime-repo-catalog-actions.ts
  • src/renderer/src/store/slices/repos-all-hosts-generation.test.ts
  • src/renderer/src/store/slices/repos-catalog-connection-fence.test.ts
  • src/renderer/src/store/slices/repos-module-lifetime-coordinators.test.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/store/repos/repo-catalog-fencing.ts

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

@OrcaWin
OrcaWin force-pushed the np/p395-hbi-d1-repo-fence branch from a689667 to ae61000 Compare October 10, 2026 03:37
m4air added 2 commits October 9, 2026 21:00
The all-host and active-target repo loaders fenced only by fetch
generation, so a catalog fetched over a runtime connection that was
replaced mid-fetch still overwrote the current one. All three repo
loaders now claim the shared host-catalog fence (generation, SSH-state
and runtime-connection generations), which replaces the repo-only
per-host generation map and the Connect flow's inline checks. A dropped
catalog is not an answer, so the all-host load skips repo-scoped UI
validation.
Its late claim would void the newer load's in-flight catalog, so neither
would apply.
@OrcaWin
OrcaWin force-pushed the np/p395-hbi-d1-repo-fence branch from 0e59e88 to 5b3cb84 Compare October 10, 2026 04:00
@OrcaWin
OrcaWin merged commit 63b3f15 into main Oct 10, 2026
30 checks passed
nplez1 added a commit to nplez1/orca that referenced this pull request Oct 11, 2026
Upstream @ cc5c85f (386 commits) onto the release line from cce8024
(merge base 1cda323). 102 conflicted paths: both-rewrote 49, modify/delete
20, union 17, duplicate-tail 6, add/add 6, rename-replay 4.

The decisions this sync settled are recorded in LOCAL-PATCHES.md § Sync log and
local/sync/convergence-ledger.md.

Conflict resolutions

- The SSH relay removal stands. Upstream deleted src/relay/** and serves SSH
  hosts from orcad, and the fork's three relay commits did not justify becoming
  sole maintainer of 467 abandoned files: 36 relay paths resolved to deletion,
  plus src/shared/ssh-ai-vault-relay.ts and the fork's six src/wsl-guest/
  additions (ledger: "SSH relay removal").
- Repo detection takes upstream's generator shape (probeGitRepo and the
  *Commands helpers), retiring the fork's parallel async copy of
  repo-detection.ts and repo-git-marker-scan.ts. The four filesystem steps
  upstream still runs synchronously are recorded as an Open item.
- Owner routing moved to runtimeTargetForOwnerEnvironment. Upstream deleted
  getActiveRuntimeTarget and settingsForRuntimeOwner and added a lint ratchet;
  RuntimeFileOperationArgs now carries a `target` and RowLessSource no longer
  admits GlobalSettings, so the fork's remaining callers were migrated. The
  fork's Jira/Linear files that still read the Active Server setting are
  registered in config/focus-setting-read-baseline.txt with an Open item.
- The fork's repo-catalog connection fence converged onto upstream's
  host-catalog fence: upstream 63b3f15 (stablyai#27116) is upstream's own fix for
  the fork's stablyai#20811, replacing claimRepoCatalogGeneration and
  captureRuntimeRepoCatalogConnectionFence. repo-catalog-fencing.ts,
  repo-catalog-actions.ts and all-host-repo-catalog-actions.ts are now
  byte-identical to upstream. The upstream-bound branch
  fix/repo-catalog-connection-fence is superseded.
- The fork's hidden-SSH-host UI (PR #9) is re-homed, not dropped. SshPane.tsx
  and SshTargetCard.tsx take upstream's post-relay inline shape, with onSetHidden,
  the hidden badge and SshTargetVisibilityToggle on top, and the "Hidden (N)"
  section in the fork-only SshTargetList.tsx. SshTargetCardActions.tsx and the
  duplicate SshTargetServerList.tsx are gone (ledger: "SSH settings pane").

Verification

- pnpm tc:node / tc:cli / tc:web exit 0.
- pnpm lint: every check passes except audit:code-quality:native, whose five
  mobile import(no-cycle) warnings reproduce identically at cce8024 and are
  carried as documented debt in LOCAL-PATCHES.md.
- pnpm test --project node-runtime: 11 failed files / 35 failed tests, all in
  the documented upstream-red agent-session / agent-launch /
  structured-agent-session class. Ten of them reproduce identically at
  cce8024 (34 tests). The eleventh,
  tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts,
  loads its "release-shaped checkout" from git ref HEAD and so compares HEAD
  against the uncommitted worktree; it is expected to pass once this commit
  moves HEAD.
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.

[Bug]: A remote repo catalog fetched on a replaced connection can overwrite the current one

1 participant