Skip to content

feat(pr): generated PR text, merge method + auto-merge, PR watch-and-wake (#1493 D) - #1498

Merged
currentbits merged 8 commits into
mainfrom
coder/1493-d-pr-text-merge-options-watch-and-w-eb1c50
Oct 6, 2026
Merged

currentbits merged 8 commits into
mainfrom
coder/1493-d-pr-text-merge-options-watch-and-w-eb1c50

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Item D of #1493.

What changed

  1. Generate PR title and body (Create PR dialog). Reuses commitmsg.js's provider print-mode with the commit list, the diffstat against base, and the PR template. The output passes the outbound secret scan on generate and again on submit.

  2. Merge method and auto-merge. Squash, merge or rebase, taken from gh repo view --json and cached for 10 min. The picker is in the thread header and the PR list view, and hidden when the repo allows only one method. Auto-merge (gh pr merge --auto) is offered while checks run, and is covered by the CI-workflow sign-off.

  3. Watch-and-wake (electron/prWatch.js). Rides the existing 5-min PR refresher; no new poller. One follow-up turn is sent on:

    • a failing required check (any failing check if none are required), with the log tail;
    • a new changes-requested review from a collaborator;
    • the PR starting to conflict.

    Limits:

    • 10-min gap between wakes, at most 3 per PR, never while the thread is working.
    • Shown in the inspector with Stop / Watch / Re-arm.
    • On by default. Threads made by checking out someone else's PR start with it off.
    • Wakes go through the notice queue, so they count as machine turns and can't satisfy thread_merge's user-approval gate (tested with a real runner).

Security, found in review and fixed

  • Anyone can review a public PR, so only reviews whose authorAssociation is OWNER, MEMBER or COLLABORATOR wake the thread. I confirmed gh returns that field in latestReviews.
  • Review bodies and CI log tails are forwarded inside an <untrusted> block (reusing bannerUntrustedBody from issues.js, with closing tags defanged) plus a note that the block isn't an instruction.

Verified independently, on main merged with this branch, #1495, #1496 and #1497:

  • typecheck exits 0 and vite build passes.
  • test:renderer passes 2791 of 2791.
  • test:electron: 4182 passed and 1 failed. The failure was memory-sup.test.js, a known load flake, which passes alone (41 of 41) on this tree and on main.

Known limits:

  • A wake can take up to 5 min after a failure, because it rides the refresher.
  • A PR first discovered by the refresher (for example, the agent ran gh pr create in a shell) gets a silent baseline, so a check that's already failing at that point doesn't wake.

🤖 Generated with Claude Code

Willem and others added 7 commits October 6, 2026 15:21
suggestPrText reuses the commit-message print mode with the branch's
commit list, diffstat vs base and the repo PR template, and runs the
result through the outbound secret scan before returning it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- gh pr merge takes squash/merge/rebase and --auto; git.mergeOptions reads
  the repo's allowed methods from gh repo view (cached 10 min).
- electron/prWatch.js rides the existing PR-state refresher: a failing
  check (with a capped log tail), a new changes-requested review or a
  fresh conflict sends the thread one follow-up turn via deliverNotice.
  Debounced, capped at 3 per PR, held while the thread works. Wake-ups
  are machine turns, so they never satisfy the orchestration merge gate.
- threads.setPrWatch toggles it; checked-out PRs default off.
- New IPC: git.suggestPrText, git.mergeOptions, threads.setPrWatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fills title and body from git.suggestPrText; a refusal (secret scan,
missing CLI) shows in the dialog and keeps the draft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The picker lists the methods the repo allows (preselecting the repo
default) beside Merge, and beside the checks badge while checks run,
where Auto-merge arms gh pr merge --auto. CI sign-off covers both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as untrusted

Anyone can leave a changes-requested review on a public PR, and the wake
turn quoted it into an unattended agent. Reviews now wake only when
authorAssociation is OWNER/MEMBER/COLLABORATOR. Review bodies and CI log
tails are forwarded inside an <untrusted> block (guardrail banner on a
pattern hit, closing tag defanged) with a line saying it is data, not
instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
git.mergeOptions also takes { projectPath } (GitHub origin check, then
the same cached gh repo view lookup); the merge confirm bar lists the
allowed methods and passes the choice to prMergeAt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T13:47:52.340003Z 13fb3d9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13fb3d9729

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/worktrees-pr.js
"merge",
String(info.number),
"--squash",
...mergeFlags(opts),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind auto-merge approval to the signed commit

When a workflow-changing PR is approved while checks are pending, gateCiWorkflowMerge validates only the current local diff and this line then enables a persistent server-side auto-merge. The gh pr merge manual describes --auto as “Automatically merge only after necessary requirements are met”; if this app or the new PR watcher subsequently pushes another commit using the repository owner's credentials, GitHub can merge that new head without rerunning the local gate or obtaining sign-off for its workflow changes. Reject auto-merge for workflow PRs or bind the approval/merge to the inspected head SHA, for example with --match-head-commit.

Useful? React with 👍 / 👎.

Comment thread electron/prWatch.js
lastReason: reasons.join(", "),
},
});
deliver({ threadId, line: lines.join("\n") });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck the watch switch before delivering

If the user clicks “Stop watching” after observePr reads the thread but while one of its gh pr checks or log requests is still running, this unconditional delivery uses the stale thread/prev snapshot and starts an automatic follow-up despite the opt-out. It also overwrites the prWatchState: null written by the toggle, so an off/on re-arm during the same polling window can inherit stale wake counts and fingerprints. Re-read the thread and verify that the watch is still enabled and still refers to the same state immediately before updating and delivering.

Useful? React with 👍 / 👎.

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