Skip to content

fix(github): send a confirmed admin bypass when a repo has no local git options - #67

Merged
nplez1 merged 1 commit into
nplez1/mainfrom
nplez1/admin-merge-bypass
Oct 9, 2026
Merged

nplez1 merged 1 commit into
nplez1/mainfrom
nplez1/admin-merge-bypass

Conversation

@nplez1

@nplez1 nplez1 commented Oct 9, 2026

Copy link
Copy Markdown
Owner

ELI5

Merging a review-gated pull request with the admin bypass did nothing. You were shown the confirmation, you accepted it, and the merge was still refused with "This pull request requires review approval before it can be merged." The bypass was a real permission you had — Orca just dropped the flag before acting on it. This fixes the wiring.

What Changed

Before: on a repository with no local git options — the ordinary case, no WSL routing and no gh account bound to the repo — confirming the admin bypass on a review-gated PR always failed with the review-approval error. The same merge succeeded on github.com. Reproduced on #63 and #64, both of which had to be merged by hand.

After: the merge goes through, and Orca sends gh pr merge --admin.

Mechanism. getGitHubLocalGitOptionArgs returns [] when a repo has no local git options. Two host entry points spread that array immediately before a trailing options object:

...getGitHubLocalGitOptionArgs(store, repo),
{ bypassBranchProtection: args.bypassBranchProtection === true }

An empty array spreads to nothing, so the options object became mergePR's sixth argument (localGitOptions) and the seventh (options) silently took its default {}. options.bypassBranchProtection was therefore always falsy, so getPRMergePreflight correctly refused to authorise a bypass it was never asked for. A repo with WSL routing or a bound gh account produced a one-element array and was unaffected — which is why the WSL suite passed while the SSH/local suite asserted the shifted call as though it were the contract.

Both sites now materialise the argument, using the [0] ?? {} idiom the neighbouring runtime commands already use:

  • src/main/ipc/github-pr-mutation-handlers.ts (gh:mergePR)
  • src/main/runtime/runtime-github-review-mutation-commands.ts (mergeRepoPR, the paired-host twin)

Why

  • The helper's declared type is [] | [LocalProjectGhExecOptions] — at most one element — so [0] ?? {} cannot drop anything, and {} reproduces the callee's own default exactly, because a default parameter only applies to undefined.
  • This is the idiom the adjacent runtime commands already use, so the shape is consistent rather than novel.
  • Alternatives rejected: passing undefined explicitly at the spread site still leaves a positional shift waiting to happen and does not read as a fix; widening mergePR to accept a varargs array would change a widely-used signature to work around one caller's bug.
  • No widening of privilege. --admin is still added only when the caller's flag is true and the shared isGitHubPRAdminBypassAvailable rule passes (viewerCanMergeAsAdmin, merge box open, mergeQueueRequired === false). The queue-required refusal still runs after the bypass check, so it still fails closed, and a failed or empty lookup still reports adminBypass: false.
  • Mobile is fixed by the same change. It reaches mergeRepoPR with the flag and previously hit the identical drop.

Linked Issue

N/A — fork PR against nplez1/main. This is not proposed to stablyai/orca and no upstream issue applies.

Visual Proof

N/A — no rendering change. The user-visible difference is a merge succeeding instead of an error message, on a host-side argument-plumbing path that no before/after screenshot distinguishes. No recording was captured.

Testing

Full gate run from this worktree, on the rebased commit being shipped. (The branch is rebased onto the current origin/nplez1/main, cf50a86612; the fix's own patch is byte-identical before and after that rebase, verified with git show.)

  • pnpm tc (typecheck) — clean, exit 0.
  • pnpm lint (full chain, including repo-wide oxlint and the max-lines ratchet) — clean, exit 0.
  • pnpm test (full unit suite) — 117,570 passed / 57 failed across 17 files. Every failing file falls into a class already recorded as red on this machine, and none imports a module this change touches (checked file by file):
    • 10 files — upstream-red logic: agent-session-*, agent-launch-*, structured-agent-session-*. Recorded in LOCAL-PATCHES.md as proved not ours.
    • 3 files — PTY/subprocess integration under the bun project only: daemon/repro-13767-shell-ready-marker-lost-to-exec, daemon/shell-ready, shell-startup-feature-channel. No child output at all under the bun runtime; a test-project assignment gap, not a repo defect.
    • 3 files — tests/e2e/cross-version-wire/previous-relay-{terminal-close,terminal-bridge,live-terminal-probe}.unit.test.ts. Proved red at the base rather than by this change: reverting this change so the working tree is byte-identical to origin/nplez1/main (empty git diff origin/nplez1/main) still fails all three with Cannot find module …/.cross-version-checkouts/v1.4.218/… — the missing cross-version-checkout cache that LOCAL-PATCHES.md records as environmental.
    • 1 file — tests/e2e/relay-region-correction.unit.test.ts: the cloud/ workspace is not installed, so pg is missing.

Focused evidence for this change:

  • pnpm test src/main/runtime/runtime-github-review-mutation-commands.test.ts src/main/ipc/github-ssh-connection-routing.test.ts — 7/7 pass.
  • Negative control: restoring only the two pre-fix production files makes 4 of those 7 fail (both bypass tests in the new file, plus the two merge tests in the SSH routing suite). The "keeps local git options" case passes either way, as it should. So the tests genuinely discriminate and are not a rubber stamp.
  • The corrected assertion in github-ssh-connection-routing.test.ts had been encoding the buggy six-argument call — it passed because the bug existed.
  • Broader net (client-pr-admin-merge-bypass, pr-mutation-review-invalidation, github-wsl-runtime-routing, rpc/methods/github) — green.

Not verified: the stack-merge path was reasoned about but not exercised against a live stack; no rendered UI check was run. The commit also records that a direct call to the real preflight against #63 while it was open returned {"error":null,"adminBypass":true}, i.e. the permission was never the problem — that evidence comes from the authoring session and was not independently reproduced here.

Platforms: macOS only. Host-side argument plumbing; no platform-specific code touched.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

(The manual-testing box is deliberately left unchecked: this change was verified by the test suite and by the negative control above, not by driving the app.)

AI Disclosure

Implemented with an AI coding agent, and independently reviewed adversarially by Claude Opus 5.5, including the negative-control run described above.

Review

Worth a human read: the two [0] ?? {} sites, and the corrected assertion in github-ssh-connection-routing.test.ts — it previously asserted the buggy argument shape, so its change is a correction rather than a convenience.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Known residual gap, not caused or worsened by this change. When GitHub reports a pull request as part of a stack, mergePR returns early through mergeGitHubPRStack without ever consulting bypassBranchProtection, so a stacked review-gated PR ignores the bypass and GitHub alone decides. The right sidebar already suppresses the bypass for stacks; the PR page, the task-page merge cell and the land-PR dialog do not. Worth a follow-up.

Also noted: when the lookup is rate-limited or fails, the bypass is correctly refused but reported with the same "requires review approval" message, so in the UI a verification failure is indistinguishable from this bug.

  • Security: does not widen privilege — see Why.
  • Cross-platform: no platform-specific code; paths and shortcuts untouched.
  • Remote SSH: mergeRepoPR is the paired-host path and is fixed here; the SSH routing suite covers it.
  • Mobile: same fix applies.
  • Backwards compatibility: no wire change; bypassBranchProtection is an existing optional field.
  • Performance: none.

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 tc, and pnpm test pass (or CI will cover; local preferred)

…it options

Merging a review-gated pull request with the admin bypass failed on every attempt
from the right sidebar, and from every other surface that offers it: the
confirmation appeared, the user accepted it, and the merge was refused with "This
pull request requires review approval before it can be merged." The same merge
succeeded on github.com. Confirmed on #63 and #64, both merged by hand in the end.

`getGitHubLocalGitOptionArgs` returns `[]` when a repo has no local git options —
the ordinary case for a local checkout with no WSL routing and no gh account bound
to the repo. Both host entry points spread that array immediately before a
trailing options object:

    ...getGitHubLocalGitOptionArgs(store, repo),
    { bypassBranchProtection: args.bypassBranchProtection === true }

An empty array spreads to nothing, so the options object became the sixth argument
(`localGitOptions`) and `mergePR`'s seventh parameter (`options`) took its default
`{}`. `options.bypassBranchProtection === true` was therefore false, so the
preflight refused to authorise the bypass it had just been asked for and returned
the review-approval error. A WSL repo, whose options array is non-empty, was
unaffected — which is why that suite passed while the SSH/local one asserted the
shifted call as if it were the contract.

Both call sites now materialise the argument with the `[0] ?? {}` idiom the
neighbouring runtime commands already use (`runtime-github-repository-query-commands`,
`runtime-github-review-query-commands`), so the trailing options object cannot be
displaced. Nothing else moves.

The running build carries the same shape (`out/main/index.js` in Orca NP
1.4.214-np.22), and the real preflight called against #63 while it was still open
returned `{"error":null,"adminBypass":true}` — the permission was never the
problem, only the lost flag.

Verified: the new and corrected suites fail 4 of 7 with the production change
stashed and pass with it; `github-wsl-runtime-routing`, `rpc/methods/github`,
`client-pr-admin-merge-bypass` and `pr-mutation-review-invalidation` pass (68
tests); `pnpm tc` and `pnpm lint` clean; full `pnpm test` 112,892 passed / 56
failed, every failure in a class already recorded as red on this machine's base
and none of them importing the changed modules.
@nplez1
nplez1 merged commit 6ce2a07 into nplez1/main Oct 9, 2026
@nplez1
nplez1 deleted the nplez1/admin-merge-bypass branch October 24, 2026 03:23
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.

1 participant