Skip to content

skill: agents run gh stack merge without asking the user (--yes, and no prompt when non-interactive) #621

Open

Description

@JacobTRND

Problem

skills/gh-stack/SKILL.md gives agents gh stack merge <target> --yes as the form to "always run", and the Merging section shows gh stack merge 42 --yes and gh stack merge 7 --yes without any step that involves the user. Two facts from the extension itself make that risky for an agent:

  • cmd/merge.go (help text): "In a non-interactive terminal, or with --yes, the whole stack (or everything up to the given PR) is merged without prompting".
  • references/commands.md, merge: "Only basic PR state is checked before merging: open and not a draft."

So an agent that follows the skill merges every unmerged PR below the target in one all-or-nothing step, with no prompt and no check of required checks or reviews beyond what branch protection enforces at merge time. Merging is irreversible, so the skill should have the agent confirm the merge set with the user first.

Suggested fix

Minimal diff against main at bd0a325 (skills/gh-stack/SKILL.md only):

@@ -51,7 +51,7 @@
 |---|---|---|
 | `gh stack view --json` | `gh stack view` | opens a TUI under a PTY |
 | `gh stack submit --auto` | `gh stack submit` | prompts for a title per new PR |
-| `gh stack merge <target> --yes` | `gh pr merge` | `gh pr merge` cannot merge a stack |
+| `gh stack merge <target> --yes` | `gh pr merge` | `gh pr merge` cannot merge a stack; pass `--yes` only after the user confirms (see Merging) |
 | `gh stack init <branch>...` | `gh stack init` | prompts for branch names |
 | `gh stack add <branch>` | `gh stack add` | prompts for a name, and fails even when piped |
 | `gh stack checkout <target>` | `gh stack checkout` | opens a selection menu |
@@ -121,6 +121,12 @@
 Pass a PR number to merge that PR and every unmerged PR below it, or a stack number to merge every
 unmerged PR in that stack. The operation is all-or-nothing: if any PR in that set cannot merge,
 none do.
+
+In a non-interactive terminal, or with `--yes`, `gh stack merge` merges without prompting, and it
+checks only that each PR is open and not a draft. Before merging, list the exact PRs in the set and
+the method, check each PR's required checks and reviews (`gh pr checks <n>`,
+`gh pr view <n> --json reviewDecision`), and get the user's confirmation. Run the merge only after
+that.
 
 Without a method flag the last-used method is reused. If the base branch uses a merge queue, the
 stack is queued instead and the queue picks the method, ignoring any flag you passed with a

I am filing this as an issue because pull requests on this repository are limited to collaborators (see #69). Happy to open it as a PR if that changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions