Skip to content

Decide whether a pull request may merge (viewer or above, or an integration token with checks:read)

POST
/v1/projects/{project_id}/merge-check
curl --request POST \
--url http://127.0.0.1:8080/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/merge-check \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "head_ref": "example", "head_sha": "example", "base_ref": "example", "pull_request": 1, "files": [ "example" ] }'

The caller sends the branch and the changed files. Everything else comes from the coordinator’s own state, read in one snapshot. The call writes nothing. Session tokens are refused, so an agent cannot probe its own gate.

A head_ref of zentri/<slug>-<id8> names the project session whose ID ends in <id8>, ended sessions included. A leading refs/heads/ is dropped. The check fails when any rule holds:

  • session: a ref under zentri/ names no session, more than one, or does not have that shape.
  • unclaimed: a changed file has no claim row of the branch’s session. Released and expired claims count.
  • held: another session holds a live claim on a changed file.
  • duplicate: the session’s intent was registered as active_duplicate with run_anyway, and the intent it matched is still active.
  • decision: the session has a high-risk decision that is proposed, or rejected and not superseded by an accepted decision of the same session (ADR-0009).

Any other branch is checked for held only, and the summary says so. A path that cannot be normalized for claims, such as one over 1024 bytes, can never be claimed, so it is unclaimed on a session branch.

project_id
required
string format: uuid
Media typeapplication/json
object
head_ref
required

The pull request’s branch. Untrusted. It must be a valid git branch name.

string
>= 1 characters <= 255 characters
head_sha
required

The commit checked. Only echoed by callers; the verdict does not read it.

string
/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/
base_ref
required

The branch the pull request merges into. It must be a valid git branch name.

string
>= 1 characters <= 255 characters
pull_request
required
integer
>= 1
files
required

Changed paths, relative to the repository root. A rename lists its old and its new path. Each is valid UTF-8 without control characters, with no empty, ., or .. segment.

Array<string>
<= 3000 items

Example generated

{
"head_ref": "example",
"head_sha": "example",
"base_ref": "example",
"pull_request": 1,
"files": [
"example"
]
}

The verdict. A failure is still a 200.

Media typeapplication/json
object
conclusion
required

Failure exactly when findings is not empty.

string
Allowed values: success failure
summary
required

Markdown for a check run or a job summary. Paths are shown as code spans.

string
<= 60000 characters
session_id
required

The session the branch names, or null.

string | null format: uuid
findings
required
Array<object>
<= 100 items
object
rule
required
string
Allowed values: session unclaimed held duplicate decision
path
required

The changed file as sent. Null for session, duplicate, and decision.

string | null
session_id
required

The branch’s session for unclaimed and decision, the holder for held, and the session running the matched intent for duplicate.

string | null format: uuid
intent_id
required

That session’s intent, or the matched intent for duplicate.

string | null format: uuid
decision_id

Decision only: the high-risk decision that blocks the merge.

string format: uuid
findings_omitted
required

Findings left out of findings.

integer

Example

{
"conclusion": "success",
"findings": [
{
"rule": "session"
}
]
}

The request is malformed.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

No valid bearer token.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The token may not do this.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

No such resource in the caller’s org.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The body is over 1 MiB.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

A rate limit or quota stopped the request. Retry-After gives seconds to wait.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}
Retry-After
integer