Repository navigation
feat(github): let paired phones turn a pull request back into a draft - #37000
Conversation
Adds github.markPRDraft (gh pr ready --undo) on the host, allowlisted for paired phones and advertised with mobile.github.markPRDraft.v1 so older hosts simply hide the action.
|
No actionable comments were generated in the recent review.
|
ELI5
Paired phones can't turn a pull request back into a draft, because the host has no way to do it. This adds that to the host, so the phone's PR menu can offer "Mark as draft" in a follow-up.
What Changed
github.markPRDraft(gh pr ready --undo). It shares one helper withgithub.markPRReadyForReviewinclient/update/pr-ready.ts, so routing, fork and GHESprRepo, SSH/WSL execution, error classification and review-lookup invalidation are identical. The only difference is the--undoflag.markRepoPRDraft, the RPC contractMarkPrDraft(regenerated catalog), and the mobile allowlist entry.mobile.github.markPRDraft.v1inSOURCE_CONTROL_RUNTIME_CAPABILITIES. A phone shows Mark as draft only when the host (and a relaying desktop) advertises it, so older hosts simply hide it.Why
The approved mobile Source Control redesign puts "Mark as draft" in the PR tab's ⋯ menu, and nothing in the repo could do it. The coordinator asked for this as its own small host PR, so a host-side review doesn't hold up the UI (#36999). Reusing the ready-for-review path keeps a single implementation of the
gh pr readycall.Linked Issue
No issue. Part of the mobile Source Control redesign (#36999); the menu item ships in its follow-up.
Visual Proof
N/A. This is host-only and nothing visible changes until the mobile menu item lands.
Testing
pr-mutation-review-invalidation.test.ts: the draft mutation joins the fencing grid, and a new case pins--undoon draft and its absence on ready.Focused:
src/main/runtime/rpc/methods/github.test.ts,src/main/runtime/runtime-rpc,src/main/ipc, capability tests (556 files).generate-rpc-params-catalog --checkandcheck:code-quality:changed.Not run against a live GitHub PR.
gh pr ready --undohas been in gh since 2.x.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
One round with Codex and Claude came back clean: routing parity with ready-for-review, fork and GHES forwarding, mixed-version capability gating, and the catalog check.
Agent skill upstream boundary
Notes
Mixed versions: old phones never call the method. New phones check the capability, and an old host or an old relaying desktop hides the action.
Old gh: a gh without
--undofails with gh's own message through the existing PR-update error copy.Cross-platform and SSH/WSL use the same exec path as ready-for-review.
What to try: nothing visible yet. Once the mobile menu item lands, on a phone paired with this build: ⋯ → Mark as draft on an open PR turns it into a draft on GitHub. Against an older host, the item is hidden.
Worktree:
/Users/kelvinamoaba/orca/workspaces/orca/sc-pr-draftChecklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)