Skip to content

✨ feat: merge PRs and native stacks via async API - #83

Merged
SigureMo merged 1 commit into
mainfrom
codex/async-pr-merge
Oct 2, 2026
Merged

SigureMo merged 1 commit into
mainfrom
codex/async-pr-merge

Conversation

@SigureMo

@SigureMo SigureMo commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Motivation

Native stack merge hints currently open a browser, while ordinary PRs delegate to gh pr merge, which still uses the synchronous GraphQL mutation. Add gh-llm pr merge backed by GitHub's async merge API, so both workflows stay in the terminal without requiring gh-stack.

The command pins the inspected PR head, shows the selected stack scope, and polls for merged, enqueued, or failed. Pending requests retain a UUID and a pr merge-status resume command; exit code 2 signals that the request is still pending. Existing requests are followed with their original options, merge writes are not automatically retried, and entering a merge queue is reported separately from merging. Direct merge methods, commit messages, queue selection, and explicit rule bypass are supported.

Replace merge hints with head-pinned commands and update the README and conversation skill. Incomplete stack metadata continues to suppress merge suggestions.

Validation

  • uv run pytest -q: 155 passed, including API contract fixtures for duplicate requests, pending timeouts, resume polling, transport failures, stale heads, and stack scope.
  • uv run ty check --error-on-warning src/gh_llm tests, Ruff lint/format, Prettier, and git diff --check passed.
  • Checked both command help screens. Merge behavior was tested with API response fixtures; no live PR was merged.
This PR is co-authored with @codex (gpt-6 astra xhigh)

Co-authored-by: Codex <noreply@openai.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Corrected async merge requests to send GitHub’s expected_head_sha parameter instead of the synchronous merge API’s sha parameter, ensuring merges are pinned to the inspected PR head. src/gh_llm/github_api.pyL1731-L1742
  • Updated the API contract test to verify the correct head-precondition field. tests/test_pr_merge.pyL79-L84
  • Committed the change as c585e29 and created the follow-up PR titled “fix: pin async merge requests to the inspected head.”

Testing

  • ✅ ruff check .
  • ✅ ruff format --check .
  • ✅ prettier --check README.md skills/github-conversation/SKILL.md
  • ✅ git diff --check
  • ✅ PYENV_VERSION=3.14.4 PYTHONPATH=src python -m compileall -q src tests
  • ⚠️ PYENV_VERSION=3.14.4 uv run pytest -q (environment could not download the uncached packaging==24.1 dependency because outbound package access was unavailable)
  • ⚠️ ty check --error-on-warning src/gh_llm tests (ty is not installed globally, and the UV environment could not be provisioned due to the dependency-download limitation)

View task →

@SigureMo
SigureMo merged commit ef99016 into main Oct 2, 2026
4 checks passed
@SigureMo
SigureMo deleted the codex/async-pr-merge branch October 2, 2026 04:48
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