loopctl-mcp-server 3.58.0 → 3.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -649,7 +649,7 @@ The order to wire it up, the stage machine these tools move a story through, and
649
649
  | `merge_precondition` | **Run the merge gate over a story's real pull request** (`POST /api/v1/stories/:id/merge-precondition`). Both delivery gates run again over the diff that exists, plus custody, the 12-file / 1000-line hard bound, the head-has-not-moved check and the self-deploy exclusion; the story must be at stage `ci`. **Gate A reads what triage persisted, never the caller**: the lens verdicts recorded with the story's most recent triage, or a human's re-queue of a Gate A escalation — `gate_a_inputs` on the answer says which, and `missing` refuses with `gate_a_inputs_missing`. This tool sends no trio. Decisions: `allow` (recorded against the head; the only thing that licenses a merge), `refuse` (the story is escalated before this returns), `already_merged`, `head_moved`, `unevaluated` (503 with `Retry-After`). **The pull request must target exactly the base branch of the story's own intake source** (`base_branch` on the answer, compared case-sensitively): a pull request into any other branch, open or already merged, is a `refuse` with reason `pr_base_mismatch` (never `already_merged`), and one whose base cannot be read is a `refuse` with `pr_base_unreadable`; the story is escalated like any refusal, and the remedy is to retarget the pull request (`gh pr edit --base <base_branch>`). Requires an orchestrator- or user-ROLE key (`exact_role: [:orchestrator, :user]`, so an agent key is 403'd); `LOOPCTL_ORCH_KEY` is sent when set, else `LOOPCTL_API_KEY`. 403 `custody_tier_required` without a human anchor, 404 for an unknown story, 409 `change_protocol_enrolled` when the story's intake source is in mode `chg` (the PR route is closed; land with `chg submit` — decided before any GitHub read, nothing escalated), 422 when the story is not at `ci`. Required: `story_id` (refused locally if not a UUID) and `claim_epoch` (a non-negative integer, refused locally otherwise); optional `effect_proof`. |
650
650
  | `intake_source_enroll` | **Bind a GitHub repository to a work project and mint its webhook secret** (`POST /api/v1/intake/sources`) — the step that gives the delivery loop an input, and the row `place_dispatch` reads `repo` and `base_branch` from (each story reads its OWN source; its 409 `no_intake_source` means the story has none). **The secret is returned ONCE and can never be read again** — the column is encrypted at rest and redacted on the schema, so no other tool carries it and losing it costs a revoke, a re-enrolment and a reconfigured GitHub webhook. **This tool does not return it either:** a tool result lands in the transcript and the audit log, so it is written to the required `secret_file` with mode 0600 (the handling `runner_enroll` gives a runner credential) and the result carries the source row, the `webhook_url` and that path. The path is reserved before the request, so an existing file or an unwritable directory is refused with nothing enrolled, and any outcome that is not a clean creation withholds the response body — an unparsed 2xx body IS the secret. A 2xx carrying the source and the secret but no webhook path is RECOVERED rather than discarded (the path is derived from the source id, flagged `webhook_url_derived`), and an outcome that proves a source id but no usable secret REVOKES that source rather than leaving it holding the repository's unique slot. Then configure GitHub: Payload URL = the returned `webhook_url`, content type `application/json`, Secret = the contents of the file, and the **Issues** and **Pull requests** events (a merged pull request queues a read of its `## Review findings` section) — `gh api repos/OWNER/REPO/hooks -f name=web -f config[url]=<webhook_url> -f config[content_type]=json -f config[secret]="$(cat <secret_file>)" -f 'events[]=issues' -f 'events[]=pull_request'`. Every later delivery failure is the SAME 401 `invalid_signature` — unknown or revoked source, suspended tenant, missing or wrong signature, or a payload whose `repository.full_name` does not match — so the webhook's Recent Deliveries tab cannot tell you which. `base_branch` is set HERE: it defaults to `master` when the body does not name it, so name `main` for a repository created on GitHub since 2020 or every dispatch is cut from a trunk that does not exist. It is not nullable (a dispatch must name a branch), so null or blank is refused rather than falling back to the default, and `intake_source_update` changes it afterwards. Refusals: 403 `api_key_mint_forbidden` if your key was minted by a dispatch (this mints a credential belonging to no lineage, so only an unlineaged operator key may), 403 `custody_tier_required` on an agent-rooted tenant, 422 for a repository that is not `owner/name`, a project that is missing / archived / the wrong kind for the mode, or a `target_epic_id` outside that project. **One source per repository AND base branch (US-54.1):** a repository may have a second live source (a release, staging or e2e branch) on the same project, and `issue_label` (1-50 characters, compared case-insensitively) says which issues are whose. A project has ONE live `pr`/`chg` source with no label — its primary — so every other source of it carries one. Three refusals, each a 422 naming the field: `repo_full_name` `already has a live intake source on base branch <b>`, `issue_label` `is already the label of another live source on this repository`, and `issue_label` `is required: this project already has a source with no issue label`. `issue_label` is optional here (leave it out for the primary) and a null or blank one is refused locally. `mode` is the merge route: `pr` (the default when omitted; the merge gate reads a pull request) or `chg` (Epic 47: the change protocol lands the repository's changes with `chg submit`, and `merge_precondition` refuses every story on the source with 409 `change_protocol_enrolled`), both on a work project; or `ledger` (loopctl #1047), which enrols a repository for the chg ledger alone: `project_id` is then its active KB scope (`create_kb_scope`), or its active work project when that project has no intake route (its stories stay unbound), the source is never a dispatch binding (`place_dispatch` and candidate selection skip it), and GitHub deliveries to it are refused. Any other value, null included, is refused. **Sending is not routing:** the two chg credentials authenticate the ledger and change-event endpoints in every mode, so a `pr` source holding them sends its ledger too and stays `pr` — its events are recorded and move no story. A `chg` or `ledger` enrolment needs `change_events_secret` (or, preferred, `change_events_secret_file`, a path the tool reads so the value never enters the transcript) AND a root in the same call — `mint_chg_root: true` (preferred: loopctl mints a keyless, agentless root in the same write and returns its id) or `chg_root_dispatch_id` — refused locally and 422 at the server without them, and 422 with both. A root minted with `dispatch` takes its agent's one orchestrator-key slot, so it is 422 when that agent already holds a live key; the expiry sweep never revokes the row of a root a live source names. A named root that is not a parentless, unrevoked, orchestrator-role dispatch of this tenant with more than 300 s left before it expires is 422 `chg_root_invalid` (a child, a revoked or agent-role dispatch, another tenant's and an unknown id all alike). The change-events secret is write-only: no response and no tool result ever carries it. `required_checks` are the CI checks story verification judges a story's commit by, GitHub Actions job names, bounded in number and length by the server; `local-gate` is refused because whoever pushed posts it. Story verification judges a story's commit against the same `required_checks` in EITHER mode, satisfied only by a job of a push run of the story's branch; it first needs a GitHub credential for this tenant, its own token (`set_github_credential`) or an entry in the operator's `VERIFICATION_OPERATOR_TOKEN_TENANTS` (`credential_unavailable` otherwise, whatever the list holds); then a `pr` source that names none records `no_required_checks` and reads nothing, so naming them is how a pr source opts in, and a source that names some has its (tenant, repository) credential resolved before any GitHub read (`credential_unavailable` if there is none). Required: `repo_full_name`, `project_id`, `secret_file`. `triage_requires_ticket` decides which issues are triaged at all: false (the default), every issue the webhook delivers; true, only an issue HomeCareBilling filed from a support ticket (its single `#HCB-xxxxxxxx` Ticket line confirmed by the HomeCareBilling footer, which intake records as `ticket_id`), and every other issue stays an intake record with no story until it gains a ticket; anything but a boolean is refused. It filters on the format, it does not authenticate: anyone who can open an issue can type it. `deploy_environment` (US-54.7) is the GitHub deployment environment post-deploy verification reads this source's stories against; leave it out for the default, the operator's fleet-wide `DELIVERY_DEPLOY_ENVIRONMENT` (`production` when unset), and name it (e.g. `e2e-sandbox`) for a branch whose deploy workflow writes another environment: 1-255 characters with no control character (null, blank or a control character is refused locally, 422 on `deploy_environment` at the server); a wrong name is not a silent pass, the story escalates at the sweep's bound. Optional: `base_branch`, `issue_label`, `deploy_environment`, `mode`, `required_checks`, `triage_requires_ticket`, `change_events_secret` / `change_events_secret_file`, `chg_root_dispatch_id` or `mint_chg_root`, and `target_epic_id` — **omitting the epic is not a neutral default**: with no epic every triaged report is escalated to a human and every record stays `pending_triage` until `intake_source_update` names one. Requires `LOOPCTL_USER_KEY`. |
651
651
  | `intake_source_list` | List the tenant's intake sources (`GET /api/v1/intake/sources`): `id` (the webhook URL is `/api/v1/intake/github/<id>`), `project_id`, `repo_full_name`, `base_branch`, `issue_label` (null on the project's primary source), `deploy_environment` (the deployment environment its stories are verified against; null means the fleet-wide `DELIVERY_DEPLOY_ENVIRONMENT`, `production` when unset), `mode` (`pr`, `chg` or `ledger`), `required_checks`, `triage_requires_ticket`, `chg_root_dispatch_id`, `target_epic_id`, `revoked_at`, timestamps. **The webhook secret is not here and is not anywhere**, and neither is a `chg` source's change-events secret — it is returned once by `intake_source_enroll`, so this is not how to recover one. Use it to find the source behind a 409 `no_intake_source` or `base_branch_mismatch`, to check a repository's `base_branch` before placing work, to see a repository's sources side by side (`base_branch`, `issue_label`) before enrolling another, and to identify a source left behind by an enrolment whose outcome was unknown. Optional: `include_revoked`. Requires `LOOPCTL_USER_KEY`; the only one of the four that does not also need a human-anchored tenant. |
652
- | `intake_source_update` | **Set where a source's work lands** (`PATCH /api/v1/intake/sources/:id`): `target_epic_id`, the epic triaged stories are created in, `base_branch`, the branch every dispatch for this repository is cut from, `issue_label`, the GitHub label that marks this source's issues (an explicit null clears it, which makes the source its project's primary; a `base_branch` or `issue_label` change meets the same three 422 refusals as `intake_source_enroll`: `already has a live intake source on base branch <b>`, `is already the label of another live source on this repository`, `is required: this project already has a source with no issue label`), `deploy_environment`, the GitHub deployment environment post-deploy verification reads this source's stories against (US-54.7; an explicit null clears it, returning the source to the fleet-wide `DELIVERY_DEPLOY_ENVIRONMENT`, `production` when unset; read on every sweep, so it reaches stories already waiting; an empty string, a control character or more than 255 characters is refused locally and 422 at the server), `fly_app`, the Fly app the post-deploy monitor reads this source's edge metrics for with the tenant's own Fly metrics credential (US-55.7, `set_fly_metrics_credential`; an explicit null clears it, which stops the monitor reading the source; anything but a Fly app name, lowercase letters, digits and hyphens of at most 63 characters starting with a letter or digit, is refused locally and 422 on `fly_app` at the server), `mode` (`pr` or `chg` on a work project, `ledger` on a KB scope or a work project; a switch into or out of `ledger` is 422), the `change_events_secret` / `change_events_secret_file` and `chg_root_dispatch_id` that authenticate the source's chg ledger and change events (or `mint_chg_root: true`, which has loopctl mint a new keyless root in the write: the fix for a source with no root or a revoked one, 422 beside a named root) (on a `pr` source they let chg send the ledger while the source stays `pr` and its merge gate still reads the PR — do not switch to `chg` for that), and `required_checks`, the checks story verification judges a story's commit by — once the tenant has a GitHub credential, its own token (`set_github_credential`) or an entry in the operator's `VERIFICATION_OPERATOR_TOKEN_TENANTS` (`credential_unavailable` otherwise), a source naming none records `no_required_checks` and reads nothing, and one naming some has its (tenant, repository) credential resolved before any GitHub read (`local-gate` is refused), and `triage_requires_ticket`, which issues are triaged at all (true: only issues HomeCareBilling filed from a support ticket; read at dispatch time, so it reaches stories already waiting at `detected`; null is refused). Presence decides — a field you do not name is left exactly as it was, and naming none of them is 422 `nothing_to_update`. `mode` has no cleared state either, and a null or unknown value is refused locally. Each implement dispatch records the base branch it was placed under, and the merge gate reads that; `mode` is not bound that way — the gate reads the source's current mode. **Switching to `chg` closes the PR route for every story on the source at once** (409 `change_protocol_enrolled`; land with `chg submit`), and the switch itself is 409 `pr_route_in_flight`, naming `story_ids`, while a story of the project sits at `ci` holding a merge allow it has not merged on. The resulting source must carry both credentials, named here or kept from an earlier `chg` stint (422 naming the missing one), and the root is re-checked on every write that leaves the source `chg`, a secret rotation or a base-branch edit included (422 `chg_root_invalid`, also for a named root with 300 s or less left; switching to `pr` is never blocked by it). Switching to `pr` KEEPS both and they stay LIVE: the sender's ledger and its new changes' events are still accepted (recorded, routing nothing), while an event for a change the `chg` route already acted on is 401 until the source is `chg` again, so send an explicit null to refuse the sender; on a `pr` source an explicit null clears either, on a `chg` or `ledger` source it is a 422. Naming either credential, or setting `mode` to `chg` or `ledger` (which re-activates the kept ones), needs the tenant's operator key, one no dispatch minted (403 `chg_registration_forbidden` otherwise — a key minted by a dispatch beneath yours is refused the same way), and the secret never comes back. **Do not send `target_epic_id: null` to mean "not changing this":** an explicit null is the only way to CLEAR the epic, which returns the source to escalating every report instead of filing a story. `base_branch` has no cleared state and a null there is refused locally. This is how a source already pointed at the wrong trunk is corrected — `intake_source_enroll` takes `base_branch` itself, so a `main` repository no longer needs a second call — and the remedy for a source with no epic — every record from it stays `pending_triage` and is retried until one is named, then they promote on the next run with nothing lost. Revoked sources are 404, not a no-op: revoking clears the target so the epic can be deleted, and repointing one would put that block back. 422 when the epic is not in this source's project. Required: `source_id` (refused locally if it is not a UUID — the server answers the same 404 for malformed and unknown). Requires `LOOPCTL_USER_KEY` and a human-anchored tenant. |
652
+ | `intake_source_update` | **Set where a source's work lands** (`PATCH /api/v1/intake/sources/:id`): `target_epic_id`, the epic triaged stories are created in, `base_branch`, the branch every dispatch for this repository is cut from, `issue_label`, the GitHub label that marks this source's issues (an explicit null clears it, which makes the source its project's primary; a `base_branch` or `issue_label` change meets the same three 422 refusals as `intake_source_enroll`: `already has a live intake source on base branch <b>`, `is already the label of another live source on this repository`, `is required: this project already has a source with no issue label`), `deploy_environment`, the GitHub deployment environment post-deploy verification reads this source's stories against (US-54.7; an explicit null clears it, returning the source to the fleet-wide `DELIVERY_DEPLOY_ENVIRONMENT`, `production` when unset; read on every sweep, so it reaches stories already waiting; an empty string, a control character or more than 255 characters is refused locally and 422 at the server), `fly_app`, the Fly app the post-deploy monitor reads this source's edge metrics for with the tenant's own Fly metrics credential (US-55.7, `set_fly_metrics_credential`; an explicit null clears it, which stops the monitor reading the source; anything but a Fly app name, lowercase letters, digits and hyphens of at most 63 characters starting with a letter or digit, is refused locally and 422 on `fly_app` at the server), `mode` (`pr` or `chg` on a work project, `ledger` on a KB scope or a work project; a switch into or out of `ledger` is 422), the `change_events_secret` / `change_events_secret_file` and `chg_root_dispatch_id` that authenticate the source's chg ledger and change events (or `mint_chg_root: true`, which has loopctl mint a new keyless root in the write: the fix for a source with no root or a revoked one, 422 beside a named root) (on a `pr` source they let chg send the ledger while the source stays `pr` and its merge gate still reads the PR — do not switch to `chg` for that), and `required_checks`, the checks story verification judges a story's commit by — once the tenant has a GitHub credential, its own token (`set_github_credential`) or an entry in the operator's `VERIFICATION_OPERATOR_TOKEN_TENANTS` (`credential_unavailable` otherwise), a source naming none records `no_required_checks` and reads nothing, and one naming some has its (tenant, repository) credential resolved before any GitHub read (`local-gate` is refused), and `triage_requires_ticket`, which issues are triaged at all (true: only issues HomeCareBilling filed from a support ticket; read at dispatch time, so it reaches stories already waiting at `detected`; null is refused), and `deploys`, whether a merge is followed by a GitHub deployment (false: the merge is the release, so post-deploy verification moves a merged story on with `release_id` `merge:<sha>` and reads no deployment; read on every sweep; null is refused). Presence decides — a field you do not name is left exactly as it was, and naming none of them is 422 `nothing_to_update`. `mode` has no cleared state either, and a null or unknown value is refused locally. Each implement dispatch records the base branch it was placed under, and the merge gate reads that; `mode` is not bound that way — the gate reads the source's current mode. **Switching to `chg` closes the PR route for every story on the source at once** (409 `change_protocol_enrolled`; land with `chg submit`), and the switch itself is 409 `pr_route_in_flight`, naming `story_ids`, while a story of the project sits at `ci` holding a merge allow it has not merged on. The resulting source must carry both credentials, named here or kept from an earlier `chg` stint (422 naming the missing one), and the root is re-checked on every write that leaves the source `chg`, a secret rotation or a base-branch edit included (422 `chg_root_invalid`, also for a named root with 300 s or less left; switching to `pr` is never blocked by it). Switching to `pr` KEEPS both and they stay LIVE: the sender's ledger and its new changes' events are still accepted (recorded, routing nothing), while an event for a change the `chg` route already acted on is 401 until the source is `chg` again, so send an explicit null to refuse the sender; on a `pr` source an explicit null clears either, on a `chg` or `ledger` source it is a 422. Naming either credential, or setting `mode` to `chg` or `ledger` (which re-activates the kept ones), needs the tenant's operator key, one no dispatch minted (403 `chg_registration_forbidden` otherwise — a key minted by a dispatch beneath yours is refused the same way), and the secret never comes back. **Do not send `target_epic_id: null` to mean "not changing this":** an explicit null is the only way to CLEAR the epic, which returns the source to escalating every report instead of filing a story. `base_branch` has no cleared state and a null there is refused locally. This is how a source already pointed at the wrong trunk is corrected — `intake_source_enroll` takes `base_branch` itself, so a `main` repository no longer needs a second call — and the remedy for a source with no epic — every record from it stays `pending_triage` and is retried until one is named, then they promote on the next run with nothing lost. Revoked sources are 404, not a no-op: revoking clears the target so the epic can be deleted, and repointing one would put that block back. 422 when the epic is not in this source's project. Required: `source_id` (refused locally if it is not a UUID — the server answers the same 404 for malformed and unknown). Requires `LOOPCTL_USER_KEY` and a human-anchored tenant. |
653
653
  | `intake_source_revoke` | **Revoke an intake source** (`DELETE /api/v1/intake/sources/:id`). The verb is DELETE and the action is a revoke: `revoked_at` is stamped, the row is kept, and `intake_source_list` still returns it with `include_revoked`; nothing already received is discarded. Afterwards every delivery to that URL is refused 401 `invalid_signature` exactly as a wrong secret is, so the GitHub webhook does not know it has been cut off and should be deleted on the repository too. Idempotent — a second revoke answers 200 with the original `revoked_at`. It frees the source's uniqueness slots — its repository and base branch, its `issue_label`, and its project's primary slot (every identity index is partial on not-yet-revoked) — so a source with a lost secret, a wrong project or a typo'd repository is corrected by revoking and enrolling again; and it clears `target_epic_id`, which is what makes that epic deletable and is the remedy an epic-delete refusal names. Required: `source_id` (refused locally if it is not a UUID). Requires `LOOPCTL_USER_KEY` and a human-anchored tenant. |
654
654
 
655
655
  ### Dispatch & Chain of Custody (v2) Tools
@@ -675,7 +675,7 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
675
675
  | `work_item_timeline` | **Read a work item's timeline** (`GET /api/v1/stories/:id/timeline`): `item` (stage and its age, holder, lease, issue, PR, runner, newest 20 CI runs, newest 20 runner dispatches (`dispatch_id`, `kind`, `runner_id`, `status`), thread count and newest 20 messages, and `triage_escalation`: null when triage never escalated the item, else its newest triage escalation at any stage: `verdict`, `escalation_reasons` and `missing_information` (`untrusted: true`, fenced in `fenced`), `escalated_at`, and `current`, true while the item is still escalated in it) and one page of `events`, the event log and audit log merged oldest first. Optional `cursor` (a page's `next_cursor`) and `limit` (default 100, max 500). Read-only on any key; never moves a thread cursor. Every reason and message body is untrusted session text, flagged `untrusted: true`. `404` for another tenant's story, `400` for a bad limit or cursor. |
676
676
  | `holder_list` | **List the holders and what each holds** (`GET /api/v1/holders`, #1297): the tenant's live session holders, newest `last_seen_at` first, each with `id`, `agent_id`, `kind`, `host`, `session_id`, `worktree`, `registered_at`, `last_heartbeat_at`, `lease_expires_at`, `ended_at`, `ended_reason` and `items` (the work items it holds now: `story_id`, `number`, `project_id`, `title`, `stage`, `branch`, `pr_number`). Join a live session to its holder on `session_id`. A holder whose lease ran out but the sweep has not ended yet is still listed. Optional `include_ended: true` adds the holders that ended in the last day. At most 200 holders; `truncated: true` says there were more. Read-only on any key: no heartbeat, no lease move, never a credential. |
677
677
  | `decisions` | **Read the decided-on-default notes** (`GET /api/v1/decisions`): live messages whose `idempotency_key` starts `decision-default:`, on a repo channel or a work item thread (never a DM), newest first, without expired, quarantined or superseded ones. Each row carries `idempotency_key`, `project_id`, `story_id`, `host`, a bounded `body_preview` and `untrusted: true`; `has_more` says the limit cut the list. Optional `since` (ISO 8601, default 48 hours ago) and `limit` (1..100, default 25). Read-only on any key. `400` for a bad `since` or `limit`. |
678
- | `factory_overview` | **Read the factory overview** (`GET /api/v1/factory/overview`): per project and summed for the fleet, `in_flight` counts per stage (claimed through verified), `waiting` counts (detected, triaged, queued, and escalated per reason class) with the oldest item's age, `throughput` over the window (done count, median seconds opened to done) and `failure_classes` (moves into escalated or failed, by edge), `reserved` (queue items a released move reserves for one host, holder or the cloud, with the oldest age and `by_kind`, not counted again under `waiting`; a released move to the loop stays under `waiting`) and `interactive` (`in_flight` items an interactive holder holds, a subset of `in_flight`, and `waiting` items reserved for an interactive session after a lapsed claim, with the oldest age). Counts come from the stage machine; drill into an item with `work_item_timeline`. Optional `project_id` and `window_days` (default 7, 1..30). Read-only on any key. `400` for a bad window, `404` for another tenant's project, `503` when the read times out. |
678
+ | `factory_overview` | **Read the factory overview** (`GET /api/v1/factory/overview`): per project and summed for the fleet, `in_flight` counts per stage (claimed through verified), `waiting` counts (detected, triaged, queued, and escalated per reason class) with the oldest item's age, `throughput` over the window (done count, median seconds opened to done) and `failure_classes` (moves into escalated or failed, by edge), `reserved` (queue items a released move reserves for one host, holder or the cloud, with the oldest age and `by_kind`, not counted again under `waiting`; a released move to the loop stays under `waiting`) and `interactive` (`in_flight` items an interactive holder holds, a subset of `in_flight`, and `waiting` items reserved for an interactive session after a lapsed claim, with the oldest age), and `detected_blocked` (the `waiting.detected` items split by why each is still there, under the first reason that holds: `no_intake_record`, `issue_closed`, `no_triage_source`, `intake_paused`, `ticket_required`, `triaging` (a triage dispatch is in flight), `no_runner_for_repo` (no live connected runner takes triage for the repository without a config refusal), `runners_busy`, `triage_due`; each a count and oldest age, summing to `waiting.detected.count`). Counts come from the stage machine; drill into an item with `work_item_timeline`. Optional `project_id` and `window_days` (default 7, 1..30). Read-only on any key. `400` for a bad window, `404` for another tenant's project, `503` when the read times out. |
679
679
  | `factory_policy` | **Read the factory policy** (`GET /api/v1/factory/policy`, US-52.51): every delivery-loop rule value, compiled into loopctl from `factory/policy.toml` — review-round `normal` and `ceiling` per diff kind (`prose`, `code`), `open_prs_per_session`, `epics_open_per_repo`, `pr_body.required_sections`, `review.default_level` and `review.max_level`, `epic_merge.new_tip_seconds`, `protected_branches`. Returns `{schema, version, rules}`; `version` is the file's sha256 (the endpoint's ETag, so a client that kept a copy gets `304` on `If-None-Match`). The same for every tenant. Any tenant key; refuses nothing else (`401` only without a valid key). No arguments. |
680
680
  | `review_round_open` | **Open a review round** (`POST /api/v1/review_rounds`, US-52.53): counts one round on the work item for `repo_url` and `branch` and answers from the factory policy's `review_rounds.<diff_kind>` limits — `201 {round_id, round, normal, ceiling, verdict, message, attested}`, `verdict` `allow` while round <= normal and `warn` up to the ceiling. A repeated `round_id` counts nothing and answers `200` with the first answer. `attested: true` with a `reason` counts a review the hook could not see. `kind: "security"` with a `head_sha` records a /security-review at that head instead (`201 {round_id, kind, head_sha, message, attested}`), never counted against the ceiling. `ancestor_shas` (the branch's commits outside the base, at most 500) refuses a round whose branch carries another unmerged item's ceiling-round head (claude-config#810). Holder credential (the round's actor is its holder). `409 review_ceiling_reached` (nothing counted; the session decides a redesign or a narrower merge), `409 inherited_ceiling_reached` (`parent_branch`, `head_sha`, `round_count`, `ceiling`), `422 attestation_reason_required`, `422 head_sha_required`, `404 work_item_not_found` (no item, or only ended items your holder never held: open one with `work_item_open`), `403 holder_credential_required`, `400 repo_and_branch_required`, `409 ambiguous_project`, `422 invalid_round_id`/`invalid_kind`/`invalid_diff_kind`/`invalid_head_sha`/`invalid_ancestor_shas`/`invalid_branch`, `503 busy`. |
681
681
  | `review_round_void` | **Void a review round** that did not review (`POST /api/v1/review_rounds/:round_id/void`, US-52.53): it stops counting on its item. `201 {round_id, voided, round, count}`; a second void is `200`. Holder credential. `404 review_round_not_found`, `409 ambiguous_round_id`, `403 holder_credential_required`, `422 invalid_reason`, `503 busy`. |
package/index.js CHANGED
@@ -11891,7 +11891,12 @@ const TOOLS = [
11891
11891
  "is loop work and stays under `waiting`); `interactive` (`in_flight`: items an " +
11892
11892
  "interactive holder holds at an in-flight stage, a subset of `in_flight`; " +
11893
11893
  "`waiting`: items reserved for an interactive session after its claim lapsed, with the " +
11894
- "oldest age). Every count is read " +
11894
+ "oldest age); `detected_blocked` (the `waiting.detected` items split by why each is " +
11895
+ "still there, under the first reason that holds: `no_intake_record`, `issue_closed` " +
11896
+ "(taken again if the issue reopens), `no_triage_source`, `intake_paused`, " +
11897
+ "`ticket_required`, `triaging` (a triage dispatch is in flight), `no_runner_for_repo` " +
11898
+ "(no live connected runner takes triage for its repository without a config refusal), `runners_busy`, `triage_due`; each a count and oldest age, summing to " +
11899
+ "`waiting.detected.count`). Every count is read " +
11895
11900
  "from loopctl's stage machine at request time; drill into one item with " +
11896
11901
  "work_item_timeline. Optional `project_id` narrows it to one project; `window_days` " +
11897
11902
  "defaults to 7, 1..30. READ-ONLY on any key. 400 for a window outside 1..30; 404 for a " +
@@ -13922,7 +13927,9 @@ const TOOLS = [
13922
13927
  "422 on `deploy_environment` at the server), `fly_app`, the Fly app the post-deploy " +
13923
13928
  "monitor reads this source's edge metrics for with the tenant's own Fly metrics " +
13924
13929
  "credential (US-55.7; null clears it; anything but a Fly app name is refused here and " +
13925
- "422 on `fly_app` at the server), `mode`, the merge route (`pr` or `chg`, " +
13930
+ "422 on `fly_app` at the server), `deploys` (false: the merge is the release, and " +
13931
+ "post-deploy verification waits for no deployment; null is refused here and 422 at the " +
13932
+ "server), `mode`, the merge route (`pr` or `chg`, " +
13926
13933
  "or `ledger` on a KB scope or a work project), and the `change_events_secret` and " +
13927
13934
  "`chg_root_dispatch_id` " +
13928
13935
  "that authenticate a source's chg ledger and change events.\n\n" +
@@ -14099,6 +14106,18 @@ const TOOLS = [
14099
14106
  "on every pass, so it reaches the stories and records already waiting. Null is " +
14100
14107
  "refused; omit the field to leave it alone.",
14101
14108
  },
14109
+ deploys: {
14110
+ type: "boolean",
14111
+ description:
14112
+ "WHETHER A MERGE IS FOLLOWED BY A DEPLOYMENT. True (the default): post-deploy " +
14113
+ "verification moves a merged story to `deployed` and `verified` once a GitHub " +
14114
+ "deployment carrying its merge succeeded, and escalates it when none does within " +
14115
+ "its bound. False: the merge is the release (a library, a config repository, a " +
14116
+ "service released by hand), so the sweep moves a merged story on with " +
14117
+ "`release_id` `merge:<sha>` and reads no deployment. Read on every sweep, so it " +
14118
+ "reaches stories already waiting at `merged`. Null is refused; omit the field to " +
14119
+ "leave it alone.",
14120
+ },
14102
14121
  },
14103
14122
  required: ["source_id"],
14104
14123
  },
@@ -385,6 +385,20 @@ export function triageRequiresTicketRefusal(value) {
385
385
  );
386
386
  }
387
387
 
388
+ /**
389
+ * `deploys`: a boolean, never null (`Source.put_deploys/2` answers 422 for null). False says the
390
+ * merge is the release, so post-deploy verification waits for no deployment record.
391
+ */
392
+ export function deploysRefusal(value) {
393
+ if (typeof value === "boolean") return null;
394
+
395
+ return refuse(
396
+ "`deploys` must be true (a merge is followed by a GitHub deployment, which post-deploy " +
397
+ "verification waits for) or false (the merge is the release). It cannot be null; leave " +
398
+ "it out to keep the current value.",
399
+ );
400
+ }
401
+
388
402
  /** The longest `issue_label`, in characters: GitHub's own label limit (`Source.max_issue_label_chars/0`). */
389
403
  export const MAX_ISSUE_LABEL_CHARS = 50;
390
404
 
@@ -504,6 +518,7 @@ export function publicSource(source) {
504
518
  mode: source.mode,
505
519
  required_checks: source.required_checks,
506
520
  triage_requires_ticket: source.triage_requires_ticket,
521
+ deploys: source.deploys,
507
522
  // `change_events_secret` is NEVER named here: write-only (US-47.2).
508
523
  chg_root_dispatch_id: source.chg_root_dispatch_id,
509
524
  target_epic_id: source.target_epic_id,
@@ -921,6 +936,12 @@ export async function updateIntakeSource(
921
936
  body.triage_requires_ticket = args.triage_requires_ticket;
922
937
  }
923
938
 
939
+ if (args.deploys !== undefined) {
940
+ const badDeploys = deploysRefusal(args.deploys);
941
+ if (badDeploys) return badDeploys;
942
+ body.deploys = args.deploys;
943
+ }
944
+
924
945
  // Switching to `chg` may rely on credentials an earlier `chg` stint left on the row, so their
925
946
  // absence here is the SERVER's to judge (422 naming the missing one); only their shape is
926
947
  // judged here.
@@ -933,7 +954,7 @@ export async function updateIntakeSource(
933
954
  "Nothing to update. Name at least one of `target_epic_id` (null clears it), " +
934
955
  "`base_branch`, `issue_label` (null clears it), `deploy_environment` (null clears " +
935
956
  "it), `fly_app` (null clears it), `mode`, `required_checks`, " +
936
- "`triage_requires_ticket`, " +
957
+ "`triage_requires_ticket`, `deploys`, " +
937
958
  "`change_events_secret` (or " +
938
959
  "`change_events_secret_file`), `chg_root_dispatch_id` or `mint_chg_root`. A body " +
939
960
  "carrying none of them " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopctl-mcp-server",
3
- "version": "3.58.0",
3
+ "version": "3.59.0",
4
4
  "description": "MCP server for loopctl — structural trust for AI development loops",
5
5
  "type": "module",
6
6
  "main": "index.js",