Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Users can mark a draft PR as ready for review but cannot revert it back to draft. This adds symmetry to the workflow.

Changes

GraphQL layer

  • Added ConvertToDraft mutation in queriesShared.gql
  • Added ConvertPullRequestToDraftResponse interface

Model

  • Implemented convertToDraft() method in PullRequestModel with telemetry

UI

  • Added "Convert to draft" button in reviewers section (sidebar)
  • Button shown when PR is not draft AND (user is author OR has write permission)
  • State management handles busy/disabled states during conversion

Message routing

  • Added pr.convertToDraft command handler in pullRequestOverview.ts
  • Added convertToDraft() context method in webview layer

Implementation

Mirrors the existing "Ready for review" pattern:

// Backend
async convertToDraft(): Promise<ConvertToDraft> {
  const { data } = await mutate<ConvertPullRequestToDraftResponse>({
    mutation: schema.ConvertToDraft,
    variables: { input: { pullRequestId: this.graphNodeId } }
  });
  this.item.isDraft = data.convertPullRequestToDraft.pullRequest.isDraft;
  return result;
}

// Frontend component
{!pr.isDraft && (hasWritePermission || pr.isAuthor) && (
  <ConvertToDraft />
)}
Original prompt

This section details on the original issue you should resolve

<issue_title>Support "Convert to draft" in PR view</issue_title>
<issue_description>I created a PR and then realized it wasn't ready. It would be great if I could convert the PR to draft from vscode.

Especially since we can mark a PR ready for review:

Image

(not a very important FR, of course)</issue_description>

<agent_instructions>Add a "convert to draft" in the "reviewers" section of the PR webview.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 10, 2025 11:12
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Add convert to draft option in PR view Add "Convert to draft" action in PR reviewers section Dec 10, 2025
Copilot AI requested a review from alexr00 December 10, 2025 11:31
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.

Support "Convert to draft" in PR view

2 participants