Skip to content

feat(github): let paired phones turn a pull request back into a draft - #37000

Merged
AmoabaKelvin merged 1 commit into
mainfrom
github-mark-pr-draft
Nov 1, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
github-mark-pr-draft

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​68

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

  • New host RPC github.markPRDraft (gh pr ready --undo). It shares one helper with github.markPRReadyForReview in client/update/pr-ready.ts, so routing, fork and GHES prRepo, SSH/WSL execution, error classification and review-lookup invalidation are identical. The only difference is the --undo flag.
  • Runtime command markRepoPRDraft, the RPC contract MarkPrDraft (regenerated catalog), and the mobile allowlist entry.
  • New capability mobile.github.markPRDraft.v1 in SOURCE_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.
  • No desktop UI change.

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 ready call.

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 --undo on 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 --check and check:code-quality:changed.

  • Not run against a live GitHub PR. gh pr ready --undo has 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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 --undo fails 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-draft

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

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.
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f6ed2662-381a-4968-98b7-fefc3a2428a7
Commits

Reviewing files that changed from the base of the PR and between 90a5374 and 9f37fcd.

Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 10
  • src/main/github/client.ts
  • src/main/github/client/update/pr-ready.ts
  • src/main/github/pr-mutation-review-invalidation.test.ts
  • src/main/ipc/github-ipc-module-mocks.ts
  • src/main/runtime/rpc/methods/github-pull-request-update-methods.ts
  • src/main/runtime/runtime-github-review-mutation-commands.ts
  • src/main/runtime/runtime-review-command-surface.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-method-routing.ts
  • src/shared/rpc-contract/github-pull-request-update-params.ts
  • src/shared/source-control-runtime-capabilities.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

The change adds a client operation to convert a pull request to draft by running gh pr ready --undo. It connects the operation to the runtime RPC method github.markPRDraft, adds its parameter schema and mobile execution-host routing, and registers a mobile runtime capability. Tests cover draft and ready command forms and include draft conversion in lookup-fencing checks.

Merge Risk: Minimal · up to 9f37f

The host adds draft conversion support. No merge-blocking issue was identified; the mobile action is planned separately.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing paired phones to mark a pull request as a draft.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is mostly complete and matches the required structure. It clearly explains the user impact, implementation, rationale, testing, compatibility, visual proof, and checklist status. The L…
Full details: Description check

Explanation

The description is mostly complete and matches the required structure. It clearly explains the user impact, implementation, rationale, testing, compatibility, visual proof, and checklist status. The Linked Issue section does not provide an actual issue link in the required format, and the full lint, typecheck, test, and build checks remain unchecked, but these gaps do not make the description largely incomplete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 10 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@AmoabaKelvin
AmoabaKelvin merged commit 9ecf575 into main Nov 1, 2026
50 checks passed
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