Repository navigation
fix: route hook files through their stored repository owner - #23184
Conversation
|
Warning Review limit reachedNext included review available in 5 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
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.
✅ No new issues found.
Reviewed changes — hook filesystem dispatch now resolves the repository's authoritative execution owner instead of branching on legacy connectionId, fixing #23181.
- Shared stored-owner resolver —
src/main/repo-execution-host.tsaddsgetStoredRepoExecutionHostId/getStoredRepoSshConnectionId. The former is the hosted-review helper moved verbatim out ofhosted-review-execution-host.ts, which now re-exports it under the oldgetRepoHostedReviewExecutionHostIdname, so its existing callers keep identical behavior. - Desktop hook adapters rerouted —
register-worktree-hook-{check,file,inspection}-handler.tsusegetStoredRepoSshConnectionId(repo)in place ofrepo.connectionId, so anssh:-only row no longer reads/writes the remote path locally and a stale legacy target no longer wins. - Runtime commands rerouted —
runtime-repository-hooks-commands.tsandruntime-repository-issue-command.tsadopt the same resolver forruntime:/localown-store rows. - New reliability gate —
workspace-hooks.execution-host-ownership(experimental) records the invariant, its oracle, and known gaps. - Test coverage — new
worktree-hook-execution-host.test.tsdrives real handler registration throughresolveRepoForExecutionHostacross nine operations × seven owner shapes, plus no-local-fallback and folder-skip controls.
I confirmed the test can actually fail: reverting register-worktree-hook-check-handler.ts to repo.connectionId produces the four expected failures (canonical SSH, canonical-over-stale, explicit-local-over-stale, runtime-stamp-with-nested). The related suites (worktree-hook-execution-host, runtime-repository-issue-command, hosted-review-execution-host-routing) pass, and pnpm run check:code-quality:changed is clean.
The runtime:/local → local-I/O collapse is the same contract the hosted-review resolver already carries, and it is grounded in runtime-repository-registration-controller.ts:64: an own-store runtime row is validated and read in-process, and the controller refuses to adopt a runtime: stamp onto a row that already has a connectionId. Missing SSH providers still never gain a local fallback.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…rows (#23300) A repo row stamped `executionHostId: runtime:<env>` is how a paired client addresses a project registered in *this* process, so its files are local (`runtime-repository-registration-controller.ts`, and the helper #23184 added in `repo-execution-host.ts`). #22421 reclassified those rows as peer-owned and dropped them from the identity sweep, so `gitRemoteIdentity` never settled on remote-runtime and paired-web setups: the project stayed pending, fell back to a host-local `repo:<id>` that never grouped across hosts, and a stale automatic avatar never repaired. Reuse `getStoredRepoExecutionHostId` instead of a second host classifier, and keep skipping only a `runtime:` row that also names a nested SSH target — that target lives in the peer's dispatch table and the same path here is a different checkout. The store matches a write against the row's own stamp, so address `updateRepo` by that stamp rather than the probe host, which is `local` for these rows and would match no row at all.

ELI5
Reading or saving repository hooks now uses the computer that owns that repository, even when an older connection field is missing or stale.
What Changed
Hook adapters previously selected local versus SSH files from legacy
connectionId. A repository whose storedexecutionHostIdnamed its SSH owner could therefore reach a local path or a stale SSH target. Desktop and runtime hook reads, checks, script inspection and issue-command writes now reuse the existing hosted-review resolver for rows in this process's own Store. The hosted-review export remains available.This is a correctness fix, not a measured performance improvement. Missing SSH providers never gain a local fallback.
Why
The stored repository's authoritative host already determines hosted-review execution. Generalizing that resolver avoids a second routing policy and supports legacy rows. It is deliberately limited to rows registered in this process; generic routing still rejects runtime hosts this process does not execute.
Linked Issue
Fixes #23181
Visual Proof
N/A — internal filesystem dispatch changes; no rendered layout or control changed. Deterministic tests observe actual hydrated ownership and exact mocked target/path/content. No live SSH or rendered-flow claim.
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/hooks/worktree-hook-execution-host.test.ts: 68 pass, versus original 37 failures / 31 controls. Independently replayed; eleven extra mismatch/ambiguity, missing-provider, encoded-target deletion and folder-skip controls also pass. Author related coverage totals 102 distinct tests across four suites. Node typecheck, scoped lint/format, changed-code quality across 185 files and reliability-manifest validation pass.Actual hydration and desktop owner resolution run with mocked filesystem, Git, provider and inspection boundaries. Tests ran on macOS; no real file write, SSH/WSL provider, native application or mixed-version/mobile deployment ran. Full lint/build and broader platform checks remain to CI.
AI Disclosure
Review
Independent review approved all eight frozen source/test files with no finding. Merge risk: low to moderate — host routing affects writes, so the tests assert exact ownership and no local fallback; payloads and existing errors remain unchanged.
Experimental gate
workspace-hooks.execution-host-ownershiprecords the invariant that hook operations use the authoritative stored repository host. Its oracle covers canonical/legacy identities, unavailable providers and folder skips. CI soak, native Linux/Windows and physical SSH/WSL/runtime evidence remain gaps. Routing assertions identify the wrong provider, path or local boundary on failure.Agent skill upstream boundary
Notes
Negative user-facing trade-offs: none identified. A disconnected canonical SSH write is refused on desktop instead of touching the same path locally. The existing runtime issue-command convention still returns
{ok:true}when its provider is absent without writing; this PR does not claim to fix that preexisting response limitation.Folder skips and legacy connection-only rows are retained. Own-store runtime stamps address files registered here; they do not authorize arbitrary remote rows to run locally. No RPC field, result shape, stream opcode, Git command, path joiner or provider API changed. Local/daemon PTY identity, data and liveness are unaffected. No new cache, poll, broad scan or subprocess fanout.
Checklist