Repository navigation
fix(github): send a confirmed admin bypass when a repo has no local git options - #67
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
getGitHubLocalGitOptionArgsreturns[]when a repo has no local git options. Two host entry points spread that array immediately before a trailing options object: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.bypassBranchProtectionwas therefore always falsy, sogetPRMergePreflightcorrectly 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
[] | [LocalProjectGhExecOptions]— at most one element — so[0] ?? {}cannot drop anything, and{}reproduces the callee's own default exactly, because a default parameter only applies toundefined.undefinedexplicitly at the spread site still leaves a positional shift waiting to happen and does not read as a fix; wideningmergePRto accept a varargs array would change a widely-used signature to work around one caller's bug.--adminis still added only when the caller's flag is true and the sharedisGitHubPRAdminBypassAvailablerule 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 reportsadminBypass: false.mergeRepoPRwith the flag and previously hit the identical drop.Linked Issue
N/A — fork PR against
nplez1/main. This is not proposed tostablyai/orcaand 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 withgit 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):agent-session-*,agent-launch-*,structured-agent-session-*. Recorded inLOCAL-PATCHES.mdas proved not ours.bunproject only:daemon/repro-13767-shell-ready-marker-lost-to-exec,daemon/shell-ready,shell-startup-feature-channel. No child output at all under thebunruntime; a test-project assignment gap, not a repo defect.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 toorigin/nplez1/main(emptygit diff origin/nplez1/main) still fails all three withCannot find module …/.cross-version-checkouts/v1.4.218/…— the missing cross-version-checkout cache thatLOCAL-PATCHES.mdrecords as environmental.tests/e2e/relay-region-correction.unit.test.ts: thecloud/workspace is not installed, sopgis 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.github-ssh-connection-routing.test.tshad been encoding the buggy six-argument call — it passed because the bug existed.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.
(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 ingithub-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
docs/reference/agent-skill-sharing-upstream-boundary.mdand 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,
mergePRreturns early throughmergeGitHubPRStackwithout ever consultingbypassBranchProtection, 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.
mergeRepoPRis the paired-host path and is fixed here; the SSH routing suite covers it.bypassBranchProtectionis an existing optional field.Checklist
N/Awith reasonpnpm lint,pnpm tc, andpnpm testpass (or CI will cover; local preferred)