跳转到内容
EN

Close a pull request without merging it

Code Mode: praxis.devops.pullRequests.close

HTTP: POST /devops/v1/pull-requests/{id}:close

End a pull request that will never land, without abandoning the change it belongs to. DevOps closes it on GitHub through the project’s own App installation, after writing this reason on the pull request, so it leaves the review queue instead of waiting for a merge that is not coming and whoever finds it later sees who ended it and why. Use it when one slice of a change is dropped while the change continues; abandoning the CHANGE closes its unmerged pull requests on its own and needs no second call. Only an open pull request can be closed: a merged one is refused with PULL_REQUEST_NOT_OPEN, because closing does not undo a merge and GitHub will not move a merged pull request back to closed, and one that is already closed answers itself unchanged, so repeating the call is safe. A pull request GitHub no longer has open is refused the same way — nothing was closed, and the platform’s record catches up with GitHub on its next delivery.

签名

praxis.devops.pullRequests.close(args:{path:{/** e.g. "pr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string};body:{/** Why, in a sentence the next reader of the pull request can act on. e.g. "the change was superseded by fix/other; this slice is not needed." */ reason:string}}):Promise<{/** The pull request's platform id (pr_…), which the retrieve, rerunGate, merge and recordVerdict calls address; it is not GitHub's pull request number. e.g. "pr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always pull_request. */ object:"pull_request";/** RFC 3339 UTC time this platform first projected the pull request. e.g. "2026-11-08T06:30:00Z" */ createTime:string;/** RFC 3339 UTC time GitHub last moved the pull request; the list is ordered by this, newest first. e.g. "2026-11-08T07:02:00Z" */ updateTime:string;/** Canonical Console link for the pull request's project. e.g. "https://console.deepraxis.com/devops/dvp_01m6j8swzteapw2j5sh4" */ viewerUrl:string;/** The project the pull request belongs to, from the project list. e.g. "dvp_01m6j8swzteapw2j5sh4" */ project:string;/** GitHub's own pull request number in the bound repository, which is what the filter number= and the GitHub web address use. e.g. 4135 */ number:number;/** One line saying what the change proposes, exactly as GitHub holds it. e.g. "feat(devops): an environment rolls back to versions it ran before" */ title:string;/** The description as written on GitHub, which is where the praxis declaration block lives; null when nothing was written. e.g. "Closes #1529" */ body?:string|null;/** The people asked to review, and the state of each one's latest review. */ reviewers:Array<{/** The reviewer's GitHub login; it is what the list's reviewer= filter matches. e.g. "sean" */ login:string;/** Where that reviewer stands: still asked and unanswered, or the conclusion of their latest review. e.g. "requested" */ state:"requested"|"approved"|"changes_requested"|"commented"}>;/** GitHub's own address for the pull request, derived from the project's bound repository; empty when the project is bound to none. e.g. "https://github.com/deepraxis/praxis/pull/4135" */ htmlUrl:string;/** Where the pull request stands: still open, merged, or closed without merging. e.g. "open" */ state:"open"|"merged"|"closed";/** True while GitHub holds it as a draft; a draft is still projected and gated but is not something to merge. e.g. false */ draft:boolean;/** The branch the change comes from and the commit the gate and every check are about. */ head:{/** The head branch's name on GitHub. e.g. "feat/run-page-v2" */ ref:string;/** The head commit, which is what headSha and the gate refer to; a new commit here starts a new gate. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ sha:string};/** The branch the change would land on and the commit it was compared against. */ base:{/** The base branch's name on GitHub, for example main. e.g. "main" */ ref:string;/** The base commit GitHub compared the head against; a merge uses the head, never this. e.g. "c8a9a1cf2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d7c" */ sha:string};/** The paths the change touches, which is what the affected-test rule reads to decide which tests a commit needs. */ changedPaths:{/** The repository paths the change touches. e.g. ["services/devops/src/source/gate-run.ts"] */ paths:Array<string>;/** True when GitHub's comparison was cut at its file limit, so paths is known to be incomplete. e.g. false */ truncated:boolean};/** Who opened the change, and whether that account is a person, an agent or a bot. */ author:{/** The author's GitHub login. e.g. "sean" */ login:string;/** What the author's GitHub account is, so an agent's or bot's change can be told from a person's. e.g. "user" */ kind:"user"|"agent"|"bot"};/** The mergeability word, an open set. e.g. "clean" */ mergeableState:string;/** Who this pull request's letters go to — the gate verdict, the merge, the deploy to each integration environment and an integration failure — as the description' e.g. "agent:agent_ebe8605d-0416-4041-b37f-d677be17b91b" */ notify?:string;/** The exposure the description's praxis block declares, or null when the description declares none — which is itself a failed gate check. */ exposure:{/** Which of the four exposures this is; it decides which gate checks the change must satisfy. e.g. "direct" */ kind?:"flag"|"unwired"|"expand-contract"|"direct";/** Why this exposure is the right one, written for unwired and expand-contract; empty for a flag. e.g. "nothing reads it yet" */ reason?:string;/** The flag's key, present only for a flag exposure; it is what the registry and the paired scenarios are checked against. e.g. "run-page-v2" */ flagKey?:string;/** What the flag is for, present only for a flag exposure. e.g. "release" */ flagKind?:"release"|"experiment"|"ops"|"permission";/** RFC 3339 UTC time the flag must be decided by, present only for a flag exposure; an observation that quietly outlives it is a firing condition. e.g. "2026-12-15T23:59:59Z" */ observeUntil?:string;/** Which phase of an expand-contract move this change is, present only for that kind. e.g. "expand" */ phase?:"expand"|"migrate"|"contract"}|{/** Which of the four exposures this is; it decides which gate checks the change must satisfy. e.g. "direct" */ kind?:"flag"|"unwired"|"expand-contract"|"direct";/** Why this exposure is the right one, written for unwired and expand-contract; empty for a flag. e.g. "nothing reads it yet" */ reason?:string;/** The flag's key, present only for a flag exposure; it is what the registry and the paired scenarios are checked against. e.g. "run-page-v2" */ flagKey?:string;/** What the flag is for, present only for a flag exposure. e.g. "release" */ flagKind?:"release"|"experiment"|"ops"|"permission";/** RFC 3339 UTC time the flag must be decided by, present only for a flag exposure; an observation that quietly outlives it is a firing condition. e.g. "2026-12-15T23:59:59Z" */ observeUntil?:string;/** Which phase of an expand-contract move this change is, present only for that kind. e.g. "expand" */ phase?:"expand"|"migrate"|"contract"};gate:{/** The gate's verdict: failed as soon as one check failed, pending while one is still undecided, passed only when every check passed or was skipped. e.g. "pending" */ state:"pending"|"passed"|"failed";/** The commit this gate is about. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ headSha:string;/** Every check the gate made, in the order it made them. */ checks:Array<{/** Which check this is: the declaration itself, one of the flag duties, the affected tests, or the one judgement only a person makes. e.g. "tests" */ name:"exposure-declared"|"flag-registered"|"flag-paired-scenarios"|"removal-ticket"|"tests"|"lockfile"|"exposure-judged"|"owner-approved"|"repo-lint";/** The check's verdict: skipped means the check does not apply to this exposure kind, and pending means its evidence has not arrived yet — which is never treated a e.g. "pending" */ result:"passed"|"failed"|"skipped"|"pending";/** What to do about a failed or pending check, or the gatekeeper's reason for a judgement; absent when the check simply passed. e.g. "no test run has reported for this head commit" */ message?:string;/** Who decided this check: a machine reading the facts, or the one check a person answers. e.g. "machine" */ by:"machine"|"gatekeeper"}>;/** GitHub's id of the "Praxis DevOps / gate" check run this gate reports through, present once GitHub accepted the report. e.g. 1042 */ checkRunId?:number;/** RFC 3339 UTC time the gate first reached passed or failed on this commit; absent while it is pending, and it does not move when the same verdict is recomputed. e.g. "2026-11-08T07:10:00Z" */ decideTime?:string};/** The tickets the description names, split by what it says about them. */ tickets:{/** Tickets the description closes, named as a URL or #number. e.g. ["#1529"] */ closes:Array<string>;/** Tickets the description merely refers to. e.g. ["#1511"] */ refs:Array<string>};/** Where the pull request stands in its (project, base) merge queue; none means it is not in a queue. */ queue:{/** The queue's state for this pull request. e.g. "none" */ state:"none"|"queued"|"building"|"dequeued";/** Why it left the queue, when it was dequeued for a reason worth keeping. e.g. "conflict with the base" */ reason?:string;/** The temporary merge-group commit GitHub built for it, present once the queue is building; the gate is re-decided on this commit. e.g. "5a3b0d2e9f8c7b6a5d4e3f2a1b0c9d8e7f6a5b4c" */ mergeGroupHead?:string;gate?:{/** The gate's verdict: failed as soon as one check failed, pending while one is still undecided, passed only when every check passed or was skipped. e.g. "pending" */ state:"pending"|"passed"|"failed";/** The commit this gate is about. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ headSha:string;/** Every check the gate made, in the order it made them. */ checks:Array<{/** Which check this is: the declaration itself, one of the flag duties, the affected tests, or the one judgement only a person makes. e.g. "tests" */ name:"exposure-declared"|"flag-registered"|"flag-paired-scenarios"|"removal-ticket"|"tests"|"lockfile"|"exposure-judged"|"owner-approved"|"repo-lint";/** The check's verdict: skipped means the check does not apply to this exposure kind, and pending means its evidence has not arrived yet — which is never treated a e.g. "pending" */ result:"passed"|"failed"|"skipped"|"pending";/** What to do about a failed or pending check, or the gatekeeper's reason for a judgement; absent when the check simply passed. e.g. "no test run has reported for this head commit" */ message?:string;/** Who decided this check: a machine reading the facts, or the one check a person answers. e.g. "machine" */ by:"machine"|"gatekeeper"}>;/** GitHub's id of the "Praxis DevOps / gate" check run this gate reports through, present once GitHub accepted the report. e.g. 1042 */ checkRunId?:number;/** RFC 3339 UTC time the gate first reached passed or failed on this commit; absent while it is pending, and it does not move when the same verdict is recomputed. e.g. "2026-11-08T07:10:00Z" */ decideTime?:string}};/** The change's progress through the delivery environments, in order. */ delivery:{/** One entry per environment the change has reached, in environment order. */ stages:Array<{/** The environment's name, from the project's environment list. e.g. "develop" */ environment:string;/** How far the change has got in that environment. e.g. "healthy" */ state:"pending"|"deployed"|"observing"|"healthy"|"rolled_back";/** The release deployed there, when one has been. e.g. "rls_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ release?:string;/** RFC 3339 UTC time that environment reached this state. e.g. "2026-11-08T07:20:00Z" */ time?:string}>};review?:{/** passed when the reviewer found nothing wrong, failed when they found something to fix or roll back. e.g. "failed" */ result:"passed"|"failed";/** What the reviewer found, in a sentence a reader can act on. e.g. "The retry loop does not stop on a 4xx answer." */ reason:string;by:{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string};/** The commit the review is about. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ headSha:string;/** RFC 3339 UTC time the verdict was recorded. e.g. "2026-11-24T09:30:00Z" */ time:string;/** True when the pull request had already merged when the verdict was recorded; a failed verdict with merged true is a finding. e.g. true */ merged:boolean};/** The commit it landed as, present only once it is merged. e.g. "c8a9a1cf2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d7c" */ mergeCommitSha?:string;/** RFC 3339 UTC time it was merged, present only once it is merged. e.g. "2026-11-04T02:00:00Z" */ mergeTime?:string;/** RFC 3339 UTC time it was closed without merging, present only when it was closed that way. e.g. "2026-11-04T02:00:00Z" */ closeTime?:string;/** The affected test runs reported at the head commit, newest first; present only when the read asked for expand=runs. */ runs?:Array<string>}>;

参数

名称位置类型必填说明
idpathstring是The pull request’s platform id (pr_…) from a pull request list, not GitHub’s pull request number; the retrieve, rerunGate, merge and recordVerdict calls all address the pull request by it.

请求体

必填内容类型说明
是application/json

响应

状态码内容类型说明
200application/jsonThe pull request as it now stands: state closed with its closeTime, or, for one that was already closed, the answer it had before this call.
400application/jsonINVALID_PARAMS or INVALID_ARGUMENT means a field, query value or identifier violates the documented format or range — an unknown enum value, a pageSize outside 1..100, an unsupported filter or orderBy field, or an id with the wrong prefix. Correct the named input; nothing was read or written.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
403application/jsonThe credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible.
404application/jsonPULL_REQUEST_NOT_FOUND means no pull request with that id is visible to this organization — one of another organization is never readable; list the project’s pull requests and use an id from that answer.
409application/jsonPULL_REQUEST_NOT_OPEN when the pull request is merged or is not open on GitHub: nothing was closed, and the message says which state GitHub reported.
500application/jsonINTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again.