Skip to content

fix(land-and-deploy): correct the --auto failure diagnosis in Step 4 - #2437

Open
Jmeg8r wants to merge 1 commit into
garrytan:mainfrom
Jmeg8r:fix/land-and-deploy-automerge-diagnosis
Open

fix(land-and-deploy): correct the --auto failure diagnosis in Step 4#2437
Jmeg8r wants to merge 1 commit into
garrytan:mainfrom
Jmeg8r:fix/land-and-deploy-automerge-diagnosis

Conversation

@Jmeg8r

@Jmeg8r Jmeg8r commented Aug 2, 2026

Copy link
Copy Markdown

Problem

Step 4 of /land-and-deploy attributes a failed gh pr merge --auto to one cause:

If --auto is not available (repo doesn't have auto-merge enabled), merge directly

That's only one of two causes, and in practice it's the rarer one.

--auto only queues a merge behind pending required checks. When every required check has already settled — or the repo declares no required status checks at all — GitHub considers the PR immediately mergeable and rejects enablePullRequestAutoMerge:

GraphQL: Pull request is in clean status    (everything green)
GraphQL: Pull request is in unstable status (something red, but nothing required)

Whether auto-merge is enabled makes no difference in that case. Two common repos hit this every single time:

  • a repo with zero required status checks — nothing is ever pending, so --auto is always rejected
  • any repo whose CI finishes before Step 4 runs — a fast or cached pipeline beats the skill to the merge

Why it's worth fixing

The flow is fine — the direct-merge fallback already handles both paths. The problem is the recorded reason. An operator who sees MERGE_PATH=direct is told to go check whether auto-merge is enabled, which points them at the wrong setting.

I lost real time to this on a repo where auto-merge had been enabled the whole time and the ruleset simply declared no required checks. The wrong explanation in the docs is what made it take as long as it did.

Changes

  • Replaces the single-cause sentence with both causes and their exact GitHub error strings, and explicitly warns against reporting the second as "auto-merge is disabled".
  • Adds --squash to the --auto invocation. The fallback already squashes, so without it the two paths merge with different strategies depending on which one is taken.

Docs-only — no behavior change to the flow itself.

Verification

Regenerated with bun run gen:skill-docs, and confirmed clean for --host codex and --host factory (both exit 0). Output is idempotent on re-run, so the Skill Docs Freshness gate stays green. The tracked diff is exactly the two expected files:

 land-and-deploy/SKILL.md      | 16 ++++++++++++++--
 land-and-deploy/SKILL.md.tmpl | 16 ++++++++++++++--

🤖 Generated with Claude Code

Step 4 says `--auto` failing means "repo doesn't have auto-merge enabled".
That is only one of two causes, and in practice it is the rarer one.

`--auto` only QUEUES a merge behind pending required checks. When every
required check has already settled -- or the repo declares no required
status checks at all -- GitHub considers the PR immediately mergeable and
rejects enablePullRequestAutoMerge with "Pull request is in clean status"
or "Pull request is in unstable status". Auto-merge being enabled makes no
difference. A repo with zero required status checks takes the direct path
100% of the time, and so does any repo whose CI finishes before Step 4 runs.

The flow itself is fine -- the direct-merge fallback already handles both
cases. The problem is the recorded reason: an operator reading
MERGE_PATH=direct is told to go check whether auto-merge is enabled, which
sends them to the wrong setting. I lost time to exactly that on a repo where
auto-merge was enabled the whole time and the ruleset simply had no required
checks.

Also adds --squash to the --auto invocation. The fallback squashes, so
without it the two paths merge with different strategies depending on which
one happens to be taken.

Docs-only. Regenerated with `bun run gen:skill-docs` (and verified clean for
--host codex and --host factory); output is idempotent on re-run, so the
Skill Docs Freshness gate stays green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Aug 2, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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