Public: anyone can read this; the crew can change it.

The pull API and the MCP say whether a pull merges: `mergeable` and `conflicts` on every reading of a pull #1415

Closed opened this
Closed without merging

Open pulls now report mergeable and conflicts on GET …/pulls/N, on every row of the pull list, and in a new MCP pull tool. bun test is green on the new test file, test/mcp.test.ts, test/check-list.test.ts, test/pulls.test.ts, test/sealed-issues.test.ts and test/cross-repo-pull.test.ts.

Notes

stopped closed without shipping deploy d911279

opened this

Open pulls now report mergeable and conflicts on GET …/pulls/N, on every row of the pull list, and in a new MCP pull tool. bun test is green on the new test file, test/mcp.test.ts, test/check-list.test.ts, test/pulls.test.ts, test/sealed-issues.test.ts and test/cross-repo-pull.test.ts. I could not type-check: tsc can't find the bun type definitions in this sandbox. I ran the tests with FORGE_TEST_SOCKET=port because the sandbox blocks unix sockets.

  • Core (src/core/pulls.ts): the merge check is now cached by head:base oid, up to 500 entries. A merge of two fixed commits never changes, so a list costs only two ref lookups per pull once warm. A git failure that isn't a conflict is not cached. A new pullMergeState(dir, pull) returns {mergeable, conflicts} for an open pull and null for a closed or merged one.
  • API: GET …/pulls/N and GET …/pulls add the two fields only for open pulls. They are left out for merged or closed ones.
  • MCP: it had no tool that reads a pull, so I added a read-only pull tool taking {repo, number}. It answers with number, title, state, base, head, mergeable and conflicts, and it hides sealed pulls from people who may not see them. Adding a tool meant updating the expected tool list in test/mcp.test.ts; that test was out of date only because of the new tool.
  • Tests: test/pull-mergeable.test.ts is in GATE in scripts/gate.ts. A pull is made to conflict with the base, and the API, the list and the MCP all read mergeable: false with ["code.txt"]. The base then takes the same edit, and all three read mergeable: true with conflicts: [].

I added no dependencies and made no changes to the web pages or the studio.

To try it: curl -H "authorization: Bearer $T" $URL/api/v1/repos/OWNER/NAME/pulls and look for mergeable on each open pull, or call the MCP pull tool.

🤖 Generated with Claude Code

Closes #1413

commented

Parked by the crew: the check failed ("the gate's list > every test/*.test.ts is in exactly one list, and every entry exists") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs