Files
orca/src/renderer
OrcaWinandBrennan Benson 37039cd095 fix(source-control): bound Create PR eligibility probe so it can't hang (#9292)
* fix(source-control): bound Create PR eligibility probe so it can't hang

The local Electron eligibility path had no renderer-side timeout, so a hung
main-process git/gh subprocess (plausible on Windows) left the Create PR header
stuck in its "Checking whether this branch can create a pull request..." loading
state with the button permanently disabled. The runtime-hosted path was already
bounded by callRuntimeRpc's 30s timeout; the local path was not.

- Wrap the local window.api.hostedReview.getCreationEligibility call in a 30s
  timeout so a never-settling probe rejects instead of hanging.
- On probe failure/timeout, synthesize a local-status blocker snapshot
  (dirty -> no_upstream -> needs_sync -> needs_push, mirroring the main-process
  ordering) so a dirty branch still offers the commit/preparation intent and a
  clean unpublished branch the publish intent, instead of an inert disabled
  button. Fall back to the retryable failed state only when local status can't
  determine a blocker.

Extracts the eligibility snapshot builders into their own module to stay under
the max-lines cap. Provider-aware copy and host-scoped (local/SSH/runtime)
behavior preserved; no git commands changed.

* fix(source-control): guard synthesized eligibility fallback (default branch, provider parity)

Mirror the main-process canReturnLocalBlocker guard in the renderer's
probe-failure fallback so a timed-out/failed probe can't synthesize a
'dirty'/commit blocker on the default branch or a detached HEAD — which
would have surfaced an enabled Create PR that commits onto the base
branch. The ahead-only needs_push case is likewise dropped to match main
(it won't offer a push it can't auth-check first).

Infer the provider from the repo remote host so a GitLab (etc.) repo with
no linked review shows its own review copy during loading and after a
failure instead of the GitHub default.

Also: assert the timeout error by type, and rename the snapshot test to
match its module.

* fix(source-control): keep eligibility timeout stable

* fix(source-control): keep eligibility timeout bounded

* test(source-control): assert eligibility effect dependencies

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-07-19 13:18:34 -07:00
..
2026-03-17 01:40:24 -07:00
2026-05-30 13:09:17 -07:00