Skip to content

merge-ready.sh: hardcoded --merge silently dead-locks consumer repos with merge-method rulesets; gh errors are swallowed #201

Description

@robercano-ghbot

Summary

merge-ready.sh hardcodes gh pr merge --merge and discards gh's stderr. In any consumer repo whose branch ruleset restricts allowed merge methods, every bot merge is rejected by GitHub and the script logs only a bare {"action":"merge-failed"} — indistinguishable from a transient failure, forever, on every tick.

Incident (reDeploy, 2026-07-24 → 2026-07-30)

Proposed fixes

  1. Don't hardcode the merge method. Read it from the adapter (gates.json → e.g. merge.method) and/or fall back to what the repo actually permits (gh api repos/{repo}/rulesetspull_request.parameters.allowed_merge_methods, and the repo's allow_*_merge flags). A squash-only repo should get --squash automatically.
  2. Surface the error. Capture gh pr merge stderr and include it in the merge-failed JSON line ("error": "..."), so one journal read identifies the cause instead of requiring an out-of-band repro.
  3. Distinguish remote-merge failure from local cleanup failure. With --delete-branch, gh exits non-zero if the head branch is checked out in a .claude/worktrees/ worktree even though the remote merge succeeded. The script then reports merge-failed on a merged PR and skips clean_worktree, leaving exactly the debris that census can mistake for in-flight work. Check the PR's merged state (or split the merge and the branch deletion) before deciding what to report.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrom:redeployOrigin: reDeploy rolloutmodule:harnessOrchestrator machinery under .claude

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions