AgentConnect
Sessions

Arm or disarm auto-merge on the session’s pull request

Arms or disarms merge-when-ready (squash) for this session’s pull request. The watcher runs at the EDGE — in a sandbox pod when the agent’s work runs in pods (an isolated session’s own pod when armed from a session that has one, on a daemon advertising auto-merge-session-v1; otherwise the agent’s), else in the owning daemon’s process — and polls GitHub until the pull request is open, undrafted, conflict-free, with no failing or running check and no requested changes, then squash-merges the head it judged. It is deliberately NOT GitHub’s own auto-merge: enablePullRequestAutoMerge refuses every pull request that is not BLOCKED, so on a repository without required status checks it can never be armed at all. A pull request is watched in one place however many sessions name it: arming one already watched returns that watcher’s state, and disarming finds it wherever it runs. Nothing is persisted: the armed set is in memory at the edge, so a reclaimed sandbox, a retired session’s pod or a restarted daemon forgets it and the box reads back unchecked. Arming needs the owning agent’s clamped grant to carry pull_requests: write, so a read- or comment-tier agent is refused (403); idempotent — asking for the state it is already in returns that state. 404 mirrors the GET. 409 with a code for every refusal the edge names: AUTO_MERGE_SANDBOX_ASLEEP (the pod the watcher belongs in is down — an isolated session’s own, else the agent’s — so start that sandbox first), AUTO_MERGE_ALREADY_MERGEABLE (the pull request can be merged now, and arming would merge it on the first tick with no confirmation — use the Merge route, which the console confirms), AUTO_MERGE_UNSUPPORTED_IMAGE (a sandbox from an image predating the watcher — resume it), DAEMON_FEATURE_MISSING, NO_DAEMON. 503 when the daemon is unreachable.

POST
/v1/orgs/{orgId}/sessions/{id}/pull-request/auto-merge

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

orgId*string
id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/orgs/string/sessions/string/pull-request/auto-merge" \  -H "Content-Type: application/json" \  -d '{    "enabled": true  }'
{  "armed": true,  "placement": "sandbox",  "waitingOn": "string",  "error": "string"}