Repository navigation
PR conflict previews fetch the base branch through the shared fetch controller - #30654
Conversation
…etch controller The conflict summary on a PR card spawned its own `git fetch origin <base>`, outside RuntimeRemoteFetchController: it refetched a base a worktree create had just refreshed (and vice versa), ran git's auto-maintenance in the background, and never armed the idle loose-ref sweep. It now asks the runtime's controller for the exact-base refresh creates already use (same argv, per-remote queue, dedupe and freshness), waiting at most the old 10 s before falling back to the local ref. The runtime registers its controller at construction, since the IPC and poller paths have no runtime handle. Also corrects the controller comment that claimed every fetch skips auto-maintenance: full fetches keep it on purpose (#8039).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 33 seconds. View limit details
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 |
…r its conflict summary
|
Conflict previews downloaded their base branch through a separate path from worktree creation. That duplicated downloads; sharing the long-running attempt directly also let a stuck preview keep Create waiting after the card stopped waiting. The PR now uses the repository fetch controller while keeping the preview's ten-second budget. Create can reuse a successful download and keeps its normal refresh and timeout. Ordinary full-fetch maintenance remains enabled under #8039. The full review fixed two proven P2 problems: Create inheriting a stuck preview attempt, and a canceled repository lookup saving an incorrect identity that prevented linked worktrees from sharing later downloads. Implementation-only assertions were pruned. A possible future embedding with multiple controller owners is deferred: current construction paths register their owner before use, and no shipping failure was reproduced. Existing Verification: two review rounds, independent architecture and readiness/performance review, bounded design adjudication, 116 targeted tests on the merged head, and the full PR workflow including its aggregate passed on Real hidden-renderer Electron QA ran through qa-gate ticket 575 on Windows high spec, with a real Codex driver, comparing the exact head with its merged-main parent Companion integration through the real store → IPC → controller → Git path exercised recovery around eleven seconds and overlapping normal fetches. The head rendered a preview fallback while a fifteen-second normal fetch continued, and healthy overlap used one fetch versus main's three. These are integration timings, not precise UI-click/deadline proof; actual UI creation verified startup separately. The head's B2 download occurred on automatic refresh; a later manual Refresh displayed that result. Coverage limits: no SSH execution target was configured. Supplemental WSL cancellation evidence is unverified because the guest HOME was not isolated; no guest app or agent ran, and real config hashes remained unchanged. The real lower-admission/operation-lock expiry scenario was not exercised in Electron; targeted tests cover no late spawn. Windows named tests had 61 passes and six existing missing- For Brennan's review Whole-window comparisons below use the same fixture inputs. The conflict list still appears and updates; setup, tab order, selected workspace and folder behavior remain intact. The unchanged PowerShell warnings are visible rather than hidden.
Additional branch capture: preview fallback while a normal fetch continues (timing established by trace, not the still image). Three judgment points:
The original |











ELI5
When a pull request has conflicts, Orca downloads its base branch to list the conflicting files. That preview used a separate fetch path, so creating a worktree could download the same branch again. Simply sharing the worktree-creation fetch also let a stuck preview delay Create long after the preview stopped waiting.
This change gives both paths one download owner while keeping the preview's ten-second budget. A successful preview can save Create a second download. A failed or expired preview leaves Create free to make its normal attempt once the Git runner settles.
What Changed
The conflict list, controls, and notices are unchanged. No saved-data or remote-protocol change is required.
Why
The common pattern is a repository owner that shares work already in progress and bounds background work. Here, sharing successful downloads removes duplicate work without tying a user action to a preview's lifetime. Copying fetch flags into the old preview path would retain two policy owners; letting Create join a preview attempt would share its failure and short deadline.
Ordinary full-fetch maintenance remains enabled under #8039. Only exact-base refreshes suppress automatic maintenance and arm Orca's existing idle sweep. This PR corrects the controller's old comment; it does not change ordinary full-fetch arguments.
Intended differences: previews share successful freshness with Create, while their attempts remain private; the preview deadline now includes queue time, so expired work cannot start after the card stops waiting. Required refresh-before-Create behavior remains. The existing forced tracking-ref update and no-tags command are reused. Hard-coded
originselection and the conflict summary's existing caching remain outside this change.Merge maintenance
The final merge of current main includes formatter-only merge-hook churn in six unrelated incoming-main files: src/main/agent-hooks/server/server-status-application.ts, src/main/agent-hooks/server/server-status-update.ts, src/main/daemon/pty-subprocess-spawn-file-foreground.test.ts, src/main/daemon/terminal-host-process-inspection.test.ts, src/main/providers/local-pty-child-process-verdict.test.ts, src/main/providers/local-pty-provider-foreground-process.test.ts. Five are whitespace-only;
local-pty-child-process-verdict.test.tsalso removes two semicolons. Direct diff review found the changes behavior-equivalent. These add 32 production lines and 71 test lines to the physical diff and are excluded from the repair line count. Normal hooks ran; no hook bypass or commit amendment was used.Linked Issue
N/A: maintainer cleanup of background Git work.
Visual Proof
Real hidden-renderer Electron QA ran through qa-gate ticket 575 on Windows high spec, with a real Codex driver, comparing the exact head with its merged-main parent
9f37fcdf706fed694ecb4ef9e374818c1b7ea75c. Real Git used a disposable bare remote; provider metadata was a read-only fixture, while the store, IPC, controller and summary were unchanged. Both versions displayed one conflicting file at B1, then two at B2; normal Create used B2, release Create used its selected base, and offline Create retained its local fallback. Actual UI creation verified setup output, Shell A → Shell B → Setup, initial Shell A selection and subsequent Setup DOM focus. Plain folders still opened without a Git conflict surface.Companion integration through the real store → IPC → controller → Git path exercised recovery around eleven seconds and overlapping normal fetches. The head rendered a preview fallback while a fifteen-second normal fetch continued, and healthy overlap used one fetch versus main's three. These are integration timings, not precise UI-click/deadline proof; actual UI creation verified startup separately. The head's B2 download occurred on automatic refresh; a later manual Refresh displayed that result.
Coverage limits: no SSH execution target was configured. Supplemental WSL cancellation evidence is unverified because the guest HOME was not isolated; no guest app or agent ran, and real config hashes remained unchanged. The real lower-admission/operation-lock expiry scenario was not exercised in Electron; targeted tests cover no late spawn. Windows named tests had 61 passes and six existing missing-
/repoharness failures; matched main reproduced the same six. PowerShell profile/PSReadLine warnings occurred on both versions; no machine policy was changed. No live provider, Git 2.25 binary or mixed-peer QA is claimed. Original normal-Create screenshots differ in theme; offline screenshots used the same light input. The folder-main toast reflects preceding Git context. The initial default-agent attempt was aborted and is not successful signed-in-agent or cancellation coverage. All 336 recorded process identities were audited with none remaining, reserved ports were released, copied QA auth was removed and real configuration hashes were unchanged.The original
gh imageattachments returned 404. These replacement attachments were fetched back as PNGs and matched the original hashes; they are stored outside the PR branch.Testing
The full PR workflow, including its final aggregate, passed on head
23743a13edd5bf9b206c22de245c0bd9028efc70. The single CI watch also completed successfully for every registered platform check.116 tests passed in seven named files through the machine's test queue on macOS:
client-pr-conflict-summary.test.ts,conflict-summary.test.ts,fetch-remote-cache.test.ts,client-merge-queue-auto-merge.test.ts,client-pr-linked-lookup.test.ts,git-exec-admission-lifetime.test.ts, andcanonical-repo-key.test.ts, using Node andconfig/vitest.config.ts.The flow cases cover healthy sharing, Create after network recovery for the same and a different base, overlapping Create callers, and a preview that stops waiting while a Create-owned fetch succeeds after fifteen seconds.
A real resolver/controller regression cancels a cold linked-worktree lookup, then verifies root and linked paths share one successful download after recovery. It covers both an aborted signal with a custom error and a deadline rejection while the signal remains live.
The real Git runner test holds admission beyond preview expiry, then releases it and verifies no child starts. It also covers delayed timer delivery, where the absolute-deadline eligibility check must reject a late start.
Existing tests retain the ten-second local-ref fallback, WSL routing and admission priority, Git compatibility fallback, and ordinary full-fetch maintenance. Duplicate argument and absolute subprocess-count assertions were pruned; the sharing cases reuse the controller directly and share a base fixture; unchanged previews must still start zero new subprocesses.
Repair scope: 140 added production lines and 139 added test lines. The physical diff after merging main is 172 added production lines and 210 added test lines; the difference is unrelated incoming-main formatting produced by the required merge hooks. No local typecheck or full lint run; CI is the static-analysis gate. Precommit hooks passed.
Git 2.25 compatibility is unchanged: no new Git option or refspec. WSL identity and caller options remain host-specific; SSH-backed summary callers still skip local derivation. No new Git requirement is imposed on folder workspaces, and mixed client/server response shapes are unchanged.
Automated tests added/updated
Main/branch Electron QA and screenshots complete (coverage limits above)
Full PR workflow green on head
23743a13edd5bf9b206c22de245c0bd9028efc70Review
Full review path: the change touches concurrency, cancellation, and process lifetime, so it does not qualify for the light path. Two adversarial review rounds, independent architecture review, bounded design adjudication, readiness/performance review, narrow final-main-merge inspection and gated Electron QA are complete. Both proven P2 findings were fixed and independently checked; only an unproven future multiple-owner embedding concern remains deferred. The final status comment records completion on the exact head.
Agent skill upstream boundary
Notes
Cancellation uses the Git runner's existing behavior. The queue follows operation settlement, not the card's return; this does not claim verified death of every descendant at exactly ten seconds. No new termination mode or unbounded cleanup wait is introduced.
Checklist