Repository navigation
fix: honor canonical SSH ownership in worktree listings - #23198
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughWorktree-listing handlers now derive SSH routing from repository execution-host identity. Non-local repositories bypass the local scan cache and local root registration. SSH catalog listings record scan-generation and registered-roots revisions in side-effect tokens. New tests cover provider routing, authority changes, stale side effects, and runtime repositories. The reliability-gate configuration records the gate scope, evidence, and remaining coverage gaps. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Canonical SSH repositories can still retain metadata for removed worktrees. This issue predates the change; the PR is otherwise mergeable with owner awareness of that limitation. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Canonical SSH repositories gain working listings, but a catalog listing can still accept a result returned after its SSH provider loses authority and use it to update worktree lineage. A related cleanup operation also continues to reject these repositories, so removed worktrees may remain in fallback listings. No credential exposure or cross-repository access was established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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 9 functions across 7 files. (1 skipped: 1 unsupported.)
✨ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Apply the canonical SSH owner check in… · register-host-catalog-handlers.ts:127
src/main/ipc/worktrees/listing/register-host-catalog-handlers.ts:127
🎯 Functional Correctness | 🟠 Major | ⚡ Quick winApply the canonical SSH owner check in
worktrees:forgetRemovedForExecutionHost.The renderer calls this handler when an authoritative SSH scan proves worktrees removed.
findExactRepoOwneraccepts a repository withexecutionHostId: 'ssh:<target>'and noconnectionId, but the legacy check then returnsnothingForgotten.gcStaleWorktreeMetaskips off-host rows, so the metadata can persist and reappear in fallback listings after reload.Suggested fix
- if (!repo || (parsedHost.kind === 'ssh' && repo.connectionId !== parsedHost.targetId)) { + if ( + !repo || + (parsedHost.kind === 'ssh' && + getSshTargetIdForExecutionHost(getRepoExecutionHostId(repo)) !== parsedHost.targetId) + ) { return nothingForgotten }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cf94d1d5-cfb6-4a6e-8666-9d554e8c6a9a
📒 Files selected for processing (8)
config/reliability-gates.jsoncsrc/main/ipc/worktrees-canonical-ssh-listing.test.tssrc/main/ipc/worktrees/listing/detected-provider-listing.tssrc/main/ipc/worktrees/listing/detected-worktree-scan-cache.tssrc/main/ipc/worktrees/listing/host-qualified-worktree-listing.tssrc/main/ipc/worktrees/listing/register-detected-worktree-handlers.tssrc/main/ipc/worktrees/listing/register-host-catalog-handlers.tssrc/main/ipc/worktrees/listing/register-worktree-catalog-handlers.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.
There was a problem hiding this comment.
Important
The changed-code quality gate fails on this PR — two duplicate execution-host imports. The routing and side-effect-fence changes themselves check out; details inline.
Reviewed changes
- Canonical SSH routing — the six listing adapters now resolve the host (
getSshTargetIdForExecutionHost(getRepoExecutionHostId(repo))) instead of reading rawrepo.connectionId, soexecutionHostId: 'ssh:<target>'rows reach their SSH provider rather than the local scan path. - Local root/cache admission —
listDetectedGitWorktreesandrememberLocalWorktreeRootsgate on the resolved host, so a remote path is no longer registered as a local root or served from the 5s local cache. - Catalog side-effect fence —
worktrees:list/listAllcapture a generation + roots-revision token before the SSH provider listing, so a mutation that overtakes a listing can no longer prune newer lineage. - Tests and gate manifest — new 26-case suite plus the
worktree-listing.execution-host-ownershipreliability gate.
I verified the new suite passes (26/26), the 12 related suites pass (111 tests), the neighboring execution-host suites pass (55 tests), and typecheck:node passes. I also mutation-checked the new suite: reverting the host guard and one token capture makes 10 of the 26 cases fail, so the coverage is real. The resolver choice is correct for every reachable row shape (canonical, legacy, runtime:<env> with a nested connectionId, WSL, contradictory); runtime rows terminate in WorktreeCatalogUnavailableError and never hit a local git scan.
The only blocker is the import duplication below: pnpm run check:code-quality:changed reports Changed-code quality gate failed with 2 finding(s), so the PR's claim that the changed-code gate passed does not reproduce on this head.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the commits since the prior pullfrog review (93f50c8): the import-consolidation fix, a cosmetic test rename, and merges with main.
- Single
execution-hostimport per adapter —host-qualified-worktree-listing.ts,register-host-catalog-handlers.ts,register-detected-worktree-handlers.ts, andregister-worktree-catalog-handlers.tsnow import eachshared/execution-hostsymbol once, resolving theimport/no-duplicatesgate failure from the prior review. - Test parameter rename —
describe.eachinworktrees-canonical-ssh-listing.test.tsrenamedshape→hostEncoding; no behavioral change. - Merge with main — the
worktree-listing.execution-host-ownershipreliability gate is preserved, and unrelated i18n diff-note catalog entries are restored (all locales consistent).
Verification on this head: pnpm run check:code-quality:changed reports 0 findings across 7 changed files (was 2), the new suite passes 26/26, pnpm run check:reliability-gates validates 129 gates, and oxlint on the changed listing/test files is clean. Both prior review threads are addressed and resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the commits since the prior pullfrog review (1ddf36e): the hourly build-version injection seam and its test conversion. The SSH listing files were untouched by the new commits.
- Hourly build-version injection seam —
getHourlyBuildIdentitynow takes an optionalpackageVersionand falls back to readingpackage.json, so the identity can be exercised without module mocking. The CLI caller passes nopackageVersion, so production behavior is unchanged. - Module-mocking removal —
hourly-build-version.test.mjsdroppedvi.mock('node:fs');anti-slop/no-module-mockingis anerrorfor.mjstests because its override only matches**/*.test.{ts,tsx}, so this was required, not optional. Both identity cases now pass explicitpackageVersionvalues. - Newer-package floor control — added a case asserting a package version above the published floor still wins.
Verification on this head: the suite passes 17/17; removing the injection privilege (packageVersion ??) fails the unpublished-release case, so the seam is genuinely covered; pnpm run check:code-quality:changed reports 0 findings across 9 changed files. Both prior review threads remain resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
Repositories stored with the newer SSH host field now use the same remote listing rules as older SSH repositories. Losing contact no longer makes a cached local-path answer look authoritative, and a listing that finishes after a mutation cannot remove newer worktree lineage.
What Changed
Listing adapters resolve the repository's execution host before selecting SSH providers, capturing provider authority, or admitting local scan-cache/root-registration work. Both catalog listing methods capture the existing mutation/root-revision token before awaiting SSH, so cleanup rejects an overtaken answer. Generic runtime-host refusal remains.
This is a correctness fix found during the performance audit. The counts describe routing and request work, not a CPU, latency or heap improvement.
Why
Reuse the existing host resolver and side-effect guard. Adding another SSH cache would require provider-scoped invalidation and separate proof. This is a separate trade-off PR because fresh provider reads cost more than the improper local cache.
Linked Issue
N/A — PR only, as requested by the maintainer.
Visual Proof
N/A — provider routing and cleanup authority; deterministic handler/lineage assertions, no UI markup or app launch.
Shared hourly CI prerequisite
The branch also carries the shared hourly-build fixture correction from #23274. Historical package-version inputs are explicit, with exact version/build-number assertions retained and a newer-package control. Default build commands still read package.json; the dedicated no-module-mocking lint rule stays enabled.
Testing
All tests use
ORCA_BACKGROUND_LAUNCH=1. The permanent suite has 26 cases; original source fails 13 and passes 13 controls. Independent review adds 14 cases, including actual in-memory lineage pruning, for 40 passing cases on isolated current main. The initial candidate failed the lineage race; it was repaired and re-reviewed before publication.The eight related suites pass all 61 cases on current main. Node typecheck, scoped lint/format and the isolated 127-entry reliability manifest pass. The shared changed-code quality gate passed across 198 files. Linux/Windows, live SSH/WSL, actual Git processes and deployed mixed-version integration remain untested. Fixtures mock provider/Git/store/IPC boundaries and perform no user-path writes.
AI Disclosure
Review
Independent review approved after repair. Merge risk: moderate, because six listing adapters change routing and cleanup authority. The changed files are unchanged upstream from the audit baseline; this PR is isolated on freshly fetched main.
Reliability class/gate:
worktree-listing.execution-host-ownership(experimental). Invariant: SSH-owned reads stay on their provider, avoid local-root/cache admission, and cannot prune newer lineage after a mutation. The motivating path is a canonical SSH repo without legacyconnectionId. Read, provider-call, cache-size, root-registration and lineage assertions are the diagnostics/oracles. No new polling; list-all concurrency remains eight.Agent skill upstream boundary
Notes
Negative user-facing trade-off: repeated canonical SSH listings now reach the provider rather than reusing the improper five-second local cache. Two direct connected scans change from one provider read to two, matching existing legacy SSH behavior.
Local/daemon PTYs, terminal output and mobile wire are unaffected. WSL command construction, Git options and folder-workspace paths are unchanged; generic remote-runtime rows retain refusal. Native macOS unit execution is covered; native Linux/Windows and live remote integrations remain gaps.
Catalog
list/listAllcan still return an older plain-array snapshot; this change fences its cleanup, not every stale response. CanonicalforgetRemovedForExecutionHostremains outside scope. The separate filesystem classifier and root-registry repairs are not claimed fixed by this listing change. No physical cancellation claim.Checklist