diff --git a/docs/content/hive/adr/0026-sandbox-runtime-selection.md b/docs/content/hive/adr/0026-sandbox-runtime-selection.md index 3d67e2c3..bca372de 100644 --- a/docs/content/hive/adr/0026-sandbox-runtime-selection.md +++ b/docs/content/hive/adr/0026-sandbox-runtime-selection.md @@ -268,16 +268,91 @@ Decision by the hive owner on #17695, option A: egress is governed only by Substrate's `EgressPolicy`. - Hive brokers pushes **post-kick**: it performs git pushes and GitHub writes itself, from the workspace the bridge returns. -- **Phase 3 (future)**: SVID-authenticated broker delegation over the atenet - mTLS channel, so hive can delegate scoped GitHub writes to the actor without - a credential entering it. It is gated on hosted clusters serving the podcert - feature gates (`PodCertificateRequest` / `ClusterTrustBundle`, - `certificates.k8s.io/v1beta1`) and is tracked as a child issue of #17695. +- **Phase 3**: broker delegation, so hive can do scoped GitHub writes for the + actor during the kick without a credential entering it. It is gated on the + cluster serving the podcert APIs (`PodCertificateRequest` / + `ClusterTrustBundle`; `certificates.k8s.io/v1` on Kubernetes ≥ 1.37, + `v1beta1` behind feature gates on 1.35 to 1.36). It was planned as SVID + authentication and was built with gateway-injected actor JWTs instead; see + the 2026-12-01 amendment below (#17933, a child of #17695). This supersedes the earlier statement that hive's credential brokering is unchanged for Substrate. The podman, `job` and `openshell` runtimes keep their proxy model (ADR-0002). +### Amendment (2026-12-01, #17933): phase 3, actor-JWT broker delegation + +Decision by the hive owner on #17933. Substrate never gives an actor its own +X.509 SVID: the actor's client certificate is generated and held by `atunnel` +outside the workload and is accepted only by the egress gateway, and +`PodCertificateRequest` issues per pod, not per actor. Phase 3 therefore uses +Substrate's documented way for an actor to prove who it is to an outside +service, an actor JWT that `atenet-egress` injects, instead of an actor SVID. +It is **opt-in per agent and off by default**; phase 2 stays the fallback. + +- **Egress.** A broker-enabled actor's `EgressPolicy` gets one `https` + (intercepting) rule for exactly hive's broker host and port. Its effect + replaces the `Authorization` header with `Bearer ` for this + hive's audience and a lifetime of 300 to 3600 seconds (default 600). The + broker host must be dedicated to the broker, because the token goes to + every request to that host and port. `network_mode: none` drops this rule + along with every other. The actor sends a placeholder value and never sees the token. The template + mounts the `egress-mitm.ate.dev` and `system-roots.ate.dev` trust bundles so + the actor trusts the gateway's interception certificate. The GitHub hosts + stay TLS passthrough. The broker host may not be a GitHub host or a wildcard. +- **Verification** (`crux/sandbox/substratebroker`). The issuer is pinned + (default `https://idp.ate-system.svc`). Its discovery document and key set + are fetched only over TLS that chains to the servicedns ClusterTrustBundle + projection, with no system roots, no proxy, no redirects, and `jwks_uri` on + the issuer's host. The audience must be this hive's + (`https:///substrate-broker/` by default; without a + `hive_id` an explicit audience is required). The subject must + be `actor//`; a `worker-for-actor` token is refused. The + atespace must be the one hive creates actors in, and the atespace, name and + UID must equal a kick hive is running now. The token's lifetime is capped + and clock skew is bounded (30s). A cached key set expires after 5 minutes, + so removing a key from Substrate's pool (its only revocation) takes effect. +- **The write.** Hive performs it with its own minter. The actor sends a git + bundle. Hive takes only the kick's branch from it, as a fast-forward of the + kick's start point, in a scratch clone with hooks off and object checks on. + It then runs the same pushbroker gates the post-kick push uses (hostile + config, sign-off, protected paths, secret scan, fast-forward and lease). A + kick on an existing PR re-checks before every push that the PR is still the + agent's own open PR at the expected head (the person's-PR rule). A PR is + opened through the same PR client and gates, and only from a branch the + broker published. Writes are accepted only while the kick's command runs: + the actor is registered under the UID Substrate gave it after it is + created, and released, with writes in flight cancelled and awaited, before + the workspace is pulled back. No token leaves hive. Writer errors reach the + actor only as hive-written reasons. The pushed body must be a git bundle. + Broker writes happen before the post-kick report-status and exit-code + gates, which the actor's own request stands in for. An agent with + `publish.verify` never gets the broker, because that gate can only run + after the kick. +- **Post-kick.** The post-kick push and PR reuse what the broker published. + If the workspace has nothing new, nothing is pushed again. Otherwise the + push is leased on what the broker pushed. If the push broker rewrote the + commits it published and the actor kept committing on the originals, the + push is withheld with that reason. +- **Fail closed.** Every one of these refuses: no token, a bad signature, the + wrong issuer, the wrong audience, a `worker-for-actor` subject, another + atespace, actor or UID, an expired or too-long token, a kick that is not + live, another repository or branch, and a cluster without the + ClusterTrustBundle projection (the broker does not start). If the broker + is not running or the agent's atespace is not the broker's, the kick runs + phase 2. +- **Gateway hop (optional, flagged).** `require_gateway_svid` makes the broker + require that the TLS client certificate is atenet-egress's pod SVID + (`spiffe://cluster.local/ns/ate-system/sa/atenet-egress`, verified against + the podidentity ClusterTrustBundle). Substrate v1.0's gateway re-originates + the upstream leg with no client certificate and trusts only the public + WebPKI roots. So the flag is off by default, and turning it on refuses + every request until a Substrate release originates with the SVID. For the + same reason the broker host needs a publicly trusted certificate. + +Configuration and the operator runbook are in +[deploy/substrate.md](https://github.com/hivecommons/hive/blob/v5/src/deploy/substrate.md#phase-3-the-broker-opt-in-per-agent). + ### Cluster prerequisites and which hive clusters qualify Substrate's real requirement is **not** a kernel floor: the gVisor class runs @@ -285,14 +360,22 @@ Substrate's real requirement is **not** a kernel floor: the gVisor class runs microVM class needs `/dev/kvm` (nested virtualisation on cloud shapes). Both need the operator (`ate-setup deploy ate-system`: Control API, `atelet` DaemonSet, `atenet-router`, podcert controller, PostgreSQL, snapshot object -storage) and Kubernetes with the `ClusterTrustBundle`, -`ClusterTrustBundleProjection` and `PodCertificateRequest` feature gates — still -off by default as of 1.36 — because actor identities are pod certificates. -Survey on 2026-11-11: +storage) and Kubernetes serving the `PodCertificateRequest` and +`ClusterTrustBundle` APIs, because the identities of hive, the router and the +workers are pod certificates. They are GA under `certificates.k8s.io/v1` and +on by default from Kubernetes 1.37; on 1.35 to 1.36 they are beta and need the +`ClusterTrustBundle`, `ClusterTrustBundleProjection` and +`PodCertificateRequest` feature gates plus `certificates.k8s.io/v1beta1`, which +managed control planes typically enable only through a provider support +request. On 1.34 `PodCertificateRequest` is alpha (`v1alpha1`) only, which is +not enough. The pinned Substrate release must support the served API version +and the Kubernetes minor version. The preflight accepts either version. +Survey on 2026-11-11 (since then one hosted cluster has moved to 1.37 and +serves the `v1` APIs; #17933): | cluster | kernel / Kubernetes | `gvisor` class | `microvm` class | |---|---|---|---| -| hive-oke | OL9, UEK8 6.12, k8s 1.34.10 | yes once the feature gates are on (OKE control plane: needs a support request or a self-managed control plane) | needs KVM-capable (bare-metal or nested-virt) shapes | +| hive-oke | OL9, UEK8 6.12, k8s 1.34.10 | yes once on Kubernetes ≥ 1.37, or ≥ 1.35 with the feature gates on (OKE control plane: needs a support request or a self-managed control plane) | needs KVM-capable (bare-metal or nested-virt) shapes | | lke648397, hive-ci | Debian 13, 6.12 | yes; LKE exposes no control-plane flags, so the podcert gates are the blocker — check with `kubectl get --raw /metrics \| grep kubernetes_feature_enabled` | KVM to confirm per plan | | vllm-d, a-ks-wec2 | RHCOS 9.x, 5.14 | possible: the kernel is fine, but the worker's `SYS_ADMIN`/`NET_ADMIN` needs an SCC and the gates a `FeatureGate` CR (TechPreviewNoUpgrade) | only on KVM-capable nodes | diff --git a/docs/content/hive/agent-configuration.md b/docs/content/hive/agent-configuration.md index 4c709971..5ac5b40f 100644 --- a/docs/content/hive/agent-configuration.md +++ b/docs/content/hive/agent-configuration.md @@ -951,6 +951,18 @@ Names compare case-insensitively; an empty `backend:` (the hive default) is alwa When reconciliation changes a gateway-routed agent's model, the log identifies the previous value as `old_model` and the replacement as `gateway_model`. - **`PUT /api/config/agent/{name}/models`** rejects a placement onto a disallowed backend with `400` and a message naming it. +### Switching many agents at once (Governor bulk switch) + +To move several agents to another provider or model — for example claude ↔ copilot and back — open **Settings → Governor → Agents**, tick the agents (the header checkbox selects every agent matching the filter box), and use the action bar: **Switch backend…**, **Switch model…** or **Undo last switch**. The dialog lists each agent's current backend/model → new backend/model with a per-agent verdict before anything is written; **Apply** changes only the valid rows, and rejected rows (disallowed or unauthenticated backend, a model the target backend does not offer) are listed with the reason rather than skipped silently. When the target backend has an equivalent of the agent's current model (Claude ids are rewritten between the claude and copilot spellings), it is kept; otherwise pick a model, or leave it empty to keep the model where valid. + +```text +POST /api/config/agents/bulk-models {"agents": ["scanner","architect"], "backend": "copilot", "model": "", "dry_run": true} +POST /api/config/agents/bulk-models {"undo": true} +GET /api/config/agents/bulk-models/last +``` + +The endpoint is owner-only and runs every agent through the same validation as `PUT /api/config/agent/{name}/models`, including the `backends.allow`/`deny` list, so results match a single edit. The config is saved once and each changed agent is applied live without a restart of the hive; as with the single endpoint, an agent whose backend or model changed is restarted, so a kick in flight is interrupted rather than finished on the old backend. Each changed agent gets an `agent_models_bulk` audit entry with before and after. The previous assignment of the last switch is stored in `/data/bulk-models-last.json`; **Undo last switch** restores exactly those agents and is itself recorded, so pressing it again switches forward again. + ### Changing backend and model together: use the atomic endpoint Three API routes can change an agent's method or model. If you are changing **both**, use the single atomic one: diff --git a/docs/content/hive/ai-contribution-policy.md b/docs/content/hive/ai-contribution-policy.md new file mode 100644 index 00000000..d2ccd2e6 --- /dev/null +++ b/docs/content/hive/ai-contribution-policy.md @@ -0,0 +1,113 @@ +> **Synced from Hive.** This page is pulled from [hivecommons/hive@v5](https://github.com/hivecommons/hive/blob/v5/src/docs/ai-contribution-policy.md) during the docs build. Edit the canonical source in the Hive repository. + +# AI contribution policy template + +Last reviewed: 2026-11-30 + +Hive ships a template that any project can use to write its own AI +contribution policy, whether or not it runs a hive. Hive Commons uses the +same structure for its own +[org-wide policy](https://github.com/hivecommons/.github/blob/main/AI_POLICY.md). + +## Why have one + +The Linux Foundation's 2026 report *Navigating Open Source Software +Development in the Generative AI Era* found that only about a third of open +source projects have a formal policy permitting AI-assisted contributions. +Where projects do have policies, most cover disclosure and contributor review +responsibility (76% each). Far fewer cover licensing and copyright (39%), and +almost none cover required tooling (6%). The report recommends that projects: + +- write the policy down rather than rely on informal norms; +- require disclosure, and make it consistent rather than left to each + contributor; +- make contributors review and test AI output before they submit it. + +The template covers all of these and adds a section on agent autonomy. Agent +autonomy is what changes most between a project that only accepts +AI-assisted human PRs and a project that runs agents itself. + +## What is in the template + +The template is at +[`src/docs/templates/AI_POLICY.template.md`](https://github.com/hivecommons/hive/blob/v5/src/docs/templates/AI_POLICY.template.md). +Its eleven short sections are: + +1. Scope +2. What is allowed +3. Disclosure: a note in the PR description, with an optional commit + trailer +4. Human responsibility +5. DCO and sign-off +6. Licensing and copyright, stated as facts and pointing to the LF guidance +7. Security reports +8. Quality expectations +9. Handling non-compliant PRs +10. Agent autonomy: choose one ACMM block +11. Review cadence + +## How to use it + +1. Copy the template. Save it as `AI_POLICY.md` in your repository root, or + in your organization's `.github` repository so it applies to every + repository. +2. Replace each placeholder written in double curly braces, such as the + project name, license and security policy link. +3. In section 10, keep the one block that matches how you run agents and + delete the others: + - **Option A:** you run no agents of your own. + - **Option B:** ACMM L1 or L2. Agents only observe, advise and post + comment-only reviews. + - **Option C:** ACMM L3 to L5. Agents open PRs, every agent PR is held, and + a person releases the hold and merges. + - **Option D:** ACMM L6. Eligible agent PRs merge on green CI in the + repositories you list. + + See the [ACMM policy matrix](/docs/hive/acmm-policy-matrix) for what each level + enables in Hive. +4. In section 5, choose how agents sign off. Either agents sign only their + own commits under a bot identity, as Hive does, or a person reviews and + signs every agent commit. +5. Link the policy from `CONTRIBUTING.md`. +6. Revisit it when you change your hive's ACMM level. Moving from option C to + option D changes who is accountable for merges. + +## Disclosure in Hive + +Both the Hive Commons policy and the template put disclosure in the PR +description. A hive's agents open PRs through the hive's GitHub App (see +[hive-open-pr](https://github.com/hivecommons/hive/blob/v5/src/docs/hive-open-pr.md)), so agent authorship is visible on every +PR. The PR description ends with a footer naming the agent, backend and +model, for example `-- hive: agent=quality backend=claude model=MODEL`. +The `governor.attribution_trailer` setting controls the footer, and it is on +by default. PRs sent through the contributor relay carry the same footer. +Comments and review replies an agent posts (`gh pr comment`, a reply in a +review thread, a review body) end with the same trailer, applied by the GitHub +proxy from the calling agent's identity. A trailer the agent wrote itself is +replaced, and the trailer sits above the identity footer when there is one. +Each agent signs off only the commits it authored, and credits issue authors with +`Co-authored-by`, never with a sign-off. + +A project may also choose a commit trailer. The template's disclosure +section has an optional line for one. For context: in 2026 the Linux kernel +documented an `Assisted-by:` commit trailer, later dropped the model name +from it, and then removed it in favor of disclosure in the cover letter or +PR description. Kubernetes asks for disclosure in the PR description and +does not use AI trailers. + +## Sources + +- Linux Foundation, + [Guidance Regarding Use of Generative AI Tools for Open Source Software Development](https://www.linuxfoundation.org/legal/generative-ai). +- Linux kernel, + [AI Coding Assistants](https://docs.kernel.org/process/coding-assistants.html) + and [tool-generated content](https://docs.kernel.org/process/generated-content.html). +- Project policies used for structure: + [curl](https://curl.se/dev/contribute.html), + [Kubernetes](https://www.kubernetes.dev/docs/guide/pull-requests/), and + [QEMU](https://www.qemu.org/docs/master/devel/code-provenance.html) and + [Gentoo](https://wiki.gentoo.org/wiki/Project:Council/AI_policy), which + ban AI-generated contributions. +- CNCF has no separate foundation-wide AI policy at the time of writing + ([cncf/foundation#1285](https://github.com/cncf/foundation/issues/1285)). +- The ACMM paper: [arXiv 2604.09388](https://arxiv.org/abs/2604.09388). diff --git a/docs/content/hive/api-reference/auth.md b/docs/content/hive/api-reference/auth.md index f8af5021..12010ff5 100644 --- a/docs/content/hive/api-reference/auth.md +++ b/docs/content/hive/api-reference/auth.md @@ -7,13 +7,13 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/gh-auth` | Dashboard auth/session | GitHub Auth | `pkg/dashboard/api.go:171` | -| `GET` | `/api/gh-rate-limits` | Dashboard auth/session | GitHub Rate Limits | `pkg/dashboard/api.go:172` | -| `GET` | `/api/gh-user-auth/status` | Public | GitHub User Auth Status | `pkg/dashboard/api.go:173` | -| `POST` | `/api/gh-user-auth/start` | Public | GitHub User Auth Start | `pkg/dashboard/api.go:174` | -| `POST` | `/api/gh-user-auth/poll` | Public | GitHub User Auth Poll | `pkg/dashboard/api.go:175` | -| `POST` | `/api/gh-user-auth/logout` | Public | GitHub User Auth Logout | `pkg/dashboard/api.go:176` | -| `GET` | `/api/gh-user-auth/session` | Public | GitHub User Auth Session | `pkg/dashboard/api.go:177` | +| `GET` | `/api/gh-auth` | Dashboard auth/session | GitHub Auth | `pkg/dashboard/api.go:172` | +| `GET` | `/api/gh-rate-limits` | Dashboard auth/session | GitHub Rate Limits | `pkg/dashboard/api.go:173` | +| `GET` | `/api/gh-user-auth/status` | Public | GitHub User Auth Status | `pkg/dashboard/api.go:174` | +| `POST` | `/api/gh-user-auth/start` | Public | GitHub User Auth Start | `pkg/dashboard/api.go:175` | +| `POST` | `/api/gh-user-auth/poll` | Public | GitHub User Auth Poll | `pkg/dashboard/api.go:176` | +| `POST` | `/api/gh-user-auth/logout` | Public | GitHub User Auth Logout | `pkg/dashboard/api.go:177` | +| `GET` | `/api/gh-user-auth/session` | Public | GitHub User Auth Session | `pkg/dashboard/api.go:178` | | `GET` | `/api/claude-auth/status` | Dashboard auth/session | Claude Auth Status | `pkg/dashboard/claude_auth.go:54` | | `POST` | `/api/claude-auth/start` | Dashboard auth/session | Claude Auth Start | `pkg/dashboard/claude_auth.go:55` | | `POST` | `/api/claude-auth/exchange` | Dashboard auth/session | Claude Auth Exchange | `pkg/dashboard/claude_auth.go:56` | @@ -26,12 +26,12 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | `GET` | `/api/openrouter/models` | Dashboard auth/session | Open Router Models | `pkg/dashboard/openrouter.go:47` | | `GET` | `/api/openrouter/credit` | Dashboard auth/session | Open Router Credit | `pkg/dashboard/openrouter.go:48` | | `GET` | `/openrouter/callback` | Public | Open Router Callback | `pkg/dashboard/openrouter.go:49` | -| `POST` | `/api/github-app/recheck` | Dashboard auth/session | GitHub App Recheck | `pkg/dashboard/server.go:1861` | -| `POST` | `/api/github-app/install-clicked` | Dashboard auth/session | GitHub App Install Clicked | `pkg/dashboard/server.go:1862` | -| `GET` | `/gh-setup` | Public | GitHub App Setup Callback | `pkg/dashboard/server.go:1863` | -| `GET` | `/api/github-owner-identity` | Owner only | The hive owner's GitHub identity for remote repos ([#18197](https://github.com/hivecommons/hive/issues/18197)): `connected`, `login`, `scope`, `connected_at`, `usable`, `reason`, `verified_at`, `scope_required` (`public_repo`), `private_repos_supported` (false) and `file` (the token file path on the spoke). Never the token | `pkg/dashboard/api.go:591` | -| `POST` | `/api/github-owner-identity/start` | Owner only | Start the consent: a GitHub device flow with the spoke's `oauth_client_id` asking for `public_repo`, separate from the scope-free login flow. Returns `user_code`, `verification_uri`, `expires_in`, `interval`, `scope` and the `flow_id` the poll must present. 502 when GitHub refused the device-code request | `pkg/dashboard/api.go:592` | -| `POST` | `/api/github-owner-identity/poll` | Owner only | Poll the consent with `{"flow_id"}`: `status` `pending` / `slow_down` (poll again), `complete` (with `login` and the identity) or `error`. On completion the granted scope must cover `public_repo`, the token must validate and the account must be the logged-in owner's; the identity is then stored on the spoke (`/data/secrets/github-owner-token`, `HIVE_GITHUB_OWNER_TOKEN_FILE` overrides) and the reference-repo policies re-resolve. 400 without a live flow or with the wrong `flow_id`; audited as `github_owner_identity_connected` / `_rejected` | `pkg/dashboard/api.go:593` | -| `DELETE` | `/api/github-owner-identity` | Owner only | Disconnect: removes the token file, drops every write-tier reference repo to read-only on the next pass, returns the previous `login` and a `note` that GitHub-side revocation is done under Settings → Applications on github.com; audited as `github_owner_identity_disconnected` | `pkg/dashboard/api.go:594` | -| `GET` | `/api/github-token` | Owner only | PAT status for PAT-mode hives ([#19633](https://github.com/hivecommons/hive/issues/19633)): `mode` (`pat` / `app`), `rotatable`, `configured`, `fingerprint` (the sha256 prefix `/api/config/export` shows) and, when this process verified the token, `login` and `verified_at`. Never the token | `pkg/dashboard/api.go:597` | -| `PUT` | `/api/github-token` | Owner only | Rotate the PAT without a restart with `{"token"}`. Verified against `github.api_url` first (`GET /user`, read access to every `project.repos` entry, the boot scope check for the current ACMM level); a failure is 422 and nothing changes. A verified token is saved through the normal keystore-sealed config save, adopted as a new PAT client, and running agents get fresh credentials. Returns the GET body plus `sealed` (true when the saved token is a keystore envelope; false when it was written as plaintext, in which case the config file is kept owner-only, 0600). Needs `Content-Type: application/json` (415 otherwise) and refuses `Sec-Fetch-Site: cross-site` (403). 409 when `github.app_id` is set (rechecked under the GitHub config lock); 500 when the config has no source path, so the token would not survive a restart. After a rejected token, further attempts get 429 with `Retry-After` for 15 seconds (`HIVE_GITHUB_TOKEN_REJECT_COOLDOWN`, a Go duration, `0` turns it off). Audited as `github_token_rotated` / `github_token_rejected` by fingerprint | `pkg/dashboard/api.go:598` | +| `POST` | `/api/github-app/recheck` | Dashboard auth/session | GitHub App Recheck | `pkg/dashboard/server.go:1865` | +| `POST` | `/api/github-app/install-clicked` | Dashboard auth/session | GitHub App Install Clicked | `pkg/dashboard/server.go:1866` | +| `GET` | `/gh-setup` | Public | GitHub App Setup Callback | `pkg/dashboard/server.go:1867` | +| `GET` | `/api/github-owner-identity` | Owner only | The hive owner's GitHub identity for remote repos ([#18197](https://github.com/hivecommons/hive/issues/18197)): `connected`, `login`, `scope`, `connected_at`, `usable`, `reason`, `verified_at`, `scope_required` (`public_repo`), `private_repos_supported` (false) and `file` (the token file path on the spoke). Never the token | `pkg/dashboard/api.go:594` | +| `POST` | `/api/github-owner-identity/start` | Owner only | Start the consent: a GitHub device flow with the spoke's `oauth_client_id` asking for `public_repo`, separate from the scope-free login flow. Returns `user_code`, `verification_uri`, `expires_in`, `interval`, `scope` and the `flow_id` the poll must present. 502 when GitHub refused the device-code request | `pkg/dashboard/api.go:595` | +| `POST` | `/api/github-owner-identity/poll` | Owner only | Poll the consent with `{"flow_id"}`: `status` `pending` / `slow_down` (poll again), `complete` (with `login` and the identity) or `error`. On completion the granted scope must cover `public_repo`, the token must validate and the account must be the logged-in owner's; the identity is then stored on the spoke (`/data/secrets/github-owner-token`, `HIVE_GITHUB_OWNER_TOKEN_FILE` overrides) and the reference-repo policies re-resolve. 400 without a live flow or with the wrong `flow_id`; audited as `github_owner_identity_connected` / `_rejected` | `pkg/dashboard/api.go:596` | +| `DELETE` | `/api/github-owner-identity` | Owner only | Disconnect: removes the token file, drops every write-tier reference repo to read-only on the next pass, returns the previous `login` and a `note` that GitHub-side revocation is done under Settings → Applications on github.com; audited as `github_owner_identity_disconnected` | `pkg/dashboard/api.go:597` | +| `GET` | `/api/github-token` | Owner only | PAT status for PAT-mode hives ([#19633](https://github.com/hivecommons/hive/issues/19633)): `mode` (`pat` / `app`), `rotatable`, `configured`, `fingerprint` (the sha256 prefix `/api/config/export` shows) and, when this process verified the token, `login` and `verified_at`. Never the token | `pkg/dashboard/api.go:600` | +| `PUT` | `/api/github-token` | Owner only | Rotate the PAT without a restart with `{"token"}`. Verified against `github.api_url` first (`GET /user`, read access to every `project.repos` entry, the boot scope check for the current ACMM level); a failure is 422 and nothing changes. A verified token is saved through the normal keystore-sealed config save, adopted as a new PAT client, and running agents get fresh credentials. Returns the GET body plus `sealed` (true when the saved token is a keystore envelope; false when it was written as plaintext, in which case the config file is kept owner-only, 0600). Needs `Content-Type: application/json` (415 otherwise) and refuses `Sec-Fetch-Site: cross-site` (403). 409 when `github.app_id` is set (rechecked under the GitHub config lock); 500 when the config has no source path, so the token would not survive a restart. After a rejected token, further attempts get 429 with `Retry-After` for 15 seconds (`HIVE_GITHUB_TOKEN_REJECT_COOLDOWN`, a Go duration, `0` turns it off). Audited as `github_token_rotated` / `github_token_rejected` by fingerprint | `pkg/dashboard/api.go:601` | diff --git a/docs/content/hive/api-reference/beads.md b/docs/content/hive/api-reference/beads.md index 24509353..67857ef9 100644 --- a/docs/content/hive/api-reference/beads.md +++ b/docs/content/hive/api-reference/beads.md @@ -7,8 +7,8 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/beads` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:499` | -| `GET` | `/api/beads/{agent}` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:500` | -| `POST` | `/api/beads/{agent}` | Owner only | Beads Create | `pkg/dashboard/api.go:501` | -| `POST` | `/api/beads/reset` | Owner only | Beads Reset | `pkg/dashboard/api.go:502` | -| `POST` | `/api/beads/reset/{agent}` | Owner only | Beads Reset Agent | `pkg/dashboard/api.go:503` | +| `GET` | `/api/beads` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:502` | +| `GET` | `/api/beads/{agent}` | Dashboard auth/session | Beads List | `pkg/dashboard/api.go:503` | +| `POST` | `/api/beads/{agent}` | Owner only | Beads Create | `pkg/dashboard/api.go:504` | +| `POST` | `/api/beads/reset` | Owner only | Beads Reset | `pkg/dashboard/api.go:505` | +| `POST` | `/api/beads/reset/{agent}` | Owner only | Beads Reset Agent | `pkg/dashboard/api.go:506` | diff --git a/docs/content/hive/api-reference/configuration.md b/docs/content/hive/api-reference/configuration.md index 793e1dad..04143d2a 100644 --- a/docs/content/hive/api-reference/configuration.md +++ b/docs/content/hive/api-reference/configuration.md @@ -15,13 +15,13 @@ JSON, see [Editing `hive.yaml`](/docs/hive/editing-hive-yaml#view-yaml-or-export | `GET` | `/api/config` | Dashboard auth/session | Config | `pkg/dashboard/api.go:53` | | `GET` | `/api/config/triggers` | Verified owner only | Ordered Event triggers, opaque `version`/ETag, existing agents and managed repository values/labels; applies on next evaluation without restart | `pkg/dashboard/api_event_triggers.go` | | `PUT` | `/api/config/triggers` | Verified owner only | Compile-to-bool and durably compare-and-save `{rules:[{name,agent,expr,priority}],preset?:{index,kind,repo}}`; exact `If-Match` required (428 missing, 412 stale), validation 400, persistence failure 500 leaves live rules unchanged. No enabled field or source/webhook installation | `pkg/dashboard/api_event_triggers.go` | -| `GET` | `/api/config/dashboard` | Owner only | Dashboard runtime settings (`dashboard.*`): port, agent poll interval, `experiment_lab`, `subscription_gauge_header`, hub-proxied auth, whether an auth token is configured (never the token), access allowlist, issue bands and stage-tracker toast timings | `pkg/dashboard/api.go:204` | -| `PUT` | `/api/config/dashboard` | Owner only | Update any subset of those fields (an absent field is unchanged), including `subscription_gauge_header` (adds the owner-only usage gauge chip to the header, covering every plan the agents spend: Claude, Copilot and others); validated, saved and audit-logged as `config_dashboard_settings` | `pkg/dashboard/api.go:205` | +| `GET` | `/api/config/dashboard` | Owner only | Dashboard runtime settings (`dashboard.*`): port, agent poll interval, `experiment_lab`, `subscription_gauge_header`, hub-proxied auth, whether an auth token is configured (never the token), access allowlist, issue bands and stage-tracker toast timings | `pkg/dashboard/api.go:207` | +| `PUT` | `/api/config/dashboard` | Owner only | Update any subset of those fields (an absent field is unchanged), including `subscription_gauge_header` (adds the owner-only usage gauge chip to the header, covering every plan the agents spend: Claude, Copilot and others); validated, saved and audit-logged as `config_dashboard_settings` | `pkg/dashboard/api.go:208` | | `GET` | `/api/config/dashboard/theme` | Owner only | Dashboard theme selection, overrides, effective theme, and built-in catalog | `pkg/dashboard/api.go:62` | | `PUT` | `/api/config/dashboard/theme` | Owner only | Persist `dashboard.theme` and `dashboard.theme_overrides` with validation, CSS/background guardrails, and audit logging | `pkg/dashboard/api.go:63` | | `GET` | `/api/config/download` | Owner only | Config Download | `pkg/dashboard/api.go:54` | -| `GET` | `/api/config/sla` | Owner only | Delivery SLA targets: `{targets:{start_to_pr_h,pr_to_merge_h,open_to_merge_h}, effective_targets:{...}, defaults:{...}}`, hours, from `sla.targets` in `hive.yaml` with defaults 4/24/72 | `pkg/dashboard/api.go:253` | -| `PUT` | `/api/config/sla` | Owner only | Replace `sla.targets` (`{targets:{start_to_pr_h,pr_to_merge_h,open_to_merge_h}}`; each 0 (default) to 8760, validated before anything is persisted); the Throughput Delivery SLA panel recolours on the next status poll | `pkg/dashboard/api.go:254` | +| `GET` | `/api/config/sla` | Owner only | Delivery SLA targets: `{targets:{start_to_pr_h,pr_to_merge_h,open_to_merge_h}, effective_targets:{...}, defaults:{...}}`, hours, from `sla.targets` in `hive.yaml` with defaults 4/24/72 | `pkg/dashboard/api.go:256` | +| `PUT` | `/api/config/sla` | Owner only | Replace `sla.targets` (`{targets:{start_to_pr_h,pr_to_merge_h,open_to_merge_h}}`; each 0 (default) to 8760, validated before anything is persisted); the Throughput Delivery SLA panel recolours on the next status poll | `pkg/dashboard/api.go:257` | | `GET` | `/api/config/export` | Owner only | Redacted JSON export of the effective config, layer files, side files, and provenance | `pkg/dashboard/api_config_export.go` | | `GET` | `/api/config/provenance` | Owner only | Config Provenance | `pkg/dashboard/api.go:57` | | `GET` | `/api/config/variables` | Dashboard auth/session | Variables List | `pkg/dashboard/api.go:58` | @@ -29,118 +29,120 @@ JSON, see [Editing `hive.yaml`](/docs/hive/editing-hive-yaml#view-yaml-or-export | `PUT` | `/api/config/variables/{name}` | Owner only | Variable Upsert | `pkg/dashboard/api.go:64` | | `DELETE` | `/api/config/variables/{name}` | Owner only | Variable Delete | `pkg/dashboard/api.go:65` | -| `GET` | `/api/config/agent/{name}` | Dashboard auth/session | Agent Config Get | `pkg/dashboard/api.go:186` | -| `PUT` | `/api/config/agent/{name}/general` | Owner only | Agent Config General | `pkg/dashboard/api.go:187` | -| `PUT` | `/api/config/agent/{name}/cadences` | Owner only | Agent Config Cadences | `pkg/dashboard/api.go:188` | -| `PUT` | `/api/config/agent/{name}/models` | Owner only | Agent Config Models | `pkg/dashboard/api.go:189` | -| `PUT` | `/api/config/agent/{name}/pipeline` | Owner only | Agent Config Pipeline | `pkg/dashboard/api.go:190` | -| `PUT` | `/api/config/agent/{name}/hooks` | Owner only | Agent Config Hooks | `pkg/dashboard/api.go:191` | -| `PUT` | `/api/config/agent/{name}/restrictions` | Owner only | Agent Config Restrictions | `pkg/dashboard/api.go:192` | -| `PUT` | `/api/config/agent/{name}/stats` | Owner only | Agent Config Stats | `pkg/dashboard/api.go:193` | -| `GET` | `/api/config/agent/{name}/prompt` | Dashboard auth/session | Agent Prompt | `pkg/dashboard/api.go:194` | -| `PUT` | `/api/config/agent/{name}/prompt` | Owner only | Agent Prompt Save | `pkg/dashboard/api.go:195` | -| `GET` | `/api/config/agent/{name}/export` | Dashboard auth/session | Agent Export | `pkg/dashboard/api.go:196` | -| `PUT` | `/api/config/agent/{name}/channels` | Owner only | Agent Config Channels | `pkg/dashboard/api.go:197` | -| `PUT` | `/api/config/agent/{name}/tools` | Owner only | Agent Config Tools | `pkg/dashboard/api.go:198` | -| `PUT` | `/api/config/agent/{name}/connections` | Owner only | Agent Config Connections | `pkg/dashboard/api.go:199` | +| `GET` | `/api/config/agent/{name}` | Dashboard auth/session | Agent Config Get | `pkg/dashboard/api.go:187` | +| `PUT` | `/api/config/agent/{name}/general` | Owner only | Agent Config General | `pkg/dashboard/api.go:188` | +| `PUT` | `/api/config/agent/{name}/cadences` | Owner only | Agent Config Cadences | `pkg/dashboard/api.go:189` | +| `PUT` | `/api/config/agent/{name}/models` | Owner only | Agent Config Models | `pkg/dashboard/api.go:190` | +| `POST` | `/api/config/agents/bulk-models` | Owner only | Bulk switch backend/model (dry run, undo) | `pkg/dashboard/api.go:191` | +| `GET` | `/api/config/agents/bulk-models/last` | Any | Previous assignment of the last bulk switch | `pkg/dashboard/api.go:192` | +| `PUT` | `/api/config/agent/{name}/pipeline` | Owner only | Agent Config Pipeline | `pkg/dashboard/api.go:193` | +| `PUT` | `/api/config/agent/{name}/hooks` | Owner only | Agent Config Hooks | `pkg/dashboard/api.go:194` | +| `PUT` | `/api/config/agent/{name}/restrictions` | Owner only | Agent Config Restrictions | `pkg/dashboard/api.go:195` | +| `PUT` | `/api/config/agent/{name}/stats` | Owner only | Agent Config Stats | `pkg/dashboard/api.go:196` | +| `GET` | `/api/config/agent/{name}/prompt` | Dashboard auth/session | Agent Prompt | `pkg/dashboard/api.go:197` | +| `PUT` | `/api/config/agent/{name}/prompt` | Owner only | Agent Prompt Save | `pkg/dashboard/api.go:198` | +| `GET` | `/api/config/agent/{name}/export` | Dashboard auth/session | Agent Export | `pkg/dashboard/api.go:199` | +| `PUT` | `/api/config/agent/{name}/channels` | Owner only | Agent Config Channels | `pkg/dashboard/api.go:200` | +| `PUT` | `/api/config/agent/{name}/tools` | Owner only | Agent Config Tools | `pkg/dashboard/api.go:201` | +| `PUT` | `/api/config/agent/{name}/connections` | Owner only | Agent Config Connections | `pkg/dashboard/api.go:202` | | `GET` | `/api/config/agent/{name}/variables` | Dashboard auth/session | Per-agent Variables tab: the agent's own `${VAR}` definitions plus the hive-level ones it inherits (each flagged `overridden` when the agent redefines it) and the seed-only exec/http gate flags. Never returns values — only name, type, scope and a non-secret source hint | `pkg/dashboard/api_variables.go:298` | | `PUT` | `/api/config/agent/{name}/variables/{var}` | Owner only | Create or update one per-agent variable (`static`/`env` only; `script`/`http` are 403 and seed-only; scope `template` or `both`; secret-looking static values rejected). Persisted on the agent entry; overrides a same-named hive-level variable in this agent's kick prompt | `pkg/dashboard/api_variables.go:299` | | `DELETE` | `/api/config/agent/{name}/variables/{var}` | Owner only | Delete one per-agent variable (404 for inherited hive-level variables — delete those via `/api/config/variables/{name}`) | `pkg/dashboard/api_variables.go:300` | -| `GET` | `/api/config/stat-sources` | Dashboard auth/session | Stat Sources | `pkg/dashboard/api.go:200` | -| `GET` | `/api/config/governor` | Dashboard auth/session | Governor Config Get | `pkg/dashboard/api.go:202` | +| `GET` | `/api/config/stat-sources` | Dashboard auth/session | Stat Sources | `pkg/dashboard/api.go:203` | +| `GET` | `/api/config/governor` | Dashboard auth/session | Governor Config Get | `pkg/dashboard/api.go:205` | | `PATCH` | `/api/config/governor` | Owner only | Update `merge_train_stall_warn_s`; omitted values stay unchanged, 0 disables warnings; returns the effective interval | `pkg/dashboard/api_governor_merge_train.go` | -| `PUT` | `/api/config/governor/sensing` | Owner only | Governor Sensing | `pkg/dashboard/api.go:206` | -| `PUT` | `/api/config/governor/thresholds` | Owner only | Governor Thresholds | `pkg/dashboard/api.go:207` | -| `PUT` | `/api/config/governor/labels` | Owner only | Governor Labels | `pkg/dashboard/api.go:214` | -| `PUT` | `/api/config/governor/budget` | Owner only | Governor Budget | `pkg/dashboard/api.go:215` | -| `PUT` | `/api/config/governor/notifications` | Owner only | Governor Notifications | `pkg/dashboard/api.go:219` | -| `PUT` | `/api/config/governor/health` | Owner only | Governor Health | `pkg/dashboard/api.go:220` | -| `PUT` | `/api/config/governor/logging` | Owner only | Governor Logging | `pkg/dashboard/api.go:232` | -| `PUT` | `/api/config/governor/attribution` | Owner only | Governor Attribution | `pkg/dashboard/api.go:233` | -| `PUT` | `/api/config/governor/hub` | Owner only | Governor Hub | `pkg/dashboard/api.go:234` | -| `PUT` | `/api/config/governor/litellm` | Owner only | Governor Lite LLM | `pkg/dashboard/api.go:235` | -| `PUT` | `/api/config/governor/trajectory` | Owner only | Governor Trajectory | `pkg/dashboard/api.go:236` | +| `PUT` | `/api/config/governor/sensing` | Owner only | Governor Sensing | `pkg/dashboard/api.go:209` | +| `PUT` | `/api/config/governor/thresholds` | Owner only | Governor Thresholds | `pkg/dashboard/api.go:210` | +| `PUT` | `/api/config/governor/labels` | Owner only | Governor Labels | `pkg/dashboard/api.go:217` | +| `PUT` | `/api/config/governor/budget` | Owner only | Governor Budget | `pkg/dashboard/api.go:218` | +| `PUT` | `/api/config/governor/notifications` | Owner only | Governor Notifications | `pkg/dashboard/api.go:222` | +| `PUT` | `/api/config/governor/health` | Owner only | Governor Health | `pkg/dashboard/api.go:223` | +| `PUT` | `/api/config/governor/logging` | Owner only | Governor Logging | `pkg/dashboard/api.go:235` | +| `PUT` | `/api/config/governor/attribution` | Owner only | Governor Attribution | `pkg/dashboard/api.go:236` | +| `PUT` | `/api/config/governor/hub` | Owner only | Governor Hub | `pkg/dashboard/api.go:237` | +| `PUT` | `/api/config/governor/litellm` | Owner only | Governor Lite LLM | `pkg/dashboard/api.go:238` | +| `PUT` | `/api/config/governor/trajectory` | Owner only | Governor Trajectory | `pkg/dashboard/api.go:239` | | `GET` | `/api/config/governor/backup` | Owner only | Backup Key Status (presence + safe source label; never the key value) | `pkg/dashboard/backup_key.go` | | `PUT` | `/api/config/governor/backup` | Owner only | Backup Key Set (64-hex AES-256 key; stored 0600, path-only in `hive.yaml`) | `pkg/dashboard/backup_key.go` | | `DELETE` | `/api/config/governor/backup` | Owner only | Backup Key Clear (backups are refused again) | `pkg/dashboard/backup_key.go` | -| `GET` | `/api/config/governor/bob` | Dashboard auth/session | Governor Bob Status | `pkg/dashboard/api.go:282` | -| `PUT` | `/api/config/governor/bob` | Owner only | Governor Bob Key | `pkg/dashboard/api.go:283` | -| `DELETE` | `/api/config/governor/bob` | Owner only | Governor Bob Key Clear | `pkg/dashboard/api.go:284` | +| `GET` | `/api/config/governor/bob` | Dashboard auth/session | Governor Bob Status | `pkg/dashboard/api.go:285` | +| `PUT` | `/api/config/governor/bob` | Owner only | Governor Bob Key | `pkg/dashboard/api.go:286` | +| `DELETE` | `/api/config/governor/bob` | Owner only | Governor Bob Key Clear | `pkg/dashboard/api.go:287` | -| `GET` | `/api/config/governor/cadence-scope` | Owner only | Governor Cadence Scope Get (`aggregate` or `per_repo`) | `pkg/dashboard/api.go:208` | -| `PUT` | `/api/config/governor/cadence-scope` | Owner only | Governor Cadence Scope Set (`cadenceScope`/`cadence_scope`: `aggregate`, `per_repo`, or empty for default) | `pkg/dashboard/api.go:209` | -| `POST` | `/api/config/governor/bob/test` | Dashboard auth/session | Governor Bob Key Test | `pkg/dashboard/api.go:286` | -| `POST` | `/api/config/governor/litellm/test` | Dashboard auth/session | Governor Lite LLMTest | `pkg/dashboard/api.go:287` | -| `GET` | `/api/config/governor/gateways` | Dashboard auth/session | Governor Gateways List | `pkg/dashboard/api.go:290` | -| `PUT` | `/api/config/governor/gateways` | Owner only | Governor Gateways Upsert | `pkg/dashboard/api.go:291` | -| `DELETE` | `/api/config/governor/gateways/{name}` | Owner only | Governor Gateways Delete | `pkg/dashboard/api.go:292` | -| `POST` | `/api/config/governor/gateways/{name}/test` | Dashboard auth/session | Governor Gateways Test | `pkg/dashboard/api.go:293` | -| `POST` | `/api/config/governor/gateways/discover` | Owner only | Governor Gateways Discover | `pkg/dashboard/api.go:294` | -| `POST` | `/api/config/governor/agents` | Owner only | Governor Add Agent | `pkg/dashboard/api.go:300` | -| `DELETE` | `/api/config/governor/agents/{name}` | Owner only | Governor Remove Agent | `pkg/dashboard/api.go:301` | -| `PUT` | `/api/config/governor/repos` | Owner only | Governor Repos | `pkg/dashboard/api.go:302` | -| `POST` | `/api/config/governor/repos/check-access` | Dashboard auth/session | Governor Repo Check Access | `pkg/dashboard/api.go:306` | -| `PUT` | `/api/config/github` | Owner only | Config GitHub | `pkg/dashboard/api.go:307` | -| `GET` | `/api/config/github/forge-apps` | Dashboard auth/session | Config GitHub Forge Apps | `pkg/dashboard/api.go:310` | +| `GET` | `/api/config/governor/cadence-scope` | Owner only | Governor Cadence Scope Get (`aggregate` or `per_repo`) | `pkg/dashboard/api.go:211` | +| `PUT` | `/api/config/governor/cadence-scope` | Owner only | Governor Cadence Scope Set (`cadenceScope`/`cadence_scope`: `aggregate`, `per_repo`, or empty for default) | `pkg/dashboard/api.go:212` | +| `POST` | `/api/config/governor/bob/test` | Dashboard auth/session | Governor Bob Key Test | `pkg/dashboard/api.go:289` | +| `POST` | `/api/config/governor/litellm/test` | Dashboard auth/session | Governor Lite LLMTest | `pkg/dashboard/api.go:290` | +| `GET` | `/api/config/governor/gateways` | Dashboard auth/session | Governor Gateways List | `pkg/dashboard/api.go:293` | +| `PUT` | `/api/config/governor/gateways` | Owner only | Governor Gateways Upsert | `pkg/dashboard/api.go:294` | +| `DELETE` | `/api/config/governor/gateways/{name}` | Owner only | Governor Gateways Delete | `pkg/dashboard/api.go:295` | +| `POST` | `/api/config/governor/gateways/{name}/test` | Dashboard auth/session | Governor Gateways Test | `pkg/dashboard/api.go:296` | +| `POST` | `/api/config/governor/gateways/discover` | Owner only | Governor Gateways Discover | `pkg/dashboard/api.go:297` | +| `POST` | `/api/config/governor/agents` | Owner only | Governor Add Agent | `pkg/dashboard/api.go:303` | +| `DELETE` | `/api/config/governor/agents/{name}` | Owner only | Governor Remove Agent | `pkg/dashboard/api.go:304` | +| `PUT` | `/api/config/governor/repos` | Owner only | Governor Repos | `pkg/dashboard/api.go:305` | +| `POST` | `/api/config/governor/repos/check-access` | Dashboard auth/session | Governor Repo Check Access | `pkg/dashboard/api.go:309` | +| `PUT` | `/api/config/github` | Owner only | Config GitHub | `pkg/dashboard/api.go:310` | +| `GET` | `/api/config/github/forge-apps` | Dashboard auth/session | Config GitHub Forge Apps | `pkg/dashboard/api.go:313` | | `GET` | `/api/config/github/webhooks` | Owner only | Config GitHub Webhooks (payload URL, events, secret source, receiver health, App hook permissions) | `pkg/dashboard/api_github_webhook_setup.go:88` | | `POST` | `/api/config/github/webhooks/secret` | Owner only | Config GitHub Webhooks Generate Secret (returned once) | `pkg/dashboard/api_github_webhook_setup.go:89` | | `POST` | `/api/config/github/webhooks/create` | Owner only | Config GitHub Webhooks Create Hook (through the App installation) | `pkg/dashboard/api_github_webhook_setup.go:90` | -| `GET` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Get | `pkg/dashboard/api.go:370` | -| `PUT` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Set | `pkg/dashboard/api.go:371` | -| `GET` | `/api/config/backends` | Dashboard auth/session | Backends | `pkg/dashboard/api.go:372` | -| `GET` | `/api/compliance/status` | Merger or owner | Evaluated compliance controls for the frameworks in `compliance.frameworks` (`compliance.Report`, JSON): per control `meets`/`deviates`/`off`/`not_covered` with current vs recommended value per mapped setting, a summary, and the non-certification disclaimer — see [Compliance](/docs/hive/security/compliance-controls) ([#11078](https://github.com/hivecommons/hive/issues/11078)) | `pkg/dashboard/api.go:362` | -| `GET` | `/api/compliance/posture` | Merger or owner | Posture-check catalogue, effective interval / window / history retention, and the latest run (`compliance.PostureRun`: schedule/manual trigger, `triggered_by` identity, and per-check `pass`/`fail`/`skip`/`error`, detail, control ids, evidence refs); `?since=` (RFC 3339, `YYYY-MM-DD` or a look-back such as `168h`) adds every run since then, oldest first, capped at 1000 — see [Compliance](/docs/hive/security/compliance-controls#posture-checks-catalogue) ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:363` | -| `POST` | `/api/compliance/posture/run` | Merger or owner | Run the posture checks now, attributed to the authenticated user, and record the pass in the history; audited as `compliance_posture_run`; `409` when no framework is selected or a pass is already running ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:364` | -| `GET` | `/api/compliance/posture/history` | Owner only | Posture history for `?since=`/`?until=` (default the last 30 days) as one series per check: points (`at`, `status`), status counts, `last_fail_at` and the latest result with detail and evidence refs; at most the 1000 most recent runs — see [Compliance](/docs/hive/security/compliance-controls#evidence-exports-and-attestations) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:365` | -| `GET` | `/api/compliance/export` | Owner only | Evidence download for `?since=`/`?until=`: `kind=controls` (`json`/`md`), `posture` (`json`/`csv`), `audit` (`json`), `config` (redacted effective config + sha256, `json`), `attestations` (`json`/`csv`) or `bundle` (`json`). Every format includes source, period, generator, selected profile versions, attesters, retention and a per-section SHA-256 manifest; audited as `compliance_export` with the SHA-256 of the delivered bytes ([#11081](https://github.com/hivecommons/hive/issues/11081), [#13582](https://github.com/hivecommons/hive/issues/13582)) | `pkg/dashboard/api.go:366` | -| `GET` | `/api/compliance/attestations` | Owner only | Owner attestations, newest first (`?framework=` filters) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:367` | -| `POST` | `/api/compliance/attestations` | Owner only | Record `{"framework", "reviewed_on", "note"}` for the signed-in owner; audited as `compliance_attestation`; `201` with the attestation, `400` for an unknown framework, a bad or future date, or a note over 2000 characters ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:368` | -| `PUT` | `/api/config/governor/compliance` | Owner only | Settings → Compliance framework picker: `{"frameworks": [...]}` sets `compliance.frameworks` (empty list deselects all, absent key leaves it unchanged; unknown/duplicate ids are a `400` before any change); audited as `config_compliance`; returns the re-evaluated `compliance.Report` ([#11080](https://github.com/hivecommons/hive/issues/11080)) | `pkg/dashboard/api.go:542` | +| `GET` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Get | `pkg/dashboard/api.go:373` | +| `PUT` | `/api/config/sidebar` | Dashboard auth/session | Sidebar Set | `pkg/dashboard/api.go:374` | +| `GET` | `/api/config/backends` | Dashboard auth/session | Backends | `pkg/dashboard/api.go:375` | +| `GET` | `/api/compliance/status` | Merger or owner | Evaluated compliance controls for the frameworks in `compliance.frameworks` (`compliance.Report`, JSON): per control `meets`/`deviates`/`off`/`not_covered` with current vs recommended value per mapped setting, a summary, and the non-certification disclaimer — see [Compliance](/docs/hive/security/compliance-controls) ([#11078](https://github.com/hivecommons/hive/issues/11078)) | `pkg/dashboard/api.go:365` | +| `GET` | `/api/compliance/posture` | Merger or owner | Posture-check catalogue, effective interval / window / history retention, and the latest run (`compliance.PostureRun`: schedule/manual trigger, `triggered_by` identity, and per-check `pass`/`fail`/`skip`/`error`, detail, control ids, evidence refs); `?since=` (RFC 3339, `YYYY-MM-DD` or a look-back such as `168h`) adds every run since then, oldest first, capped at 1000 — see [Compliance](/docs/hive/security/compliance-controls#posture-checks-catalogue) ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:366` | +| `POST` | `/api/compliance/posture/run` | Merger or owner | Run the posture checks now, attributed to the authenticated user, and record the pass in the history; audited as `compliance_posture_run`; `409` when no framework is selected or a pass is already running ([#11079](https://github.com/hivecommons/hive/issues/11079)) | `pkg/dashboard/api.go:367` | +| `GET` | `/api/compliance/posture/history` | Owner only | Posture history for `?since=`/`?until=` (default the last 30 days) as one series per check: points (`at`, `status`), status counts, `last_fail_at` and the latest result with detail and evidence refs; at most the 1000 most recent runs — see [Compliance](/docs/hive/security/compliance-controls#evidence-exports-and-attestations) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:368` | +| `GET` | `/api/compliance/export` | Owner only | Evidence download for `?since=`/`?until=`: `kind=controls` (`json`/`md`), `posture` (`json`/`csv`), `audit` (`json`), `config` (redacted effective config + sha256, `json`), `attestations` (`json`/`csv`) or `bundle` (`json`). Every format includes source, period, generator, selected profile versions, attesters, retention and a per-section SHA-256 manifest; audited as `compliance_export` with the SHA-256 of the delivered bytes ([#11081](https://github.com/hivecommons/hive/issues/11081), [#13582](https://github.com/hivecommons/hive/issues/13582)) | `pkg/dashboard/api.go:369` | +| `GET` | `/api/compliance/attestations` | Owner only | Owner attestations, newest first (`?framework=` filters) ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:370` | +| `POST` | `/api/compliance/attestations` | Owner only | Record `{"framework", "reviewed_on", "note"}` for the signed-in owner; audited as `compliance_attestation`; `201` with the attestation, `400` for an unknown framework, a bad or future date, or a note over 2000 characters ([#11081](https://github.com/hivecommons/hive/issues/11081)) | `pkg/dashboard/api.go:371` | +| `PUT` | `/api/config/governor/compliance` | Owner only | Settings → Compliance framework picker: `{"frameworks": [...]}` sets `compliance.frameworks` (empty list deselects all, absent key leaves it unchanged; unknown/duplicate ids are a `400` before any change); audited as `config_compliance`; returns the re-evaluated `compliance.Report` ([#11080](https://github.com/hivecommons/hive/issues/11080)) | `pkg/dashboard/api.go:545` | | `GET`/`PUT` | `/api/config/chat/config-assist` | Owner only | Settings → Features → Chat → Config assist panel: GET returns `enabled`, `model`, `fallback_model` (`chat.grounded_answers.model`) and `runner_attached`; PUT `{"enabled": bool, "model": string}` sets `chat.config_assist.enabled` (default off) and `chat.config_assist.model` (empty clears it, falling back to `chat.grounded_answers.model`, then the reviewer model; [#20092](https://github.com/hivecommons/hive/issues/20092)); an absent key leaves it unchanged; `400` for a model id with whitespace or over 200 characters; audited as `config_chat_assist` with before/after values; `409` when the hive has no config source path to persist it ([#19979](https://github.com/hivecommons/hive/issues/19979), [RFC #19788](https://github.com/hivecommons/hive/blob/v5/docs/rfc-19788-hive-chat-config-assist.md)) | `pkg/dashboard/api.go:543` | -| `POST` | `/api/chat/config-proposals/{id}/decline` | Owner only | Dismiss on a Hive Chat config assist proposal card: removes the pending proposal (only the owner who requested it can) and audits `chat_config_declined`; `404` when it is unknown, expired or another user's. With `chat.config_assist.enabled` on, a verified owner's config-shaped chat message gets at most one checked proposal (`config_proposal` on the `/api/chat` reply) whose card opens the agent config dialog pre-filled; that dialog's Save adds `?via=chat&proposal=` to the section PUT, and the server records `via=chat` only for a stored, unexpired proposal of the same user, agent and section ([#19978](https://github.com/hivecommons/hive/issues/19978), [RFC #19788](https://github.com/hivecommons/hive/blob/v5/docs/rfc-19788-hive-chat-config-assist.md)) | `pkg/dashboard/api.go:547` | -| `POST` | `/api/chat/config-proposals/{id}/undo` | Owner only | Undo on an applied Hive Chat config assist card ([#19985](https://github.com/hivecommons/hive/issues/19985)): returns a reverse proposal (`config_proposal` with `reverses`) built from the applied proposal's before value, or from its `chat_config_proposed` audit line after a restart, bound to the section as it is now; nothing is written until the card applies it. `403` with `chat.config_assist.enabled` off, `404` when there is no applied, not yet undone proposal of this user with that id, `409` when the section changed since the Apply. The card's **Apply** (and the Undo it builds) sends the stored body to `PUT /api/config/agent/{name}/{section}` with an `X-Hive-Chat-Proposal: ` header; under the config lock the proposal must be this user's, unexpired, not already in flight or applied, for that agent and section, with the same body and an unchanged section hash, or the PUT answers `409` and changes nothing. A seed-owned key (`github`, `hub`, `variables`, `acmm_level`, `hive_id`), a secret field or anything off the chat allowlist is refused with `403`. A 2xx consumes it and audits `chat_config_applied`; any other status returns it to pending and audits `chat_config_apply_failed`; an applied Undo audits `chat_config_undo`. The applied and undo lines carry value fingerprints (`before_fp`, `after_fp`), never the values | `pkg/dashboard/api.go:550` | +| `POST` | `/api/chat/config-proposals/{id}/decline` | Owner only | Dismiss on a Hive Chat config assist proposal card: removes the pending proposal (only the owner who requested it can) and audits `chat_config_declined`; `404` when it is unknown, expired or another user's. With `chat.config_assist.enabled` on, a verified owner's config-shaped chat message gets at most one checked proposal (`config_proposal` on the `/api/chat` reply) whose card opens the agent config dialog pre-filled; that dialog's Save adds `?via=chat&proposal=` to the section PUT, and the server records `via=chat` only for a stored, unexpired proposal of the same user, agent and section ([#19978](https://github.com/hivecommons/hive/issues/19978), [RFC #19788](https://github.com/hivecommons/hive/blob/v5/docs/rfc-19788-hive-chat-config-assist.md)) | `pkg/dashboard/api.go:550` | +| `POST` | `/api/chat/config-proposals/{id}/undo` | Owner only | Undo on an applied Hive Chat config assist card ([#19985](https://github.com/hivecommons/hive/issues/19985)): returns a reverse proposal (`config_proposal` with `reverses`) built from the applied proposal's before value, or from its `chat_config_proposed` audit line after a restart, bound to the section as it is now; nothing is written until the card applies it. `403` with `chat.config_assist.enabled` off, `404` when there is no applied, not yet undone proposal of this user with that id, `409` when the section changed since the Apply. The card's **Apply** (and the Undo it builds) sends the stored body to `PUT /api/config/agent/{name}/{section}` with an `X-Hive-Chat-Proposal: ` header; under the config lock the proposal must be this user's, unexpired, not already in flight or applied, for that agent and section, with the same body and an unchanged section hash, or the PUT answers `409` and changes nothing. A seed-owned key (`github`, `hub`, `variables`, `acmm_level`, `hive_id`), a secret field or anything off the chat allowlist is refused with `403`. A 2xx consumes it and audits `chat_config_applied`; any other status returns it to pending and audits `chat_config_apply_failed`; an applied Undo audits `chat_config_undo`. The applied and undo lines carry value fingerprints (`before_fp`, `after_fp`), never the values | `pkg/dashboard/api.go:553` | -| `GET` | `/api/config/governor/threshold-scaling` | Owner only | Governor Threshold Scaling Get | `pkg/dashboard/api.go:211` | -| `PUT` | `/api/config/governor/threshold-scaling` | Owner only | Governor Threshold Scaling Set | `pkg/dashboard/api.go:212` | -| `PUT` | `/api/config/governor/coverage-target` | Owner only | Governor Coverage Target | `pkg/dashboard/api.go:213` | -| `POST` | `/api/config/governor/budget/reset` | Owner only | Governor Budget Reset | `pkg/dashboard/api.go:216` | -| `PUT` | `/api/config/governor/watchdog` | Owner only | Governor Watchdog | `pkg/dashboard/api.go:221` | -| `GET` | `/api/config/escalation` | Owner only | Escalation Config Get | `pkg/dashboard/api.go:224` | -| `PUT` | `/api/config/escalation` | Owner only | Escalation Config Set | `pkg/dashboard/api.go:225` | -| `GET` | `/api/config/write-surface` | Owner only | Lane write allowlist (`write_surface.allowlist`, [#9587](https://github.com/hivecommons/hive/issues/9587)): `allowlist`, `ops`, `warnings` | `pkg/dashboard/api.go:538` | -| `PUT` | `/api/config/write-surface` | Owner only | Replace the lane write allowlist; `{"allowlist": {}}` clears it; unknown operation or bad lane name is a 400 with nothing changed | `pkg/dashboard/api.go:539` | -| `GET` | `/api/config/reference-repos` | Owner only | `project.reference_repos` ([#18136](https://github.com/hivecommons/hive/issues/18136)): `reference_repos` (`{repo, write, write_token_file}` plus `derived_from` on a derived entry and, on every write entry, `credential_state`, `credential_reason` and `credential_login`, the GitHub account the writes appear under ([#18197](https://github.com/hivecommons/hive/issues/18197)), plus `credential_identity` (`bot`, `owner` or `token_file`) and `credential_note`, the one-line why ([#18516](https://github.com/hivecommons/hive/issues/18516)); always an array), `write_kinds`, `write_identity` (`project.remote_write_identity` with the default applied), `write_identities` and `bot_login` (the App bot login, when known) | `pkg/dashboard/api.go:577` | -| `PUT` | `/api/config/reference-repos` | Owner only | Replace `project.reference_repos`; `{"reference_repos": []}` clears it. Refused with a 400 and nothing changed when the config loader would reject the list (bare name, repo also in `project.repos`, duplicate, unknown write kind, token file without write) or when a write entry has no credential boot would accept — the same message boot exits 22 with — or when an entry carries a `write_token_file` the config file does not already hold for that repo (the path is operator-only; a dashboard write opt-in writes as the hive owner's connected GitHub account). Entries with `derived_from` ([#18139](https://github.com/hivecommons/hive/issues/18139)) are the request issue's grant: echo them back as served; changing one's write set, leaving one out, sending one the hive did not derive or adding a hand-written entry for the same repo is a 409 naming the issue to change instead ([#18161](https://github.com/hivecommons/hive/issues/18161)). They are never stored: the saved list holds the hand-written entries and the derived set is merged back in memory after the save. 500 when the file could not be written (proxy restored, nothing changed). On success the GitHub proxy's reference policies are replaced without a restart; audited as `config_reference_repos` | `pkg/dashboard/api.go:578` | -| `PUT` | `/api/config/reference-repos/write-identity` | Owner only | Set `project.remote_write_identity` ([#18516](https://github.com/hivecommons/hive/issues/18516)): body `{"write_identity": "bot"}`, one of `bot`, `bot_only`, `owner`. 400 on an unknown value, or when a hand-written write entry would have no credential under the new value (the message boot exits 22 with); nothing is stored then. 500 when the file could not be written. On success the reference repos are re-resolved before the response, which is the same body as `GET /api/config/reference-repos`; audited as `config_remote_write_identity` with `previous` and `write_identity` | `pkg/dashboard/api.go:588` | -| `GET` | `/api/config/repos/parent-autoclose` | Owner only | `repos..parent_autoclose` for every monitored repo: the effective value (`true`, `epics_too`, `trackers_too` or `false`), whether the repo carries its own, the default and the four options the Settings editor offers ([#19070](https://github.com/hivecommons/hive/issues/19070)) | `pkg/dashboard/api.go:580` | -| `PUT` | `/api/config/repos/parent-autoclose` | Owner only | Set one monitored repo's parent auto-close policy: `{"repo": "owner/name", "value": "true" \| "epics_too" \| "trackers_too" \| "false"}`. `true` is the default and clears the override. 400 for a missing repo or an invalid value, 404 for a repo that is not monitored, 500 when the file could not be written (previous value restored). Applies without a restart; audited as `config_repo_parent_autoclose`. Parents a person reopened and tracking issues are never auto-closed under any value | `pkg/dashboard/api.go:581` | -| `GET` | `/api/config/review-feedback/rules` | Owner only | Reviewer-stated rule capture settings ([#19135](https://github.com/hivecommons/hive/issues/19135)): `enabled`, `trusted_associations`, `extra_phrases` and `disabled_signals`, each with `saved`, `effective`, `source` (`settings`, `env` or `default`), `default`, `env_var` and `yaml_key`; plus `associations`, `signals` (built-in signal names with examples) and `max_phrases` | `pkg/dashboard/api.go:583` | -| `PUT` | `/api/config/review-feedback/rules` | Owner only | Replace `review_feedback.rules.*`: `{"enabled": bool, "trusted_associations": [], "extra_phrases": [], "disabled_signals": []}`; an absent or null field clears that saved value (back to its env var, then the default). 400 with nothing changed for an unknown association or signal, a phrase under 3 or over 80 characters, or more than 20 phrases; 500 when the file could not be written (previous values restored). Applies on the review-feedback sweep's next pass without a restart; audited as `config_review_feedback_rules` | `pkg/dashboard/api.go:584` | -| `GET` | `/api/config/review-feedback/retry` | Owner only | Stranded review-feedback retry settings ([#19320](https://github.com/hivecommons/hive/issues/19320)): `max_retries` and `backoff`, each with `saved`, `effective`, `source` (`settings`, `env` or `default`), `default`, `env_var` and `yaml_key`; plus `max_max_retries` and `min_backoff` | `pkg/dashboard/api.go:585` | -| `PUT` | `/api/config/review-feedback/retry` | Owner only | Replace `review_feedback.retry.*`: `{"max_retries": 2, "backoff": "1h"}`; an absent or null field clears that saved value (back to its env var, then the default). 400 with nothing changed for `max_retries` outside 0..10 or a `backoff` that is not a duration of at least 10m; 500 when the file could not be written (previous values restored). Applies on the review-feedback sweep's next pass; audited as `config_review_feedback_retry` | `pkg/dashboard/api.go:586` | -| `GET` | `/api/config/prompt-sources` | Owner only | Repo-sourced prompt and definition gate ([#18490](https://github.com/hivecommons/hive/issues/18490)): `repos` (one row per managed repo, then any owner approval whose repo is no longer managed, each `{repo, managed, owner_approved, seed_allowed, allowed, approved_by, approved_at}`), `seed_enabled`, `seed_allowlist`, `trust_notice`, `seed_only_note` | `pkg/dashboard/api.go:601` | -| `PUT` | `/api/config/prompt-sources/owner-repos` | Owner only | `{"repo": "org/name", "allowed": true, "acknowledge_trust": true}` approves one of the hive's managed repos as a `prompt_source` / `definition_source` repo; `"allowed": false` revokes. 400 with nothing changed for a repo outside `project.repos` (still needs the seed edit), a malformed slug, or an approval without `acknowledge_trust: true`. Persisted to `variables.security.owner_github_prompt_repos` in the running config; audited as `config_prompt_source_repo`. Responds with the GET body | `pkg/dashboard/api.go:602` | -| `GET` | `/api/config/review` | Dashboard auth/session | Review Config Get | `pkg/dashboard/api.go:228` | -| `PUT` | `/api/config/review` | Owner only | Review Config Set | `pkg/dashboard/api.go:231` | -| `PUT` | `/api/config/governor/features` | Owner only | Governor Features | `pkg/dashboard/api.go:237` | -| `GET` | `/api/config/governor/general-advanced` | Owner only | Governor General Advanced Get | `pkg/dashboard/api.go:238` | -| `PUT` | `/api/config/governor/general-advanced` | Owner only | Governor General Advanced Set | `pkg/dashboard/api.go:239` | -| `GET` | `/api/config/auto-merge` | Owner only | Auto-Merge Config Get | `pkg/dashboard/api.go:243` | -| `PUT` | `/api/config/auto-merge` | Owner only | Auto-Merge Config Set | `pkg/dashboard/api.go:244` | +| `GET` | `/api/config/governor/threshold-scaling` | Owner only | Governor Threshold Scaling Get | `pkg/dashboard/api.go:214` | +| `PUT` | `/api/config/governor/threshold-scaling` | Owner only | Governor Threshold Scaling Set | `pkg/dashboard/api.go:215` | +| `PUT` | `/api/config/governor/coverage-target` | Owner only | Governor Coverage Target | `pkg/dashboard/api.go:216` | +| `POST` | `/api/config/governor/budget/reset` | Owner only | Governor Budget Reset | `pkg/dashboard/api.go:219` | +| `PUT` | `/api/config/governor/watchdog` | Owner only | Governor Watchdog | `pkg/dashboard/api.go:224` | +| `GET` | `/api/config/escalation` | Owner only | Escalation Config Get | `pkg/dashboard/api.go:227` | +| `PUT` | `/api/config/escalation` | Owner only | Escalation Config Set | `pkg/dashboard/api.go:228` | +| `GET` | `/api/config/write-surface` | Owner only | Lane write allowlist (`write_surface.allowlist`, [#9587](https://github.com/hivecommons/hive/issues/9587)): `allowlist`, `ops`, `warnings` | `pkg/dashboard/api.go:541` | +| `PUT` | `/api/config/write-surface` | Owner only | Replace the lane write allowlist; `{"allowlist": {}}` clears it; unknown operation or bad lane name is a 400 with nothing changed | `pkg/dashboard/api.go:542` | +| `GET` | `/api/config/reference-repos` | Owner only | `project.reference_repos` ([#18136](https://github.com/hivecommons/hive/issues/18136)): `reference_repos` (`{repo, write, write_token_file}` plus `derived_from` on a derived entry and, on every write entry, `credential_state`, `credential_reason` and `credential_login`, the GitHub account the writes appear under ([#18197](https://github.com/hivecommons/hive/issues/18197)), plus `credential_identity` (`bot`, `owner` or `token_file`) and `credential_note`, the one-line why ([#18516](https://github.com/hivecommons/hive/issues/18516)); always an array), `write_kinds`, `write_identity` (`project.remote_write_identity` with the default applied), `write_identities` and `bot_login` (the App bot login, when known) | `pkg/dashboard/api.go:580` | +| `PUT` | `/api/config/reference-repos` | Owner only | Replace `project.reference_repos`; `{"reference_repos": []}` clears it. Refused with a 400 and nothing changed when the config loader would reject the list (bare name, repo also in `project.repos`, duplicate, unknown write kind, token file without write) or when a write entry has no credential boot would accept — the same message boot exits 22 with — or when an entry carries a `write_token_file` the config file does not already hold for that repo (the path is operator-only; a dashboard write opt-in writes as the hive owner's connected GitHub account). Entries with `derived_from` ([#18139](https://github.com/hivecommons/hive/issues/18139)) are the request issue's grant: echo them back as served; changing one's write set, leaving one out, sending one the hive did not derive or adding a hand-written entry for the same repo is a 409 naming the issue to change instead ([#18161](https://github.com/hivecommons/hive/issues/18161)). They are never stored: the saved list holds the hand-written entries and the derived set is merged back in memory after the save. 500 when the file could not be written (proxy restored, nothing changed). On success the GitHub proxy's reference policies are replaced without a restart; audited as `config_reference_repos` | `pkg/dashboard/api.go:581` | +| `PUT` | `/api/config/reference-repos/write-identity` | Owner only | Set `project.remote_write_identity` ([#18516](https://github.com/hivecommons/hive/issues/18516)): body `{"write_identity": "bot"}`, one of `bot`, `bot_only`, `owner`. 400 on an unknown value, or when a hand-written write entry would have no credential under the new value (the message boot exits 22 with); nothing is stored then. 500 when the file could not be written. On success the reference repos are re-resolved before the response, which is the same body as `GET /api/config/reference-repos`; audited as `config_remote_write_identity` with `previous` and `write_identity` | `pkg/dashboard/api.go:591` | +| `GET` | `/api/config/repos/parent-autoclose` | Owner only | `repos..parent_autoclose` for every monitored repo: the effective value (`true`, `epics_too`, `trackers_too` or `false`), whether the repo carries its own, the default and the four options the Settings editor offers ([#19070](https://github.com/hivecommons/hive/issues/19070)) | `pkg/dashboard/api.go:583` | +| `PUT` | `/api/config/repos/parent-autoclose` | Owner only | Set one monitored repo's parent auto-close policy: `{"repo": "owner/name", "value": "true" \| "epics_too" \| "trackers_too" \| "false"}`. `true` is the default and clears the override. 400 for a missing repo or an invalid value, 404 for a repo that is not monitored, 500 when the file could not be written (previous value restored). Applies without a restart; audited as `config_repo_parent_autoclose`. Parents a person reopened and tracking issues are never auto-closed under any value | `pkg/dashboard/api.go:584` | +| `GET` | `/api/config/review-feedback/rules` | Owner only | Reviewer-stated rule capture settings ([#19135](https://github.com/hivecommons/hive/issues/19135)): `enabled`, `trusted_associations`, `extra_phrases` and `disabled_signals`, each with `saved`, `effective`, `source` (`settings`, `env` or `default`), `default`, `env_var` and `yaml_key`; plus `associations`, `signals` (built-in signal names with examples) and `max_phrases` | `pkg/dashboard/api.go:586` | +| `PUT` | `/api/config/review-feedback/rules` | Owner only | Replace `review_feedback.rules.*`: `{"enabled": bool, "trusted_associations": [], "extra_phrases": [], "disabled_signals": []}`; an absent or null field clears that saved value (back to its env var, then the default). 400 with nothing changed for an unknown association or signal, a phrase under 3 or over 80 characters, or more than 20 phrases; 500 when the file could not be written (previous values restored). Applies on the review-feedback sweep's next pass without a restart; audited as `config_review_feedback_rules` | `pkg/dashboard/api.go:587` | +| `GET` | `/api/config/review-feedback/retry` | Owner only | Stranded review-feedback retry settings ([#19320](https://github.com/hivecommons/hive/issues/19320)): `max_retries` and `backoff`, each with `saved`, `effective`, `source` (`settings`, `env` or `default`), `default`, `env_var` and `yaml_key`; plus `max_max_retries` and `min_backoff` | `pkg/dashboard/api.go:588` | +| `PUT` | `/api/config/review-feedback/retry` | Owner only | Replace `review_feedback.retry.*`: `{"max_retries": 2, "backoff": "1h"}`; an absent or null field clears that saved value (back to its env var, then the default). 400 with nothing changed for `max_retries` outside 0..10 or a `backoff` that is not a duration of at least 10m; 500 when the file could not be written (previous values restored). Applies on the review-feedback sweep's next pass; audited as `config_review_feedback_retry` | `pkg/dashboard/api.go:589` | +| `GET` | `/api/config/prompt-sources` | Owner only | Repo-sourced prompt and definition gate ([#18490](https://github.com/hivecommons/hive/issues/18490)): `repos` (one row per managed repo, then any owner approval whose repo is no longer managed, each `{repo, managed, owner_approved, seed_allowed, allowed, approved_by, approved_at}`), `seed_enabled`, `seed_allowlist`, `trust_notice`, `seed_only_note` | `pkg/dashboard/api.go:604` | +| `PUT` | `/api/config/prompt-sources/owner-repos` | Owner only | `{"repo": "org/name", "allowed": true, "acknowledge_trust": true}` approves one of the hive's managed repos as a `prompt_source` / `definition_source` repo; `"allowed": false` revokes. 400 with nothing changed for a repo outside `project.repos` (still needs the seed edit), a malformed slug, or an approval without `acknowledge_trust: true`. Persisted to `variables.security.owner_github_prompt_repos` in the running config; audited as `config_prompt_source_repo`. Responds with the GET body | `pkg/dashboard/api.go:605` | +| `GET` | `/api/config/review` | Dashboard auth/session | Review Config Get | `pkg/dashboard/api.go:231` | +| `PUT` | `/api/config/review` | Owner only | Review Config Set | `pkg/dashboard/api.go:234` | +| `PUT` | `/api/config/governor/features` | Owner only | Governor Features | `pkg/dashboard/api.go:240` | +| `GET` | `/api/config/governor/general-advanced` | Owner only | Governor General Advanced Get | `pkg/dashboard/api.go:241` | +| `PUT` | `/api/config/governor/general-advanced` | Owner only | Governor General Advanced Set | `pkg/dashboard/api.go:242` | +| `GET` | `/api/config/auto-merge` | Owner only | Auto-Merge Config Get | `pkg/dashboard/api.go:246` | +| `PUT` | `/api/config/auto-merge` | Owner only | Auto-Merge Config Set | `pkg/dashboard/api.go:247` | | `PATCH` | `/api/config/auto-merge` | Owner only | Partially update auto-merge settings, including nested `merge_train`; omitted fields stay unchanged; returns effective settings and bot-author metadata | `pkg/dashboard/api_config_automerge.go` | -| `GET` | `/api/config/convergence` | Owner only | Convergence Config Get | `pkg/dashboard/api.go:250` | -| `PUT` | `/api/config/convergence` | Owner only | Convergence Config Set | `pkg/dashboard/api.go:252` | -| `GET` | `/api/config/governor/advisory` | Owner only | Governor Advisory Get | `pkg/dashboard/api.go:256` | -| `PUT` | `/api/config/governor/advisory` | Owner only | Governor Advisory Set | `pkg/dashboard/api.go:257` | -| `GET` | `/api/config/governor/replan` | Owner only | Governor Replan Get | `pkg/dashboard/api.go:258` | -| `PUT` | `/api/config/governor/replan` | Owner only | Governor Replan Set | `pkg/dashboard/api.go:259` | -| `GET` | `/api/config/governor/work-source` | Owner only | Governor Work Source Get (Jira secrets/TLS fields reported as set/unset only) | `pkg/dashboard/api.go:269` | -| `PUT` | `/api/config/governor/work-source` | Owner only | Governor Work Source Set (including Jira Data Center TLS settings) | `pkg/dashboard/api.go:270` | -| `PUT` | `/api/config/governor/security` | Owner only | Governor Security | `pkg/dashboard/api.go:271` | -| `GET` | `/api/config/governor/project-observability` | Owner only | Governor Project Observability Get | `pkg/dashboard/api.go:272` | -| `PUT` | `/api/config/governor/project-observability` | Owner only | Governor Project Observability Set | `pkg/dashboard/api.go:273` | -| `GET` | `/api/config/governor/inference-auth` | Owner only | Governor Inference Auth Get | `pkg/dashboard/api.go:288` | -| `PUT` | `/api/config/governor/inference-auth` | Owner only | Governor Inference Auth Set | `pkg/dashboard/api.go:289` | +| `GET` | `/api/config/convergence` | Owner only | Convergence Config Get | `pkg/dashboard/api.go:253` | +| `PUT` | `/api/config/convergence` | Owner only | Convergence Config Set | `pkg/dashboard/api.go:255` | +| `GET` | `/api/config/governor/advisory` | Owner only | Governor Advisory Get | `pkg/dashboard/api.go:259` | +| `PUT` | `/api/config/governor/advisory` | Owner only | Governor Advisory Set | `pkg/dashboard/api.go:260` | +| `GET` | `/api/config/governor/replan` | Owner only | Governor Replan Get | `pkg/dashboard/api.go:261` | +| `PUT` | `/api/config/governor/replan` | Owner only | Governor Replan Set | `pkg/dashboard/api.go:262` | +| `GET` | `/api/config/governor/work-source` | Owner only | Governor Work Source Get (Jira secrets/TLS fields reported as set/unset only) | `pkg/dashboard/api.go:272` | +| `PUT` | `/api/config/governor/work-source` | Owner only | Governor Work Source Set (including Jira Data Center TLS settings) | `pkg/dashboard/api.go:273` | +| `PUT` | `/api/config/governor/security` | Owner only | Governor Security | `pkg/dashboard/api.go:274` | +| `GET` | `/api/config/governor/project-observability` | Owner only | Governor Project Observability Get | `pkg/dashboard/api.go:275` | +| `PUT` | `/api/config/governor/project-observability` | Owner only | Governor Project Observability Set | `pkg/dashboard/api.go:276` | +| `GET` | `/api/config/governor/inference-auth` | Owner only | Governor Inference Auth Get | `pkg/dashboard/api.go:291` | +| `PUT` | `/api/config/governor/inference-auth` | Owner only | Governor Inference Auth Set | `pkg/dashboard/api.go:292` | ## Workflow models @@ -148,7 +150,7 @@ Workflow-model library, bindings, ingest, editor and marketplace routes ([#17620 | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/workflows` | Dashboard auth/session | List the workflow-model library. No body. Returns `{workflows[], bindings[], enabled, dispatch[], agents[]}`: `workflows` are store entries `{name, version, hash, description?, author?, source?, provenance?, compiled, diagnostics?[], states, columns, savedAt?, savedBy?, readOnly?}` (the built-in `hive-default` is listed read-only), `bindings` are `{repo, name, version}`, `enabled` is `workflow.enabled`, and `dispatch` and `agents` are the profile hand-off status described under `PUT /api/workflows/dispatch/profiles` | `pkg/dashboard/api_workflows.go:23` | +| `GET` | `/api/workflows` | Dashboard auth/session | List the workflow-model library. No body. Returns `{workflows[], bindings[], enabled, dispatch[], agents[], handoff_retry, sticky_label_removal}`: `workflows` are store entries `{name, version, hash, description?, author?, source?, provenance?, compiled, diagnostics?[], states, columns, savedAt?, savedBy?, readOnly?}` (the built-in `hive-default` is listed read-only), `bindings` are `{repo, name, version}`, `enabled` is `workflow.enabled`, and `dispatch` and `agents` are the profile hand-off status described under `PUT /api/workflows/dispatch/profiles`; `handoff_retry` is described under `PUT /api/workflows/dispatch/retry` | `pkg/dashboard/api_workflows.go:23` | | `POST` | `/api/workflows` | Owner only | Save a model to the library. Body is a `workflow.hivecommons.dev/v1alpha1` model; an empty `spec.meta.version` saves at the next free integer version. Drafts that do not compile are stored with their diagnostics. Returns `201 {entry}`. Audited `workflow_save`; `400` bad name or version, `403` on `hive-default`, `409` when versions are exhausted | `pkg/dashboard/api_workflows.go:24` | | `POST` | `/api/workflows/compile` | Dashboard auth/session | Compile a model without saving it, so the editor can show diagnostics while the operator types. Body is a model. Returns `{compiled, diagnostics[], profile?}`; needs no store | `pkg/dashboard/api_workflows.go:25` | | `POST` | `/api/workflows/ingest` | Owner only | Derive a draft lifecycle model from a repository's GitHub Actions and Tekton definitions. Body `{repo}` (reads the default branch through the forge) or `{files: {path: contents}}` (pasted definitions), exactly one, plus optional `save` and `name`. Returns `{model, compiled, diagnostics[], profile?, ref, files, pipelines}`, where `ref` is the commit read, `files` the number of pipeline files and `pipelines` the number of pipelines in `model.spec.pipelines` (a count, not a list). With `save: true` the model is stored at the next free version and the response is `201` with `entry` added; audited `workflow_ingest`. `400` bad body, `502` forge read failed, `503` without a forge client | `pkg/dashboard/api_workflows.go:26` | @@ -156,7 +158,9 @@ Workflow-model library, bindings, ingest, editor and marketplace routes ([#17620 | `PUT` | `/api/workflows/bindings` | Owner only | Bind or unbind a repository. Body `{repo, name, version}`; an empty `name` unbinds. The model must exist and compile. Persists `project.workflow_bindings` in `hive.yaml`. Returns `{changed, bindings[], dispatch[], agents[], checks?, warnings?[]}`; on a bind it also proposes the model's declared checks to the repository as `.hive/workflows/checks.yml` (`checks` is `{outcome, pr?}`, a failure is a `warnings` entry, never a failed bind). Audited `workflow_bind` / `workflow_unbind` when it changed something | `pkg/dashboard/api_workflows.go:28` | | `PUT` | `/api/workflows/enabled` | Owner only | Turn model-based stage derivation (`workflow.enabled`, [#17620](https://github.com/hivecommons/hive/issues/17620)) on or off from the dashboard, for hosted hives with no `hive.yaml` access. Body `{enabled: bool}`; persists `hive.yaml`; the stage engine and tracker read the live flag so it applies on the next derivation pass without a restart. Turning on also provisions every bound repository's model labels now (`warnings[]` lists repositories that could not be provisioned; the next sweep retries). Returns `{enabled, changed, bindings[], warnings?[]}`. Audited `workflow_enabled` / `workflow_disabled`; `400` on a non-boolean body | `pkg/dashboard/api_workflows.go:29` | | `POST` | `/api/workflows/dispatch` | Owner only | Send a model-owned item to its agent profile: the stage tracker's **Send to *profile*** on a row whose bound model hands its current state to a profile ([cncf/techdocs#395](https://github.com/cncf/techdocs/issues/395): Accepted → `techdocs-drafter`, Drafting → `techdocs-verifier`). Body `{repo, number}`. Reads the item fresh, resolves the agent (`workflow.dispatch.profiles..agent`, then the default order ending at the hive's issue worker or reviewer, at every step only an agent whose mode lets it do what the profile needs, [#18749](https://github.com/hivecommons/hive/issues/18749); a profile disabled for automatic dispatch still resolves), takes the agent claim on an issue first, kicks the agent, and records the hand-off as pending once the kick lands so the automatic pass does not repeat it; a later pass marks it not started if the agent declines or ends its turn without the deliverable. Returns `{status: "sent", ref, model, state, profile, agent, result}`. Audited `workflow_dispatch`; `404` when the model does not hand the state to a profile, `409` when no agent fills it (the message gives the reason, for example that no agent on the hive may open pull requests in the repository, and names the Settings → Repos picker), someone else holds the claim, or the agent is busy | `pkg/dashboard/api_workflows.go:30` | -| `PUT` | `/api/workflows/dispatch/profiles` | Owner only | Pick the hive agent a bound model's profile is handed to ([#18690](https://github.com/hivecommons/hive/issues/18690)): the agent picker on a repository's workflow row in Settings → Repos. Body `{profile, agent}`; an empty `agent` clears the pin so the profile resolves by default again. Persists `workflow.dispatch.profiles..agent` in `hive.yaml` (the profile's `prompt_template` and `disabled` are kept); the next scheduler pass reads the live config, so no restart is needed. `agent` must be an enabled agent that is not a replica (`400` otherwise). Returns `{changed, profile, agent, dispatch, agents}`, where `dispatch` lists every bound repository's profiles as `{repo, profile, agent, source, mode, needs, pinned, disabled, problem, states, candidates, not_started}` (`problem` is why nothing fills the profile, including a pin to an agent whose mode does not let it do the profile's work; `candidates` lists each pinnable agent as `{agent, mode, qualifies, reason}`; `not_started` lists the hand-offs an agent declined or did not act on while their item still waits, as `{ref, repo, number, profile, state, agent, reason, at, attempts, retrying, next, reason_at, reason_age, reason_session, stale}` (`reason_at`, `reason_age` and `reason_session` say when and in which hand-off session the reason was decided, and `stale` is true once a newer hand-off of the item exists, so the reason is history and not the item's state now, [#18916](https://github.com/hivecommons/hive/issues/18916)), [#18749](https://github.com/hivecommons/hive/issues/18749)) and `agents` the agents that can be picked; `GET /api/workflows` and `PUT /api/workflows/bindings` carry the same two fields. Audited `workflow_dispatch_agent` | `pkg/dashboard/api_workflows.go:31` | +| `PUT` | `/api/workflows/dispatch/profiles` | Owner only | Pick the hive agent a bound model's profile is handed to ([#18690](https://github.com/hivecommons/hive/issues/18690)): the agent picker on a repository's workflow row in Settings → Repos. Body `{profile, agent}`; an empty `agent` clears the pin so the profile resolves by default again. Persists `workflow.dispatch.profiles..agent` in `hive.yaml` (the profile's `prompt_template` and `disabled` are kept); the next scheduler pass reads the live config, so no restart is needed. `agent` must be an enabled agent that is not a replica (`400` otherwise). Returns `{changed, profile, agent, dispatch, agents}`, where `dispatch` lists every bound repository's profiles as `{repo, profile, agent, source, mode, needs, pinned, disabled, problem, states, candidates, not_started}` (`problem` is why nothing fills the profile, including a pin to an agent whose mode does not let it do the profile's work; `candidates` lists each pinnable agent as `{agent, mode, qualifies, reason}`; `not_started` lists the hand-offs an agent declined or did not act on while their item still waits, as `{ref, repo, number, profile, state, agent, reason, at, attempts, retrying, next, reason_at, reason_age, reason_session, stale, max_attempts, last_output?, same_agent_retry_at?, parked_at?}` (`reason_at`, `reason_age` and `reason_session` say when and in which hand-off session the reason was decided, and `stale` is true once a newer hand-off of the item exists, so the reason is history and not the item's state now, [#18916](https://github.com/hivecommons/hive/issues/18916)), [#18749](https://github.com/hivecommons/hive/issues/18749)) and `agents` the agents that can be picked; `GET /api/workflows` and `PUT /api/workflows/bindings` carry the same two fields. Audited `workflow_dispatch_agent` | `pkg/dashboard/api_workflows.go:31` | +| `PUT` | `/api/workflows/dispatch/retry` | Owner only | Set how often a workflow hand-off that was not started is made again ([#20877](https://github.com/hivecommons/hive/issues/20877)): the **Hand-off retries** row under the workflow dispatch profiles in Settings → Repos. Body `{max_attempts, cooldown_s, max_cooldown_s}`; a zero or missing field means the default (3 attempts in all, 1800 s, 14400 s). When no other agent qualifies, the item goes back to the same agent after `cooldown_s`, doubling per attempt up to `max_cooldown_s`, never while the agent is paused or the item carries a hold or `needs-human` label; after `max_attempts` the item is labeled `needs-human` with one comment. Persists `workflow.dispatch.handoff_retry` in `hive.yaml`; the next scheduler pass reads the live config. `400` when a value is out of bounds (`max_attempts` 0 to 10, waits 0 to 604800 s). Returns `{changed, handoff_retry, dispatch}`, where `handoff_retry` is `{max_attempts?, cooldown_s?, max_cooldown_s?, effective, defaults, limits}` (the last three each `{max_attempts, cooldown_s, max_cooldown_s}`); `GET /api/workflows` carries the same `handoff_retry`. Audited `workflow_handoff_retry` | `pkg/dashboard/api_workflows.go:40` | +| `PUT` | `/api/workflows/sticky-label-removal` | Owner only | Turn `workflow.sticky_label_removal` on or off ([#20979](https://github.com/hivecommons/hive/issues/20979)): whether a whose-turn label a person removes stays off until the item's state changes or a new commit lands. Body `{"enabled": true\|false}`; returns `{changed, sticky_label_removal}`. Saved to hive.yaml, audited as `workflow_sticky_label_removal`, applied on the next pass. | | `GET` | `/api/workflows/{name}/{version}` | Dashboard auth/session | One stored model. No body. Returns `{entry, model, profile?}`; `profile` is present when the model compiles. `404` unknown model or version | `pkg/dashboard/api_workflows.go:32` | | `PUT` | `/api/workflows/{name}/{version}` | Owner only | Save a model at an exact version. Body is a model whose `metadata.name` and `spec.meta.version` must match the path (`400` otherwise). Returns `201 {entry}`. Audited `workflow_save`; `403` on `hive-default` | `pkg/dashboard/api_workflows.go:33` | | `DELETE` | `/api/workflows/{name}/{version}` | Owner only | Delete a stored model version. No body. Returns `{ok: true}`. Audited `workflow_delete`; `409` while a repository is bound to it, `403` on `hive-default`, `404` unknown | `pkg/dashboard/api_workflows.go:34` | diff --git a/docs/content/hive/api-reference/cost-tokens-telemetry.md b/docs/content/hive/api-reference/cost-tokens-telemetry.md index 6d03cc45..c14210c4 100644 --- a/docs/content/hive/api-reference/cost-tokens-telemetry.md +++ b/docs/content/hive/api-reference/cost-tokens-telemetry.md @@ -7,16 +7,16 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/trends` | Dashboard auth/session | Trends | `pkg/dashboard/api.go:97` | -| `GET` | `/api/token-access` | Dashboard auth/session | Token Access | `pkg/dashboard/api.go:152` | -| `GET` | `/api/tokens` | Dashboard auth/session | Tokens | `pkg/dashboard/api.go:153` | -| `GET` | `/api/cost` | Dashboard auth/session | Cost; `merged_prs` / `closed_issues` come from the webhook-incremented ForgeState counters reconciled hourly against search, with `count_stale`, `count_stale_since` and `count_source` (`forgestate` / `search`) when last-good counts are being served (#13376), `count_partial` when only some configured repos have an attributed baseline yet, and `count_error` naming why the latest attributed refresh failed or was partial (the reconcile asks GitHub about a budgeted slice of repos per pass so a many-repo hive stays inside search's rate limit); `daily_rollup` lists per-UTC-day estimated spend (`day`, `cost_usd`, `input_tokens`, `output_tokens`, `samples`) kept for ~2 years so the Cost chart can reach past the 30-day snapshot ring; `recording` reports `agent_models`, `unrecorded_models`, `recent_models`, `last_priced_growth_at`, `last_agent_model_growth_at`, `stale_after_ms` and `stale` so the card can flag stale live usage recording (#13485); every `estimated.by_model[]` row carries `canonical_model` (`modelfamily.Canonical` of its `name`, the id PRs-by-model and run stats group by), while spend stays one row per raw model because prices are per raw model (#18718) | `pkg/dashboard/api.go:154` | +| `GET` | `/api/trends` | Dashboard auth/session | Trends | `pkg/dashboard/api.go:98` | +| `GET` | `/api/token-access` | Dashboard auth/session | Token Access | `pkg/dashboard/api.go:153` | +| `GET` | `/api/tokens` | Dashboard auth/session | Tokens | `pkg/dashboard/api.go:154` | +| `GET` | `/api/cost` | Dashboard auth/session | Cost; `merged_prs` / `closed_issues` come from the webhook-incremented ForgeState counters reconciled hourly against search, with `count_stale`, `count_stale_since` and `count_source` (`forgestate` / `search`) when last-good counts are being served (#13376), `count_partial` when only some configured repos have an attributed baseline yet, and `count_error` naming why the latest attributed refresh failed or was partial (the reconcile asks GitHub about a budgeted slice of repos per pass so a many-repo hive stays inside search's rate limit); `daily_rollup` lists per-UTC-day estimated spend (`day`, `cost_usd`, `input_tokens`, `output_tokens`, `samples`) kept for ~2 years so the Cost chart can reach past the 30-day snapshot ring; `recording` reports `agent_models`, `unrecorded_models`, `recent_models`, `last_priced_growth_at`, `last_agent_model_growth_at`, `stale_after_ms` and `stale` so the card can flag stale live usage recording (#13485); every `estimated.by_model[]` row carries `canonical_model` (`modelfamily.Canonical` of its `name`, the id PRs-by-model and run stats group by), while spend stays one row per raw model because prices are per raw model (#18718) | `pkg/dashboard/api.go:155` | | `GET` | `/api/repo-activity` | Dashboard auth/session | Per-repo audited activity | `pkg/dashboard/api.go` | | `GET` | `/api/repo-cost` | Dashboard auth/session | Per-repo estimated token cost (interval join, cached) | `pkg/dashboard/api.go` | | `GET` | `/api/launch-cost` | Dashboard auth/session | Per-issue / PR / head-SHA estimated token cost from kick launch attribution (cached; `?ref=owner/repo#N` narrows) | `pkg/dashboard/api.go` | | `GET` | `/api/launch-cost/history` | Dashboard auth/session | Daily per-ref rollup of launch attribution (`daily_rollup[]`: `day`, `by_ref[]` with `ref`, `kind`, `launches`, `share_usd`), kept ~2 years on the `/data` PVC so cost per PR can be measured past the `/api/launch-cost` window | `pkg/dashboard/api.go` | -| `GET` | `/api/cost/history` | Dashboard auth/session | Cost History | `pkg/dashboard/api.go:160` | -| `GET` | `/api/trend/history` | Dashboard auth/session | Trend History | `pkg/dashboard/api.go:163` | -| `GET` | `/api/timeseries` | Dashboard auth/session | Time Series | `pkg/dashboard/api.go:165` | +| `GET` | `/api/cost/history` | Dashboard auth/session | Cost History | `pkg/dashboard/api.go:161` | +| `GET` | `/api/trend/history` | Dashboard auth/session | Trend History | `pkg/dashboard/api.go:164` | +| `GET` | `/api/timeseries` | Dashboard auth/session | Time Series | `pkg/dashboard/api.go:166` | | `GET` | `/api/providers/headroom` | Owner only | Last stored per-provider usage readings (`providers[]` with `limits[]`, `captured_at`, `stale`, `probe_error_cause`, `plan_type` when a provider reports one, and for Claude `extra_usage` when reported: `enabled`, `used_minor`, `limit_minor`, `exponent`, `currency`, `spend_limit_reached`, each left out when unknown), from provider rotation or the default publish-only reading, plus `used_by`: per provider, the enabled agents whose backend spends its plan; serving it never triggers a new measurement. Feeds the Overview usage gauge and the rotation settings table | `pkg/dashboard/api.go:67` | -| `GET` | `/api/budget/history` | Dashboard auth/session | Budget History | `pkg/dashboard/api.go:162` | +| `GET` | `/api/budget/history` | Dashboard auth/session | Budget History | `pkg/dashboard/api.go:163` | diff --git a/docs/content/hive/api-reference/dashboard-misc.md b/docs/content/hive/api-reference/dashboard-misc.md index 3aed3937..9e7b8d56 100644 --- a/docs/content/hive/api-reference/dashboard-misc.md +++ b/docs/content/hive/api-reference/dashboard-misc.md @@ -63,57 +63,57 @@ review are settled. | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| | `GET` | `/api/audit` | Read-write role | Audit Log — `{"entries": [...]}` envelope, newest first, capped at 200; response shape and the serve-time `user_name` field in [audit-log.md](https://github.com/hivecommons/hive/blob/v5/src/docs/audit-log.md#get-apiaudit) | `pkg/dashboard/api.go:66` | -| `GET` | `/api/watchdog/activity` | Read-write role | Watchdog activity readout for the Health tab (#7254): `watchdog-*` audit actions over `?days=` (default 30, clamped to 90) — total / taken / observed / `byAction`, a zero-filled per-day `daily` histogram, per-agent `agents` liveness, and the Observe → Heal `promotion` hint; see [agent-watchdog.md](/docs/hive/operations/agent-and-governor-controls/agent-watchdog#watchdog-activity-strip) | `pkg/dashboard/api.go:511` | +| `GET` | `/api/watchdog/activity` | Read-write role | Watchdog activity readout for the Health tab (#7254): `watchdog-*` audit actions over `?days=` (default 30, clamped to 90) — total / taken / observed / `byAction`, a zero-filled per-day `daily` histogram, per-agent `agents` liveness, and the Observe → Heal `promotion` hint; see [agent-watchdog.md](/docs/hive/operations/agent-and-governor-controls/agent-watchdog#watchdog-activity-strip) | `pkg/dashboard/api.go:514` | | `GET` | `/api/ioscan/classifier-outcomes` | Read-write role | Input classifier outcome counts for the Input Defense card (#20765): `ioscan_classifier` audit entries over `?hours=` (default 24, clamped to the audit log's 90 day retention; `400` for a non-positive value) as `total`, `scored` with `scoredByAction`, `skippedCallLimit` (`budget_exhausted`), `skippedDailyQuota`, `failed` with `failedClosed` and `failedByCause` (`timeout`, `http_`, `invalid_reply`, `no_endpoint`, `pass_stopped`, `error`, or `unrecorded` for entries older than the `error=` field), and `other`; see [ioscan.md](/docs/hive/security/ioscan) | `pkg/dashboard/api_ioscan_classifier_outcomes.go:65` | | `GET` | `/api/session-taint` | Owner only | Read-only view of the observe-only [session taint](https://github.com/hivecommons/hive/blob/v5/src/docs/design/session-taint.md) store (#20799): `sessions` (agent and labels, each with `kind`, `origin` id, `source` and `first_seen`, most recently touched first), `recent` would-act decisions (oldest first), `would_act` counts per rule and the observer counters. No clear or release action. With `session_taint.enabled` off it answers `{"enabled":false,"status":"disabled",...}` with empty lists. Never carries credential, body or file content. Also `hivectl observe session-taint` | `pkg/dashboard/api_session_taint.go:76` | -| `GET` | `/api/ask/status` | Dashboard auth/session | Ask AI help status for the signed-in person (`enabled`, `text_version`, `disclosure`, `consented`, `docs_url`, `ai_label`); `404` unless `ask.enabled` is on and configured. See [Ask AI help](/docs/hive/ask-ai-help) | `pkg/dashboard/api.go:84` | -| `PUT` | `/api/ask/consent` | Dashboard auth/session | Confirm the Ask disclosure (`{text_version}`); `409` on an older text; `204` | `pkg/dashboard/api.go:85` | -| `DELETE` | `/api/ask/consent` | Dashboard auth/session | Withdraw Ask consent; `204` | `pkg/dashboard/api.go:86` | -| `POST` | `/api/ask` | Dashboard auth/session | Ask a docs-help question (`{question, section?, conversation?}`); always `200` with an `outcome`; direct mode calls Kapa.ai, hub mode the hub relay | `pkg/dashboard/api.go:87` | -| `GET` | `/ask-panel.js` | Dashboard auth/session | Ask AI help panel script, the shared component in `pkg/askai/web`; `404` while Ask is off | `pkg/dashboard/api.go:88` | -| `GET` | `/ask-panel.css` | Dashboard auth/session | Ask AI help panel stylesheet; `404` while Ask is off | `pkg/dashboard/api.go:89` | -| `POST` | `/api/presence` | Dashboard auth/session | Presence | `pkg/dashboard/api.go:69` | -| `POST` | `/api/upgrade/announce` | Owner role | Announce a pod roll before it happens ([#15788](https://github.com/hivecommons/hive/issues/15788)): body `{"target": "", "source": "hub"|"operator", "reason": "..."}` (`version` is an alias of `target`; all fields optional). Marks `/api/status`/`/api/version` `upgradeProgress` as `state: pulling, phase: announced` with the target and publishes an SSE `upgrading` event so every open dashboard shows the upgrade animation; a SIGTERM afterwards (or with no announce at all) publishes `phase: restarting` from the same record. The hub sends the same announce through the heartbeat response (`upgrade_announce`) for hub-managed hives; an announce with no kill expires after 15 minutes. Returns `{ok, upgradeProgress}` | `pkg/dashboard/api.go:72` | -| `GET` | `/api/prompt-history` | Dashboard auth/session | Prompt History | `pkg/dashboard/api.go:70` | -| `POST` | `/api/self-upgrade` | Owner only | Self Upgrade | `pkg/dashboard/api.go:71` | -| `GET` | `/api/backup/status` | Owner only | Backup Status — `available:false` with a reason when no encryption key is configured | `pkg/dashboard/api.go:76` | -| `POST` | `/api/backup` | Owner only | Backup Download — `412` when no encryption key is configured (never an unencrypted archive) | `pkg/dashboard/api.go:77` | -| `POST` | `/api/banner-dismissed` | Dashboard auth/session | Banner Dismissed | `pkg/dashboard/api.go:78` | -| `GET` | `/api/history` | Dashboard auth/session | History | `pkg/dashboard/api.go:96` | -| `GET` | `/api/timeline` | Dashboard auth/session | Timeline | `pkg/dashboard/api.go:98` | -| `GET` | `/api/lifecycle-timeline` | Dashboard auth/session | Issue→PR lifecycle journeys plus derived stage timeline. Each journey keeps the dense `stages` map and adds a backwards-compatible `details` object for expandable rows: chronological stages with durations, current-stage age, agent, classification attrs, issue/PR links, blocked reason, and kick/run identifiers when recorded. | `pkg/dashboard/api.go:99` | -| `GET` | `/api/pr-throughput` | Dashboard auth/session | Throughput: pull/merge requests and issues across tracked forges. Counts hive-created PRs/issues, hive/observed reviews, observed PR merges/closures, and issue closes over `?hours=N` (default 24, capped at audit retention; `hours=0` = all time from durable counters in `/data/pr-throughput-counters.json`) with optional exact case-insensitive `?repo=owner/name` and `?role=created\|reviewed\|merged` for the actor trend. The response keeps legacy `opened`/`merged`/`closed`, `merged_by_path`, `buckets`, velocity metrics, previous-window trends, top agents/repos/reasons, and `recorded_since`, and adds `by_actor` (`pr`/`issue` × `created`/`reviewed`/`merged`/`closed` × `hive`/`human`/`other`) plus `series` points (`t`, `hive`, `human`, `other`) for the selected role. | `pkg/dashboard/api.go:100` | - - -| `GET` | `/api/convergence/soak` | Owner only | Convergence Soak Status | `pkg/dashboard/api.go:255` | -| `POST` | `/api/plan/from-issue` | Dashboard auth/session | Plan From Issue | `pkg/dashboard/api.go:462` | -| `GET` | `/api/plan/{epicID}` | Dashboard auth/session | Plan Tree | `pkg/dashboard/api.go:465` | -| `POST` | `/api/plan/{epicID}/approve` | Owner only | Plan Approve | `pkg/dashboard/api.go:466` | -| `POST` | `/api/plan/{epicID}/reject` | Owner only | Plan Reject | `pkg/dashboard/api.go:468` | -| `POST` | `/api/plan/{epicID}/child/{childID}` | Owner only | Plan Child Action | `pkg/dashboard/api.go:469` | +| `GET` | `/api/ask/status` | Dashboard auth/session | Ask AI help status for the signed-in person (`enabled`, `text_version`, `disclosure`, `consented`, `docs_url`, `ai_label`); `404` unless `ask.enabled` is on and configured. See [Ask AI help](/docs/hive/ask-ai-help) | `pkg/dashboard/api.go:85` | +| `PUT` | `/api/ask/consent` | Dashboard auth/session | Confirm the Ask disclosure (`{text_version}`); `409` on an older text; `204` | `pkg/dashboard/api.go:86` | +| `DELETE` | `/api/ask/consent` | Dashboard auth/session | Withdraw Ask consent; `204` | `pkg/dashboard/api.go:87` | +| `POST` | `/api/ask` | Dashboard auth/session | Ask a docs-help question (`{question, section?, conversation?}`); always `200` with an `outcome`; direct mode calls Kapa.ai, hub mode the hub relay | `pkg/dashboard/api.go:88` | +| `GET` | `/ask-panel.js` | Dashboard auth/session | Ask AI help panel script, the shared component in `pkg/askai/web`; `404` while Ask is off | `pkg/dashboard/api.go:89` | +| `GET` | `/ask-panel.css` | Dashboard auth/session | Ask AI help panel stylesheet; `404` while Ask is off | `pkg/dashboard/api.go:90` | +| `POST` | `/api/presence` | Dashboard auth/session | Presence | `pkg/dashboard/api.go:70` | +| `POST` | `/api/upgrade/announce` | Owner role | Announce a pod roll before it happens ([#15788](https://github.com/hivecommons/hive/issues/15788)): body `{"target": "", "source": "hub"|"operator", "reason": "..."}` (`version` is an alias of `target`; all fields optional). Marks `/api/status`/`/api/version` `upgradeProgress` as `state: pulling, phase: announced` with the target and publishes an SSE `upgrading` event so every open dashboard shows the upgrade animation; a SIGTERM afterwards (or with no announce at all) publishes `phase: restarting` from the same record. The hub sends the same announce through the heartbeat response (`upgrade_announce`) for hub-managed hives; an announce with no kill expires after 15 minutes. Returns `{ok, upgradeProgress}` | `pkg/dashboard/api.go:73` | +| `GET` | `/api/prompt-history` | Dashboard auth/session | Prompt History | `pkg/dashboard/api.go:71` | +| `POST` | `/api/self-upgrade` | Owner only | Self Upgrade | `pkg/dashboard/api.go:72` | +| `GET` | `/api/backup/status` | Owner only | Backup Status — `available:false` with a reason when no encryption key is configured | `pkg/dashboard/api.go:77` | +| `POST` | `/api/backup` | Owner only | Backup Download — `412` when no encryption key is configured (never an unencrypted archive) | `pkg/dashboard/api.go:78` | +| `POST` | `/api/banner-dismissed` | Dashboard auth/session | Banner Dismissed | `pkg/dashboard/api.go:79` | +| `GET` | `/api/history` | Dashboard auth/session | History | `pkg/dashboard/api.go:97` | +| `GET` | `/api/timeline` | Dashboard auth/session | Timeline | `pkg/dashboard/api.go:99` | +| `GET` | `/api/lifecycle-timeline` | Dashboard auth/session | Issue→PR lifecycle journeys plus derived stage timeline. Each journey keeps the dense `stages` map and adds a backwards-compatible `details` object for expandable rows: chronological stages with durations, current-stage age, agent, classification attrs, issue/PR links, blocked reason, and kick/run identifiers when recorded. | `pkg/dashboard/api.go:100` | +| `GET` | `/api/pr-throughput` | Dashboard auth/session | Throughput: pull/merge requests and issues across tracked forges. Counts hive-created PRs/issues, hive/observed reviews, observed PR merges/closures, and issue closes over `?hours=N` (default 24, capped at audit retention; `hours=0` = all time from durable counters in `/data/pr-throughput-counters.json`) with optional exact case-insensitive `?repo=owner/name` and `?role=created\|reviewed\|merged` for the actor trend. The response keeps legacy `opened`/`merged`/`closed`, `merged_by_path`, `buckets`, velocity metrics, previous-window trends, top agents/repos/reasons, and `recorded_since`, and adds `by_actor` (`pr`/`issue` × `created`/`reviewed`/`merged`/`closed` × `hive`/`human`/`other`) plus `series` points (`t`, `hive`, `human`, `other`) for the selected role. | `pkg/dashboard/api.go:101` | + + +| `GET` | `/api/convergence/soak` | Owner only | Convergence Soak Status | `pkg/dashboard/api.go:258` | +| `POST` | `/api/plan/from-issue` | Dashboard auth/session | Plan From Issue | `pkg/dashboard/api.go:465` | +| `GET` | `/api/plan/{epicID}` | Dashboard auth/session | Plan Tree | `pkg/dashboard/api.go:468` | +| `POST` | `/api/plan/{epicID}/approve` | Owner only | Plan Approve | `pkg/dashboard/api.go:469` | +| `POST` | `/api/plan/{epicID}/reject` | Owner only | Plan Reject | `pkg/dashboard/api.go:471` | +| `POST` | `/api/plan/{epicID}/child/{childID}` | Owner only | Plan Child Action | `pkg/dashboard/api.go:472` | | `POST` | `/api/linear/agent/install` | Owner only | Linear Agent Install (OAuth start) | `pkg/dashboard/api_linear_agent.go:215` | | `GET` | `/api/linear/agent/status` | Owner only | Linear Agent Status | `pkg/dashboard/api_linear_agent.go:216` | | `POST` | `/api/linear/agent/disconnect` | Owner only | Linear Agent Disconnect | `pkg/dashboard/api_linear_agent.go:217` | -| `GET` | `/api/upstream-watch` | Owner only | Upstream-watch divergence: per watched fork the upstream followed, the watermark and last-run time, surfaced/ported/dismissed/skipped counts, and the recent upstream refs with their upstream URL, diff URL, fork issue number and state. Read-only — it reads the config and the watch state file, never GitHub. Also carries `interval`, `project_repos` and each repo's configured entry (`config`) for the editor. | `pkg/dashboard/api.go:298` | -| `PUT` | `/api/config/upstream-watch` | Owner only | Upstream Watch Config Update: edit `upstream_watch` from the Features tab. Body `{enabled?, interval?, repos?: {: {upstream?, sources?, pr_labels?, max_issues_per_run?, label?} \| null}}` — absent keys are unchanged, `null` removes a repo, keys are stored as the bare repo name. Validated with the loader's rules before the config changes (400 on failure), then persisted and audited as `config_upstream_watch`. | `pkg/dashboard/api.go:299` | - -| `GET` | `/api/hotspots` | Dashboard auth/session | Merge-hotspot advisor report (`?repo=owner/name` optional): files repeatedly touched by concurrent PRs over the last `governor.hotspot_window_days`, each with `prs` (distinct PRs), `pr_numbers`, `overlaps` (PR pairs open at the same time), `conflicts` (rebase conflicts blamed on the file), `lines`, `kind` (`code`/`doc`/`lock`/`generated`/`data`), `score`, `symbol_groups`, `recommendation` (`split-code`/`split-doc`/`split-source`/`report-only`/`none`), `reason`, `generated_from`, `source_files` (files under `generated_from`, when known), `issue_number`/`issue_url` of the modularize issue filed, `last_updated`; top-level `count`/`actionable`/`filed`. Derived from the merge train's own PR file lists and the rebase follow-through's conflict records — never lists PRs or files from GitHub. See [operator-reference.md § Merge-hotspot advisor](https://github.com/hivecommons/hive/blob/v5/src/docs/operator-reference.md#merge-hotspot-advisor-governorhotspot_). | `pkg/dashboard/api.go:557` | -| `GET` | `/api/widget` | Dashboard auth/session | Widget | `pkg/dashboard/api.go:109` | -| `GET` | `/api/pane/{agent}` | Dashboard auth/session | Pane | `pkg/dashboard/api.go:114` | -| `GET` | `/api/role` | Dashboard auth/session | Role | `pkg/dashboard/api.go:128` | -| `POST` | `/api/reset-restarts/{agent}` | Owner only | Reset Restarts | `pkg/dashboard/api.go:150` | -| `GET` | `/api/budget-ignore` | Dashboard auth/session | Budget Ignore Get | `pkg/dashboard/api.go:168` | -| `POST` | `/api/budget-ignore` | Owner only | Budget Ignore Set | `pkg/dashboard/api.go:169` | -| `GET` | `/api/summaries` | Dashboard auth/session | Summaries | `pkg/dashboard/api.go:181` | -| `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, `claimant: {kind: hive-agent|clanker|person, login, agent, hive, since, source: claim-ledger|claim-comment|assignee|kick-history|author}` naming who holds a claimed / in-progress issue or a PR under review or rework (absent when nobody is named; mirrored onto `linked_prs[]`), (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, `decision_needed` on a row parked on a person (085 / 045 / 015, the needs-human pill; mirrored onto the issue's `linked_prs[]` entry): `{question, asked_by, since, blocker, blocker_reason, options: [{action, label, enabled, reason_if_disabled}]}` — the reviewer's own decision question when the verdict record has one, the blocker in plain words, and the applicable actions under the row context menu's action ids (`decide:delegate` first), (PRs) `lineage` on the hive's copy of an adopted PR — `{kind: adopted|superseded|rebased-by-hive, from_number, from_url, from_author, from_author_kind, to_number, to_url, at, reason}`, derived from the stage store's adoption record or the `hive/adopt-` head branch, mirrored onto the issue's `linked_prs[]` entry; absent on every other row — and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_why` `{source: filed-for-help|decision-pending|level-gate|hive-hold|needs-approval|triage|author|needs-human, reason}` on every row a person must move (with `needs_human: true`; `filed_for_help` names the agent whose marker is in an unclaimed issue's body); `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close; a PR in a conflict-aware merge train carries `merge_train` `{id, state, front, position, size, attempt, max_attempts, overlap_files, ahead, length, head_number, head_state, head_reason, head_since, eta_s, eta_at, eta_basis, late, stalled, stalled_s}` — `head_state` one of `needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown` with `head_reason` in plain words; `eta_s` / `eta_at` the estimated wait for this member's own merge attempt (own remaining soak + each PR ahead's remaining soak or one sweep + the next sweep tick; absent while the head waits on a person or CI), `eta_at` anchored to the member's first estimate at its position so a countdown survives polls, `eta_basis` its short reading ("2 ahead · head soaking 12m · next sweep in 40s"), `late` once now has overrun the first estimate twice over, `stalled` / `stalled_s` once the head has sat longer than `governor.merge_train_stall_warn_s` ([#15395](https://github.com/hivecommons/hive/issues/15395)); a PR the queue holds because another open PR declares the same `Fixes #N` carries no `merge_train` and a `merge_gate` of `{state: "duplicate-of:", duplicate_of, duplicate_issue}` plus the `needs-decision` modifier (the queue keeps one PR per issue: green first, then the earlier-opened); a PR GitHub reports conflicting on its own, or one under repair (stage/070, 071, 072, 074, 085, or a red required check), carries no `merge_train` and is not counted in any member's `size` / `length` — a repaired member the view dropped carries `left_train: {why: fixing|needs-author|returned-to-contributor|adopted-by-hive|needs-decision|checks-failing, note}` instead (mirrored onto the issue's `linked_prs[]` entry), and a train left with one member reports no `merge_train` at all; a PR short of the merge queue (below stage/080) the planner ordered rides no train either — it carries `overlap: {behind, with, files, note}` ("overlaps #15637 (sidebar.html, index.html) — will queue behind it") and no `merge_train`, and counts in no member's `size` — the state slugs (`front`, `queued-behind`) are payload values only, the SPA renders ordinal places ("Queued for merge · 1st of 2", with the train's tag when more than one train is on the page). Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:182` | -| `GET` | `/api/matrix/lines` | Dashboard auth/session | Matrix Lines (deprecated name, see [Published-checkpoint regions](#published-checkpoint-regions)): serve bounded backlog of pushed lines behind dashboard.matrix with repo allowlist filtering. `max` counts only lines the repo allowlist admits, so a page is never emptied by filtered-out lines. A client paging with `max` should use the last returned line's `seq` as its next `since`, not the top-level `seq`, which is the source's latest sequence number and would skip lines still past the page. `more` is true only while another line the caller may see remains past the page; stop paging when it is false. | `pkg/dashboard/api.go:183` | -| `POST` | `/api/prs/{owner}/{repo}/{number}/queue-automerge` | Merger/owner role | Queue PRAuto Merge | `pkg/dashboard/api.go:184` | -| `GET` | `/api/inference/models/{backend}` | Dashboard auth/session | Inference Models | `pkg/dashboard/api.go:375` | -| `GET` | `/api/hive-id` | Dashboard auth/session | Hive IDGet | `pkg/dashboard/api.go:439` | -| `PUT` | `/api/hive-id` | Owner only | Hive IDSet | `pkg/dashboard/api.go:440` | -| `POST` | `/api/chat` | Dashboard auth/session | Chat | `pkg/dashboard/api.go:471` | -| `GET` | `/api/auth/token` | Public | Auth Token | `pkg/dashboard/api.go:505` | -| `POST` | `/api/auth/github-link/revoke` | Owner | Revoke GitHub Login Link (owner revokes an identity's hub-proven link; a body naming a login is refused, #19992) | `pkg/dashboard/api.go:506` | +| `GET` | `/api/upstream-watch` | Owner only | Upstream-watch divergence: per watched fork the upstream followed, the watermark and last-run time, surfaced/ported/dismissed/skipped counts, and the recent upstream refs with their upstream URL, diff URL, fork issue number and state. Read-only — it reads the config and the watch state file, never GitHub. Also carries `interval`, `project_repos` and each repo's configured entry (`config`) for the editor. | `pkg/dashboard/api.go:301` | +| `PUT` | `/api/config/upstream-watch` | Owner only | Upstream Watch Config Update: edit `upstream_watch` from the Features tab. Body `{enabled?, interval?, repos?: {: {upstream?, sources?, pr_labels?, max_issues_per_run?, label?} \| null}}` — absent keys are unchanged, `null` removes a repo, keys are stored as the bare repo name. Validated with the loader's rules before the config changes (400 on failure), then persisted and audited as `config_upstream_watch`. | `pkg/dashboard/api.go:302` | + +| `GET` | `/api/hotspots` | Dashboard auth/session | Merge-hotspot advisor report (`?repo=owner/name` optional): files repeatedly touched by concurrent PRs over the last `governor.hotspot_window_days`, each with `prs` (distinct PRs), `pr_numbers`, `overlaps` (PR pairs open at the same time), `conflicts` (rebase conflicts blamed on the file), `lines`, `kind` (`code`/`doc`/`lock`/`generated`/`data`), `score`, `symbol_groups`, `recommendation` (`split-code`/`split-doc`/`split-source`/`report-only`/`none`), `reason`, `generated_from`, `source_files` (files under `generated_from`, when known), `issue_number`/`issue_url` of the modularize issue filed, `last_updated`; top-level `count`/`actionable`/`filed`. Derived from the merge train's own PR file lists and the rebase follow-through's conflict records — never lists PRs or files from GitHub. See [operator-reference.md § Merge-hotspot advisor](https://github.com/hivecommons/hive/blob/v5/src/docs/operator-reference.md#merge-hotspot-advisor-governorhotspot_). | `pkg/dashboard/api.go:560` | +| `GET` | `/api/widget` | Dashboard auth/session | Widget | `pkg/dashboard/api.go:110` | +| `GET` | `/api/pane/{agent}` | Dashboard auth/session | Pane | `pkg/dashboard/api.go:115` | +| `GET` | `/api/role` | Dashboard auth/session | Role | `pkg/dashboard/api.go:129` | +| `POST` | `/api/reset-restarts/{agent}` | Owner only | Reset Restarts | `pkg/dashboard/api.go:151` | +| `GET` | `/api/budget-ignore` | Dashboard auth/session | Budget Ignore Get | `pkg/dashboard/api.go:169` | +| `POST` | `/api/budget-ignore` | Owner only | Budget Ignore Set | `pkg/dashboard/api.go:170` | +| `GET` | `/api/summaries` | Dashboard auth/session | Summaries | `pkg/dashboard/api.go:182` | +| `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, `claimant: {kind: hive-agent|clanker|person, login, agent, hive, since, source: claim-ledger|claim-comment|assignee|kick-history|author}` naming who holds a claimed / in-progress issue or a PR under review or rework (absent when nobody is named; mirrored onto `linked_prs[]`), (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, `decision_needed` on a row parked on a person (085 / 045 / 015, the needs-human pill; mirrored onto the issue's `linked_prs[]` entry): `{question, asked_by, since, blocker, blocker_reason, options: [{action, label, enabled, reason_if_disabled}]}` — the reviewer's own decision question when the verdict record has one, the blocker in plain words, and the applicable actions under the row context menu's action ids (`decide:delegate` first), (PRs) `lineage` on the hive's copy of an adopted PR — `{kind: adopted|superseded|rebased-by-hive, from_number, from_url, from_author, from_author_kind, to_number, to_url, at, reason}`, derived from the stage store's adoption record or the `hive/adopt-` head branch, mirrored onto the issue's `linked_prs[]` entry; absent on every other row — and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_why` `{source: filed-for-help|decision-pending|level-gate|hive-hold|needs-approval|triage|author|needs-human, reason}` on every row a person must move (with `needs_human: true`; `filed_for_help` names the agent whose marker is in an unclaimed issue's body); `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close; a PR in a conflict-aware merge train carries `merge_train` `{id, state, front, position, size, attempt, max_attempts, overlap_files, ahead, length, head_number, head_state, head_reason, head_since, eta_s, eta_at, eta_basis, late, stalled, stalled_s}` — `head_state` one of `needs-human` / `ci` / `soaking` / `ready` / `merging` / `fixing` / `unknown` with `head_reason` in plain words; `eta_s` / `eta_at` the estimated wait for this member's own merge attempt (own remaining soak + each PR ahead's remaining soak or one sweep + the next sweep tick; absent while the head waits on a person or CI), `eta_at` anchored to the member's first estimate at its position so a countdown survives polls, `eta_basis` its short reading ("2 ahead · head soaking 12m · next sweep in 40s"), `late` once now has overrun the first estimate twice over, `stalled` / `stalled_s` once the head has sat longer than `governor.merge_train_stall_warn_s` ([#15395](https://github.com/hivecommons/hive/issues/15395)); a PR the queue holds because another open PR declares the same `Fixes #N` carries no `merge_train` and a `merge_gate` of `{state: "duplicate-of:", duplicate_of, duplicate_issue}` plus the `needs-decision` modifier (the queue keeps one PR per issue: green first, then the earlier-opened); a PR GitHub reports conflicting on its own, or one under repair (stage/070, 071, 072, 074, 085, or a red required check), carries no `merge_train` and is not counted in any member's `size` / `length` — a repaired member the view dropped carries `left_train: {why: fixing|needs-author|returned-to-contributor|adopted-by-hive|needs-decision|checks-failing, note}` instead (mirrored onto the issue's `linked_prs[]` entry), and a train left with one member reports no `merge_train` at all; a PR short of the merge queue (below stage/080) the planner ordered rides no train either — it carries `overlap: {behind, with, files, note}` ("overlaps #15637 (sidebar.html, index.html) — will queue behind it") and no `merge_train`, and counts in no member's `size` — the state slugs (`front`, `queued-behind`) are payload values only, the SPA renders ordinal places ("Queued for merge · 1st of 2", with the train's tag when more than one train is on the page). Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:183` | +| `GET` | `/api/matrix/lines` | Dashboard auth/session | Matrix Lines (deprecated name, see [Published-checkpoint regions](#published-checkpoint-regions)): serve bounded backlog of pushed lines behind dashboard.matrix with repo allowlist filtering. `max` counts only lines the repo allowlist admits, so a page is never emptied by filtered-out lines. A client paging with `max` should use the last returned line's `seq` as its next `since`, not the top-level `seq`, which is the source's latest sequence number and would skip lines still past the page. `more` is true only while another line the caller may see remains past the page; stop paging when it is false. | `pkg/dashboard/api.go:184` | +| `POST` | `/api/prs/{owner}/{repo}/{number}/queue-automerge` | Merger/owner role | Queue PRAuto Merge | `pkg/dashboard/api.go:185` | +| `GET` | `/api/inference/models/{backend}` | Dashboard auth/session | Inference Models | `pkg/dashboard/api.go:378` | +| `GET` | `/api/hive-id` | Dashboard auth/session | Hive IDGet | `pkg/dashboard/api.go:442` | +| `PUT` | `/api/hive-id` | Owner only | Hive IDSet | `pkg/dashboard/api.go:443` | +| `POST` | `/api/chat` | Dashboard auth/session | Chat | `pkg/dashboard/api.go:474` | +| `GET` | `/api/auth/token` | Public | Auth Token | `pkg/dashboard/api.go:508` | +| `POST` | `/api/auth/github-link/revoke` | Owner | Revoke GitHub Login Link (owner revokes an identity's hub-proven link; a body naming a login is refused, #19992) | `pkg/dashboard/api.go:509` | | `GET` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:351` | | `POST` | `/api/v1/` | GitHub token | Contributor v1 API dispatcher | `pkg/dashboard/api_contribute.go:352` | | `GET` | `/api/docs` | Dashboard auth/session | APIDocs | `pkg/dashboard/api_contribute.go:353` | @@ -131,7 +131,7 @@ review are settled. | `POST` | `/api/hives/{id}/heartbeat` | Dashboard auth/session | Hives Heartbeat | `pkg/dashboard/api_contribute.go:378` | | `DELETE` | `/api/hives/{id}` | Owner only | Hives Delete | `pkg/dashboard/api_contribute.go:379` | | `POST` | `/api/hives/onboard` | Dashboard auth/session | Hives Onboard | `pkg/dashboard/api_contribute.go:380` | -| `GET` | `/sso` | Public | SSO | `pkg/dashboard/server.go:1868` | +| `GET` | `/sso` | Public | SSO | `pkg/dashboard/server.go:1872` | ### Activity observation provenance The CI snapshot retains real check/node IDs, head, App ID and transition times. diff --git a/docs/content/hive/api-reference/health-status-events.md b/docs/content/hive/api-reference/health-status-events.md index 2d6571e7..a7be010f 100644 --- a/docs/content/hive/api-reference/health-status-events.md +++ b/docs/content/hive/api-reference/health-status-events.md @@ -30,20 +30,20 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | `GET` | `/api/version` | Dashboard auth/session | Build/version metadata; includes `upgradeMarker` (`target`, `current`, `attempts`, `maxAttempts`, `failed`, `requestedAt`, `lastError`) while a self-upgrade is in flight or has failed ([#6765](https://github.com/hivecommons/hive/issues/6765)), the hub-delivered `upgradePolicy` (`hub_managed`, `spoke_managed`, `schedule`, `schedule_hour`, `schedule_timezone`, `schedule_weekday`, `paused`, `branch`, `channel`, `target_sha`, `target_resolved`, `armed_target`, and `next_update_at` — the hub's RFC3339 ETA for the next promotion into the `stable` channel, omitted when unknown ([#10256](https://github.com/hivecommons/hive/issues/10256))) when available, and an `autoUpdate` object (`enabled`, `state` — one of `disabled`/`up_to_date`/`behind`/`retrying`/`failed`/`unknown` — `healthy`, `period`, `targetBranch`, `targetCommit`, `currentCommit`, `commitsBehind`, `lastAttemptAt`, `lastError`, `detail`, and `nextUpdateAt` — the hub's RFC3339 ETA for the next update, omitted when unknown, disabled or paused ([#10257](https://github.com/hivecommons/hive/issues/10257))) that never reports a failed or unknown update as healthy ([#6962](https://github.com/hivecommons/hive/issues/6962), [#6963](https://github.com/hivecommons/hive/issues/6963)). Also `startedAt` (RFC3339 process start — changes on every pod roll even when the build does not, so the dashboard can say "Restarted" vs "Upgraded") and, until the first status is published, `startupPhase`/`startupPhaseLabel` (the boot phase a fresh pod is in) ([#15788](https://github.com/hivecommons/hive/issues/15788)) | `pkg/dashboard/api.go:48` | | `GET` | `/api/version/release-notes` | Dashboard auth/session | Changelog gap between two revisions: `?from=&to=` returns `{from:{sha,version?}, to:{sha,ref,version?}, sections:[{version,date,categories:{added,changed,fixed,security,deprecated}}], unreleased?, truncated, source, error?}` — the `CHANGELOG.md` release sections present at `to` and absent at `from`, newest first, plus (when `to` is not a release tag) the `changelog.d/` fragments new at `to` under an `Unreleased (in this build)` section. Fetch failures return `source: "unavailable"` with `error` rather than an error status; results are cached per (from, to) for an hour ([#11065](https://github.com/hivecommons/hive/issues/11065)) | `pkg/dashboard/api.go:49` | | `GET` | `/api/version/contains` | Dashboard auth/session | Does the running build contain a PR or commit ([#18915](https://github.com/hivecommons/hive/issues/18915)): `?q=` returns `{query, commit?, running?, channel?, contains, reason?}`. `contains` is `yes`, `no` or `unknown`, computed from the commit this hive reports running (`hash` on `/api/version`) and repository ancestry; `unknown` (with `reason`) when the commit cannot be resolved, the lookup failed or the hive has no GitHub access, never a guess. An unmerged PR is `no`. `400` when `q` is neither a PR number nor a SHA | `pkg/dashboard/api_version_contains.go:113` | -| `POST` | `/api/release-channel` | Owner only | Hosted spoke self-service release-channel selector; relays `stable`/`candidate`/`edge` to the hub's existing switch-branch endpoint with the spoke dashboard-token proof, and reports the requested channel as pending until the Deployment image lands | `pkg/dashboard/api.go:73` | -| `GET` | `/api/health` | Public | Basic health probe | `pkg/dashboard/server.go:1837` | -| `GET` | `/api/health/deep` | Public | Deep health probe | `pkg/dashboard/server.go:1838` | -| `GET` | `/api/livez` | Public | Kubernetes liveness probe | `pkg/dashboard/server.go:1839` | -| `GET` | `/.well-known/openid-configuration` | Public only while `forgejo.integration.serve_key_list` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Discovery document of the spoke-served Forgejo integration key list: `issuer`, `jwks_uri`, signing algorithms. GET only, rate limited per client address ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/forge-app-setup.md#let-the-spoke-serve-the-key-list)) | `pkg/dashboard/server.go:1842` | -| `GET` | `/jwks.json` | Public only while `forgejo.integration.serve_key_list` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Forgejo integration key list (JWKS) from `key_file` and `previous_key_files`, public keys only. GET only, rate limited per client address ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/forge-app-setup.md#let-the-spoke-serve-the-key-list)) | `pkg/dashboard/server.go:1843` | -| `GET` | `/metrics` | Registered only when `HIVE_METRICS_ENABLED`; requires `Authorization: ****** (403 if the token is unset) | Prometheus metrics | `pkg/dashboard/server.go:1849` | -| `GET` | `/api/status` | Dashboard auth/session | Dashboard aggregate status; `labelPresets[]` (`{key,label,description,labels[],states[]}`) lists the built-in label-filter presets for the Projects cards, led by `needs-human` whose `labels[]` are the effective hard-suppress labels plus `needs-signal`, the hold labels, `stage/071-needs-author` and the reporter-trust awaiting label (#12172); accepts `?fields=a,b` for top-level selection and `?omit=repos` to drop heavy sections, and honors `Accept-Encoding: gzip`; `agents[]` includes busy-pane visibility fields (`kicksUndeliverable`, `busySince`, `lastTranscriptActivity`, `condition`, `conditionMessage`) when a Working pane cannot accept kicks; a working agent also carries `agents[].run` — the live per-run line (#14576): `{since, elapsedS, costUSD, tokens, priced, tests, filesChanged}`, the estimated spend/tokens since the kick was delivered (`lastKickAt`, falling back to `busySince`) (delta of the token collector's per-agent cumulative figure; `priced:false` when the agent has none yet), the last visible test-runner result (`pass`/`fail`/empty) and the last `N files changed` git summary (`-1` when none) parsed from the captured pane; top-level `fleetRun` `{running, hourUSD, hourPriced, dayUSD, weekUSD, monthUSD, windowsPriced}` is the governor strip's rotating `running N · $X this hour / today / this week / this month` figure (#15614) — the hour is the rise since the top of the clock hour, the wider windows are the daily cost ledger summed from 00:00 UTC today, Monday 00:00 UTC (ISO week) and the 1st 00:00 UTC plus the rise since the ledger's last snapshot, `windowsPriced:false` when there is no ledger yet; `sla` (fleet) and `repos[].sla` (per repo) carry the Delivery SLA block derived from the lifecycle timeline with no extra GitHub calls: `windows.{7d,30d}.{open_to_triage,triage_to_start,start_to_pr,pr_to_merge,open_to_merge}` as `{p50_h,p95_h,n}` (hours, nearest-rank), `history[]` of up to 30 daily buckets `{day,start_to_pr_p50,pr_to_merge_p50,open_to_merge_p50,n_started,n_pr,n_merged}` persisted under `/data/sla-history.json`, `stale_in_progress[]` (`{number,repo,started_at,age_h,agent}` — issues carrying `hive/in-progress` longer than the agent claim TTL with no linked PR), `stale_count`, `merged_7d`, `claim_ttl_s` and, on the fleet block, the effective `targets` (`start_to_pr_h`, `pr_to_merge_h`, `open_to_merge_h`); `staleSince` and `repos[].countsStale` / `countsStaleSince` mark totals served from last-good figures — the previous enumeration (#13382) or the ForgeState cache's last-good counts (#13376); `ci_failure_signals` `{count, last, kicks, unmatched}` is the webhook CI-failure signal store — distinct red (repo, head, check) signals retained, the most recent one `{repo, number, head_sha, check, conclusion, details_url, agent, at}`, webhook-triggered kicks/nudges since boot, and failure deliveries whose head matched no open PR; `workflow_approvals` `{approved, denied, permission_errors, last}` counts the hive's approvals of GitHub-gated workflow runs since boot (#16603) — runs approved, runs refused by the trust policy (once per head), `403`/`404` refusals for want of `actions: write`, and the most recent decision `{repo, number, head, run_id, outcome, at}`; `hotspots` `{count, actionable, filed}` is the merge-hotspot advisor's one-line summary (files at/above the thresholds, those with a split recommendation, those with a modularize issue filed), absent when the advisor is not wired — details on `GET /api/hotspots`; `writeback.dedupe` `{enabled, dedupe_same_item, dedupe_burst, rate_capped, hourly_cap, burst_items, burst_window_s, same_item_ttl_s}` is the write-back gate's content layer — the effective `writeback.dedupe.*` settings and the last-hour counts of writes held as `duplicate`, `burst` and `rate-capped` (each also listed under `GET /api/writeback/suppressed`); `referenceRepos[]` `{full, tier, reference_tier}` lists `project.reference_repos` apart from `repos[]` — `reference_tier` is `read-only`, `issues`, `prs` or `issues+prs` (`tier` is the same value, kept for older clients) and an entry carries no ACMM, work-item or pause fields, since a reference repo is studied, not worked (#18021); `config.gate_regressions[]` `{gate, previous, effective, source}` is the boot-time safety-gate regression list (#16438) — gates a previous runtime overlay on the PVC carried that the running config lacks or loosens (`review.require_labels`, `project.issue_filter.require_labels`, `project.paused_repos[]`, `writeback.per_repo[].mode`), empty on a healthy boot | `pkg/dashboard/server.go:1854` | -| `GET` | `/api/status/summary` | Dashboard auth/session | Compact agent/governor/budget status summary for pollers; honors `Accept-Encoding: gzip` | `pkg/dashboard/server.go:1855` | -| `GET` | `/api/overview/issues.csv` | Dashboard auth/session | Cached Overview issue-band export as browser-compatible CSV; filters `band`, `repo`/`repos`, `stale`, and `held` are ANDed. | `pkg/dashboard/server.go:1856` | -| `GET` | `/api/overview/issues.json` | Dashboard auth/session | Cached Overview issue-band export as typed JSON with `bands[]` metadata and row fields matching the CSV columns. | `pkg/dashboard/server.go:1857` | -| `GET` | `/api/overview/prs.csv` | Dashboard auth/session | Cached Overview PR-band export as browser-compatible CSV; filters `band`, `repo`/`repos`, `stale`, and `held` are ANDed. | `pkg/dashboard/server.go:1858` | -| `GET` | `/api/overview/prs.json` | Dashboard auth/session | Cached Overview PR-band export as typed JSON with `bands[]` metadata and row fields matching the CSV columns. | `pkg/dashboard/server.go:1859` | -| `GET` | `/api/events` | Dashboard auth/session | Server-sent event stream | `pkg/dashboard/server.go:1860` | +| `POST` | `/api/release-channel` | Owner only | Hosted spoke self-service release-channel selector; relays `stable`/`candidate`/`edge` to the hub's existing switch-branch endpoint with the spoke dashboard-token proof, and reports the requested channel as pending until the Deployment image lands | `pkg/dashboard/api.go:74` | +| `GET` | `/api/health` | Public | Basic health probe | `pkg/dashboard/server.go:1841` | +| `GET` | `/api/health/deep` | Public | Deep health probe | `pkg/dashboard/server.go:1842` | +| `GET` | `/api/livez` | Public | Kubernetes liveness probe | `pkg/dashboard/server.go:1843` | +| `GET` | `/.well-known/openid-configuration` | Public only while `forgejo.integration.serve_key_list` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Discovery document of the spoke-served Forgejo integration key list: `issuer`, `jwks_uri`, signing algorithms. GET only, rate limited per client address ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/forge-app-setup.md#let-the-spoke-serve-the-key-list)) | `pkg/dashboard/server.go:1846` | +| `GET` | `/jwks.json` | Public only while `forgejo.integration.serve_key_list` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Forgejo integration key list (JWKS) from `key_file` and `previous_key_files`, public keys only. GET only, rate limited per client address ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/forge-app-setup.md#let-the-spoke-serve-the-key-list)) | `pkg/dashboard/server.go:1847` | +| `GET` | `/metrics` | Registered only when `HIVE_METRICS_ENABLED`; requires `Authorization: ****** (403 if the token is unset) | Prometheus metrics | `pkg/dashboard/server.go:1853` | +| `GET` | `/api/status` | Dashboard auth/session | Dashboard aggregate status; `labelPresets[]` (`{key,label,description,labels[],states[]}`) lists the built-in label-filter presets for the Projects cards, led by `needs-human` whose `labels[]` are the effective hard-suppress labels plus `needs-signal`, the hold labels, `stage/071-needs-author` and the reporter-trust awaiting label (#12172); accepts `?fields=a,b` for top-level selection and `?omit=repos` to drop heavy sections, and honors `Accept-Encoding: gzip`; `agents[]` includes busy-pane visibility fields (`kicksUndeliverable`, `busySince`, `lastTranscriptActivity`, `condition`, `conditionMessage`) when a Working pane cannot accept kicks; a working agent also carries `agents[].run` — the live per-run line (#14576): `{since, elapsedS, costUSD, tokens, priced, tests, filesChanged}`, the estimated spend/tokens since the kick was delivered (`lastKickAt`, falling back to `busySince`) (delta of the token collector's per-agent cumulative figure; `priced:false` when the agent has none yet), the last visible test-runner result (`pass`/`fail`/empty) and the last `N files changed` git summary (`-1` when none) parsed from the captured pane; top-level `fleetRun` `{running, hourUSD, hourPriced, dayUSD, weekUSD, monthUSD, windowsPriced}` is the governor strip's rotating `running N · $X this hour / today / this week / this month` figure (#15614) — the hour is the rise since the top of the clock hour, the wider windows are the daily cost ledger summed from 00:00 UTC today, Monday 00:00 UTC (ISO week) and the 1st 00:00 UTC plus the rise since the ledger's last snapshot, `windowsPriced:false` when there is no ledger yet; `sla` (fleet) and `repos[].sla` (per repo) carry the Delivery SLA block derived from the lifecycle timeline with no extra GitHub calls: `windows.{7d,30d}.{open_to_triage,triage_to_start,start_to_pr,pr_to_merge,open_to_merge}` as `{p50_h,p95_h,n}` (hours, nearest-rank), `history[]` of up to 30 daily buckets `{day,start_to_pr_p50,pr_to_merge_p50,open_to_merge_p50,n_started,n_pr,n_merged}` persisted under `/data/sla-history.json`, `stale_in_progress[]` (`{number,repo,started_at,age_h,agent}` — issues carrying `hive/in-progress` longer than the agent claim TTL with no linked PR), `stale_count`, `merged_7d`, `claim_ttl_s` and, on the fleet block, the effective `targets` (`start_to_pr_h`, `pr_to_merge_h`, `open_to_merge_h`); `staleSince` and `repos[].countsStale` / `countsStaleSince` mark totals served from last-good figures — the previous enumeration (#13382) or the ForgeState cache's last-good counts (#13376); `ci_failure_signals` `{count, last, kicks, unmatched}` is the webhook CI-failure signal store — distinct red (repo, head, check) signals retained, the most recent one `{repo, number, head_sha, check, conclusion, details_url, agent, at}`, webhook-triggered kicks/nudges since boot, and failure deliveries whose head matched no open PR; `workflow_approvals` `{approved, denied, permission_errors, last}` counts the hive's approvals of GitHub-gated workflow runs since boot (#16603) — runs approved, runs refused by the trust policy (once per head), `403`/`404` refusals for want of `actions: write`, and the most recent decision `{repo, number, head, run_id, outcome, at}`; `hotspots` `{count, actionable, filed}` is the merge-hotspot advisor's one-line summary (files at/above the thresholds, those with a split recommendation, those with a modularize issue filed), absent when the advisor is not wired — details on `GET /api/hotspots`; `writeback.dedupe` `{enabled, dedupe_same_item, dedupe_burst, rate_capped, hourly_cap, burst_items, burst_window_s, same_item_ttl_s}` is the write-back gate's content layer — the effective `writeback.dedupe.*` settings and the last-hour counts of writes held as `duplicate`, `burst` and `rate-capped` (each also listed under `GET /api/writeback/suppressed`); `referenceRepos[]` `{full, tier, reference_tier}` lists `project.reference_repos` apart from `repos[]` — `reference_tier` is `read-only`, `issues`, `prs` or `issues+prs` (`tier` is the same value, kept for older clients) and an entry carries no ACMM, work-item or pause fields, since a reference repo is studied, not worked (#18021); `config.gate_regressions[]` `{gate, previous, effective, source}` is the boot-time safety-gate regression list (#16438) — gates a previous runtime overlay on the PVC carried that the running config lacks or loosens (`review.require_labels`, `project.issue_filter.require_labels`, `project.paused_repos[]`, `writeback.per_repo[].mode`), empty on a healthy boot | `pkg/dashboard/server.go:1858` | +| `GET` | `/api/status/summary` | Dashboard auth/session | Compact agent/governor/budget status summary for pollers; honors `Accept-Encoding: gzip` | `pkg/dashboard/server.go:1859` | +| `GET` | `/api/overview/issues.csv` | Dashboard auth/session | Cached Overview issue-band export as browser-compatible CSV; filters `band`, `repo`/`repos`, `stale`, and `held` are ANDed. | `pkg/dashboard/server.go:1860` | +| `GET` | `/api/overview/issues.json` | Dashboard auth/session | Cached Overview issue-band export as typed JSON with `bands[]` metadata and row fields matching the CSV columns. | `pkg/dashboard/server.go:1861` | +| `GET` | `/api/overview/prs.csv` | Dashboard auth/session | Cached Overview PR-band export as browser-compatible CSV; filters `band`, `repo`/`repos`, `stale`, and `held` are ANDed. | `pkg/dashboard/server.go:1862` | +| `GET` | `/api/overview/prs.json` | Dashboard auth/session | Cached Overview PR-band export as typed JSON with `bands[]` metadata and row fields matching the CSV columns. | `pkg/dashboard/server.go:1863` | +| `GET` | `/api/events` | Dashboard auth/session | Server-sent event stream | `pkg/dashboard/server.go:1864` | | `GET` | `/api/swarm` | Dashboard auth/session | Current swarm status: display name, duration, active repo, expiry, persisted prep metrics when available, and idle-unlock fields. | `pkg/dashboard/swarm.go:310` | | `POST` | `/api/swarm` | Owner only | Start a 24h repo swarm for a configured repo, returning 409 when another swarm is active and 423 when a previous swarm keeps the next swarm locked until enough agents are idle unless body `{"repo":"owner/name","force":true}` is used; saves the active record before repo prep, persists prep metrics, and announces the start to Discord when configured. | `pkg/dashboard/swarm.go:311` | | `DELETE` | `/api/swarm` | Owner only | End the active swarm, score issues closed and PRs merged in the window, append it to history, and announce the result to Discord when configured. | `pkg/dashboard/swarm.go:312` | @@ -53,11 +53,11 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | `PUT` | `/api/swarm/themes` | Owner only | Set a per-repo swarm theme (`event_name`, `call_to_arms`, `leaderboard_title`). | `pkg/dashboard/swarm.go:316` | | `PATCH` | `/api/swarm/objectives` | Owner only | Update the active swarm SDLC objective checklist completion state. | `pkg/dashboard/swarm.go:317` | | `GET` | `/api/leaderboard/swarm` | Public | Stable public JSON record of swarm history, leaderboard, top players, and achievements. | `pkg/dashboard/swarm.go:318` | -| `GET` | `/api/runs` | Dashboard auth/session | Active staged runs projected from task leases, plans, and lifecycle timeline. Returns an array of `Run` objects: canonical `key` (`owner/repo#number`), current-stage `lease_key`, `title`, `repo` (`owner/repo`), `stage`, `gen`, `stage_started_at`, `waiting_on` (`agent`, `remote`, `human`, `ci`, `none`), `waiting_since`, `assignee`, `last_receipt`, `plan_epic_id`, and `stages[]` (`name`, `status`, `gen`, `receipt`). | `pkg/dashboard/api.go:101` | -| `GET` | `/api/runs/audit` | Owner only | Read-only cross-repo audit query over existing retained artifacts. Query `repo`, canonical `run` (`owner/repo#number`), RFC3339 `since`/`until`, `kind`, `limit` (default 100, max 500), and `page_token`. Returns `{items,next_page_token,retention}`; each item has `source` (`audit_log`, `timeline`, `lease_receipt`, `plan_epic`), `kind`, `run`, `repo`, `at`, `actor`, `artifact_id`, `attrs`, or an explicit `kind=expired,status=expired,state=Unknown` marker when requested history may have aged out. | `pkg/dashboard/api.go:102` | -| `POST` | `/api/runs/audit` | Owner only | Activate the convergence audit campaign over a scope directory. Body `{"campaign_key":"audit-campaign","scope_dir":"/data/convergence/audit/scope","store":"audit","generation":1,"run_key":"","run_url":""}`; `scope_dir` defaults to `/data/convergence/audit/scope`, `store` defaults to `audit`, `auditor`, `scanner`, `supervisor`, then the first configured bead store. Runs inspection even when `publication.enabled` is false, but then skips the publisher and returns `publication_skipped:true` with reason `publication.disabled`. | `pkg/dashboard/api.go:103` | -| `GET` | `/api/runs/{key}/checkpoint` | Dashboard auth/session | Compact mobile/chat checkpoint review payload for a held run. Returns `run_key`, `stage`, lease `gen`, `repo`, `title`, capped plain-text `summary`, approve/reject `decisions`, dashboard deep link, `lease_gen` staleness fence, and verified-owner approver rule. | `pkg/dashboard/api.go:105` | -| `POST` | `/api/runs/{key}/checkpoint` | Owner only | Resolve a compact checkpoint decision. Body `{"action":"approve"|"reject","gen":}`; refuses stale generations with 409 and non-owner callers with 403 before mutating the plan. | `pkg/dashboard/api.go:106` | -| `GET` | `/api/runs/{key}` | Dashboard auth/session | One run by URL-escaped canonical run key (`owner/repo%23number`); early lease-shaped keys (`repo!run-key:stage`) and queued Wavefront run-stage keys (`owner/repo!graph:node`) are also accepted. Includes timeline-derived stage history in the same `Run` shape as `/api/runs` when a lease/timeline exists. History entries that came from an owner reset carry the owner's `reason`. When the key belongs to a wired convergence campaign, the detail response also includes an optional `burndown` block with `source`, `satisfied`, `remaining`, `unknown`, and `scope`; the list endpoint omits this block. | `pkg/dashboard/api.go:107` | -| `POST` | `/api/runs/{key}/reset` | Owner only | Move a run's lease back to an earlier stage (for example `implement` to `plan` after a rejected plan). Body `{"to": "", "reason": ""}`, both required. Mints a new generation so the relay holding the old one can no longer resume, persists before answering, and records the reason on the agent audit sink, the lifecycle timeline, and the `stage_completed` hook payload (`attrs.reset = "true"`). Returns `{ok, key, stage_from, stage, gen, reason}`. 400 for the same or a later stage or a missing reason, 404 when no live staged lease holds the key, 409 when the lease expired, 500 when the registry could not be written. | `pkg/dashboard/api.go:108` | -| `GET` | `/api/runs/{key}/trace` | Dashboard auth/session | Resolve `Hive-Run`, `Hive-Plan`, and `Hive-Spec` commit trailers for `?sha=...`, returning the linked plan section, spek clause, approval audit record, rationale audit entries, and typed no-linkage results when trailers are missing. | `pkg/dashboard/api.go:104` | +| `GET` | `/api/runs` | Dashboard auth/session | Active staged runs projected from task leases, plans, and lifecycle timeline. Returns an array of `Run` objects: canonical `key` (`owner/repo#number`), current-stage `lease_key`, `title`, `repo` (`owner/repo`), `stage`, `gen`, `stage_started_at`, `waiting_on` (`agent`, `remote`, `human`, `ci`, `none`), `waiting_since`, `assignee`, `last_receipt`, `plan_epic_id`, and `stages[]` (`name`, `status`, `gen`, `receipt`). | `pkg/dashboard/api.go:102` | +| `GET` | `/api/runs/audit` | Owner only | Read-only cross-repo audit query over existing retained artifacts. Query `repo`, canonical `run` (`owner/repo#number`), RFC3339 `since`/`until`, `kind`, `limit` (default 100, max 500), and `page_token`. Returns `{items,next_page_token,retention}`; each item has `source` (`audit_log`, `timeline`, `lease_receipt`, `plan_epic`), `kind`, `run`, `repo`, `at`, `actor`, `artifact_id`, `attrs`, or an explicit `kind=expired,status=expired,state=Unknown` marker when requested history may have aged out. | `pkg/dashboard/api.go:103` | +| `POST` | `/api/runs/audit` | Owner only | Activate the convergence audit campaign over a scope directory. Body `{"campaign_key":"audit-campaign","scope_dir":"/data/convergence/audit/scope","store":"audit","generation":1,"run_key":"","run_url":""}`; `scope_dir` defaults to `/data/convergence/audit/scope`, `store` defaults to `audit`, `auditor`, `scanner`, `supervisor`, then the first configured bead store. Runs inspection even when `publication.enabled` is false, but then skips the publisher and returns `publication_skipped:true` with reason `publication.disabled`. | `pkg/dashboard/api.go:104` | +| `GET` | `/api/runs/{key}/checkpoint` | Dashboard auth/session | Compact mobile/chat checkpoint review payload for a held run. Returns `run_key`, `stage`, lease `gen`, `repo`, `title`, capped plain-text `summary`, approve/reject `decisions`, dashboard deep link, `lease_gen` staleness fence, and verified-owner approver rule. | `pkg/dashboard/api.go:106` | +| `POST` | `/api/runs/{key}/checkpoint` | Owner only | Resolve a compact checkpoint decision. Body `{"action":"approve"|"reject","gen":}`; refuses stale generations with 409 and non-owner callers with 403 before mutating the plan. | `pkg/dashboard/api.go:107` | +| `GET` | `/api/runs/{key}` | Dashboard auth/session | One run by URL-escaped canonical run key (`owner/repo%23number`); early lease-shaped keys (`repo!run-key:stage`) and queued Wavefront run-stage keys (`owner/repo!graph:node`) are also accepted. Includes timeline-derived stage history in the same `Run` shape as `/api/runs` when a lease/timeline exists. History entries that came from an owner reset carry the owner's `reason`. When the key belongs to a wired convergence campaign, the detail response also includes an optional `burndown` block with `source`, `satisfied`, `remaining`, `unknown`, and `scope`; the list endpoint omits this block. | `pkg/dashboard/api.go:108` | +| `POST` | `/api/runs/{key}/reset` | Owner only | Move a run's lease back to an earlier stage (for example `implement` to `plan` after a rejected plan). Body `{"to": "", "reason": ""}`, both required. Mints a new generation so the relay holding the old one can no longer resume, persists before answering, and records the reason on the agent audit sink, the lifecycle timeline, and the `stage_completed` hook payload (`attrs.reset = "true"`). Returns `{ok, key, stage_from, stage, gen, reason}`. 400 for the same or a later stage or a missing reason, 404 when no live staged lease holds the key, 409 when the lease expired, 500 when the registry could not be written. | `pkg/dashboard/api.go:109` | +| `GET` | `/api/runs/{key}/trace` | Dashboard auth/session | Resolve `Hive-Run`, `Hive-Plan`, and `Hive-Spec` commit trailers for `?sha=...`, returning the linked plan section, spek clause, approval audit record, rationale audit entries, and typed no-linkage results when trailers are missing. | `pkg/dashboard/api.go:105` | diff --git a/docs/content/hive/api-reference/hub-saas.md b/docs/content/hive/api-reference/hub-saas.md index f6dc258b..5c8384a1 100644 --- a/docs/content/hive/api-reference/hub-saas.md +++ b/docs/content/hive/api-reference/hub-saas.md @@ -7,114 +7,117 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/saas/my-hives` | Hub auth | My Hives. Each row carries `quadrant` and the payload carries `fleet_quadrant` ([#12458](https://github.com/hivecommons/hive/issues/12458)): `axes[]` of `{axis, score, scored, reason?, delta, nudge?, criteria[], measured, unmeasured, summary?, n?}` where each `criteria[]` entry is `{name, label, measured, value, display?, score, weight, how, good, reason?, n?}`; every criterion maps to 0–100 on a fixed named curve, an axis is the weighted mean of its *measured* criteria only (an unmeasured criterion is listed with `reason` and excluded, never scored 0), `composite` averages the scored axes, and `fleet_quadrant` is the per-axis **median** across hives in view (`aggregate: "median"`, `n` hives) with each criterion's median value. `delta` is the hive minus the fleet median. Shape is additive over the earlier `axes[]{axis,score,scored,reason,delta,nudge}`/`composite`/`scored_axes` payload. See [Fleet quadrant](/docs/hive/hub/fleet-health#fleet-quadrant) | `pkg/hub/saas.go:399`, `pkg/hub/quadrant.go` | -| `GET` | `/api/hub/widget` | Hub auth | iPhone fleet widget ([#12148](https://github.com/hivecommons/hive/issues/12148)): every hive the caller can see (hub admins: all; others: hives they own or hold a role on; pool placeholders excluded), sorted by `act_issues + act_prs` descending. Per hive `id`, `project`, `url`, `online`, `acmm_level`, `issues`, `prs` (all open, from the heartbeat; 0 from spokes that do not report them), `act_issues`, `act_prs`, `agents_running`, `agents_total`, `last_heartbeat`; `totals` (`hives`, `online`, `need_you`, the same counts summed) and `history` (fleet `act_issues`/`act_prs` per 15-minute bucket, `t` in Unix seconds, at most 48 points). See [iOS widget](https://github.com/hivecommons/hive/blob/v5/src/docs/ios-widget.md#fleet-widget-hub-mode) | `pkg/hub/saas.go:400` | -| `GET` | `/api/saas/usage` | Hub auth | Usage | `pkg/hub/saas.go:409` | -| `POST` | `/api/saas/hives` | Hub auth | Create Hive | `pkg/hub/saas.go:419` | -| `GET` | `/api/saas/hives/{id}/status` | Hub auth | Hive Status | `pkg/hub/saas.go:420` | +| `GET` | `/api/saas/my-hives` | Hub auth | My Hives. Each row carries `quadrant` and the payload carries `fleet_quadrant` ([#12458](https://github.com/hivecommons/hive/issues/12458)): `axes[]` of `{axis, score, scored, reason?, delta, nudge?, criteria[], measured, unmeasured, summary?, n?}` where each `criteria[]` entry is `{name, label, measured, value, display?, score, weight, how, good, reason?, n?}`; every criterion maps to 0–100 on a fixed named curve, an axis is the weighted mean of its *measured* criteria only (an unmeasured criterion is listed with `reason` and excluded, never scored 0), `composite` averages the scored axes, and `fleet_quadrant` is the per-axis **median** across hives in view (`aggregate: "median"`, `n` hives) with each criterion's median value. `delta` is the hive minus the fleet median. Shape is additive over the earlier `axes[]{axis,score,scored,reason,delta,nudge}`/`composite`/`scored_axes` payload. See [Fleet quadrant](/docs/hive/hub/fleet-health#fleet-quadrant) | `pkg/hub/saas.go:407`, `pkg/hub/quadrant.go` | +| `GET` | `/api/hub/widget` | Hub auth | iPhone fleet widget ([#12148](https://github.com/hivecommons/hive/issues/12148)): every hive the caller can see (hub admins: all; others: hives they own or hold a role on; pool placeholders excluded), sorted by `act_issues + act_prs` descending. Per hive `id`, `project`, `url`, `online`, `acmm_level`, `issues`, `prs` (all open, from the heartbeat; 0 from spokes that do not report them), `act_issues`, `act_prs`, `agents_running`, `agents_total`, `last_heartbeat`; `totals` (`hives`, `online`, `need_you`, the same counts summed) and `history` (fleet `act_issues`/`act_prs` per 15-minute bucket, `t` in Unix seconds, at most 48 points). See [iOS widget](https://github.com/hivecommons/hive/blob/v5/src/docs/ios-widget.md#fleet-widget-hub-mode) | `pkg/hub/saas.go:408` | +| `GET` | `/api/saas/usage` | Hub auth | Usage | `pkg/hub/saas.go:417` | +| `POST` | `/api/saas/hives` | Hub auth | Create Hive | `pkg/hub/saas.go:427` | +| `GET` | `/api/saas/hives/{id}/status` | Hub auth | Hive Status | `pkg/hub/saas.go:428` | | `POST` | `/api/saas/hives/{id}/pin-digest` | Hub auth (owner or admin) | Pin Digest - hold the spoke at an immutable image digest (`{"digest":"sha256:..."}` or `{"sha":""}`, optional `reason`) | `pkg/hub/digest_pin.go` | | `POST` | `/api/saas/hives/{id}/unpin-digest` | Hub auth (owner or admin) | Unpin Digest - lift the pin and return to the tracked channel or branch tag | `pkg/hub/digest_pin.go` | | `GET` | `/api/saas/hives/{id}/digest-pin` | Hub auth (owner or admin) | Digest Pin - the pin with provenance and whether the spoke reports running it | `pkg/hub/digest_pin.go` | -| `GET` | `/api/saas/hives/{id}/open` | Hub handler-specific | Open Hive | `pkg/hub/saas.go:425` | -| `DELETE` | `/api/saas/hives/{id}` | Hub auth (owner or admin) | Delete Hive | `pkg/hub/saas.go:426` | -| `POST` | `/api/saas/hives/{id}/upgrade` | Hub auth | Upgrade Hive - arms heartbeat delivery (`200 {"status":"upgrading"}`); a spoke already at its reachable target is a no-op `200 {"status":"current","current","target","channel","message"}`, not an error | `pkg/hub/saas.go:427` | -| `POST` | `/api/saas/hives/{id}/switch-branch` | Hub auth | Switch Branch | `pkg/hub/saas.go:428` | -| `PUT` | `/api/saas/hives/{id}/visibility` | Hub auth | Toggle Visibility | `pkg/hub/saas.go:435` | -| `PUT` | `/api/saas/hives/{id}/auto-upgrade` | Hub auth | Toggle Auto Upgrade | `pkg/hub/saas.go:436` | -| `PUT` | `/api/saas/hives/{id}/name` | Hub auth | Rename Hive | `pkg/hub/saas.go:440` | -| `POST` | `/api/saas/hives/{id}/forge` | Hub auth | Switch Forge | `pkg/hub/saas.go:445` | -| `POST` | `/api/saas/hives/{id}/reset-app` | Hub auth | Reset App | `pkg/hub/saas.go:446` | -| `POST` | `/api/saas/hives/{id}/restart-spoke` | Hub auth | Restart Spoke | `pkg/hub/saas.go:451` | -| `POST` | `/api/saas/hives/{id}/breaker` | Hub auth | Pause / Resume Hive (fleet breaker) | `pkg/hub/saas.go:454` | -| `GET` | `/api/saas/hive-config/{hiveID}` | Hub auth | Proxy Hive Config | `pkg/hub/saas.go:455` | -| `GET` | `/api/saas/latest-sha` | Hub handler-specific | Latest SHA | `pkg/hub/saas.go:456` | -| `GET` | `/api/hub/release/stable-promotion` | Public | Stable Promotion State | `pkg/hub/saas.go:458` | -| `POST` | `/api/saas/hub/upgrade` | Hub handler-specific | Hub Self Upgrade | `pkg/hub/saas.go:459` | -| `PUT` | `/api/saas/hub/auto-upgrade` | Hub handler-specific | Hub Auto Upgrade | `pkg/hub/saas.go:460` | -| `PUT` | `/api/hub/release/stable-promotion` | Hub admin | Stable Promotion Toggle (audit-logged) | `pkg/hub/saas.go:461` | -| `GET` | `/api/saas/auth-check` | Hub handler-specific | Saa SAuth Check | `pkg/hub/saas.go:466` | -| `POST` | `/api/saas/user-token` | Hub auth | User Token | `pkg/hub/saas.go:477` | -| `GET` | `/api/saas/hives/{id}/access` | Hub auth | Access List | `pkg/hub/saas.go:478` | -| `GET` | `/api/saas/grantable-users` | Hub auth | Grantable Users | `pkg/hub/saas.go:479` | -| `POST` | `/api/saas/hives/{id}/access` | Hub auth | Access Add | `pkg/hub/saas.go:480` | -| `DELETE` | `/api/saas/hives/{id}/access/{username}` | Hub auth | Access Remove | `pkg/hub/saas.go:481` | -| `POST` | `/api/saas/hives/{id}/request-access` | Hub auth | Request Access | `pkg/hub/saas.go:482` | -| `GET` | `/api/saas/hives/{id}/requests` | Hub auth | Get Requests | `pkg/hub/saas.go:483` | -| `GET` | `/api/saas/hives/{id}/timeline` | Hub auth | Hive Timeline | `pkg/hub/saas.go:484` | -| `POST` | `/api/saas/hives/{id}/requests/{username}/approve` | Hub auth | Approve Request | `pkg/hub/saas.go:486` | -| `POST` | `/api/saas/hives/{id}/requests/{username}/deny` | Hub auth | Deny Request | `pkg/hub/saas.go:487` | -| `PUT` | `/api/saas/hives/{id}/approve-access/{username}` | Hub auth | Approve Access | `pkg/hub/saas.go:488` | -| `DELETE` | `/api/saas/hives/{id}/deny-access/{username}` | Hub auth | Deny Access | `pkg/hub/saas.go:489` | -| `GET` | `/api/saas/access-status` | Hub handler-specific | Access Status | `pkg/hub/saas.go:490` | -| `POST` | `/api/saas/request-provision` | Hub auth | Request Provision | `pkg/hub/saas.go:498` | -| `PUT` | `/api/saas/approve-provision/{username}` | Hub handler-specific | Approve Provision | `pkg/hub/saas.go:499` | -| `DELETE` | `/api/saas/deny-provision/{username}` | Hub handler-specific | Deny Provision | `pkg/hub/saas.go:500` | -| `GET` | `/api/saas/admin/available-placeholders` | Hub handler-specific | Available Placeholders | `pkg/hub/saas.go:501` | -| `GET` | `/api/saas/admin/users` | Hub handler-specific | Admin Users | `pkg/hub/saas.go:504` | +| `GET` | `/api/saas/hives/{id}/open` | Hub handler-specific | Open Hive. When the spoke answers 502/503/504 or has an upgrade in flight, serves the hub's branded waiting page (200) instead of redirecting; `?open_anyway=1` skips that gate. See [Opening a hive that is down or upgrading](/docs/hive/hosted-hive-upgrade-gate) | `pkg/hub/saas.go:433` | +| `GET` | `/api/saas/hives/{id}/open-status` | Hub handler-specific (same access check as `/open`) | Open gate status polled by the waiting page: `{ready, upgrading, targetVersion?}`; 401 signed out, 403 no access (identical for missing hives) | `pkg/hub/saas.go:436` | +| `DELETE` | `/api/saas/hives/{id}` | Hub auth (owner or admin) | Delete Hive | `pkg/hub/saas.go:437` | +| `POST` | `/api/saas/hives/{id}/upgrade` | Hub auth | Upgrade Hive - arms heartbeat delivery (`200 {"status":"upgrading"}`); a spoke already at its reachable target is a no-op `200 {"status":"current","current","target","channel","message"}`, not an error | `pkg/hub/saas.go:438` | +| `POST` | `/api/saas/hives/{id}/switch-branch` | Hub auth | Switch Branch | `pkg/hub/saas.go:439` | +| `PUT` | `/api/saas/hives/{id}/visibility` | Hub auth | Toggle Visibility | `pkg/hub/saas.go:446` | +| `PUT` | `/api/saas/hives/{id}/auto-upgrade` | Hub auth | Toggle Auto Upgrade | `pkg/hub/saas.go:447` | +| `PUT` | `/api/saas/hives/{id}/name` | Hub auth | Rename Hive | `pkg/hub/saas.go:451` | +| `POST` | `/api/saas/hives/{id}/forge` | Hub auth | Switch Forge | `pkg/hub/saas.go:456` | +| `POST` | `/api/saas/hives/{id}/reset-app` | Hub auth | Reset App | `pkg/hub/saas.go:457` | +| `POST` | `/api/saas/hives/{id}/restart-spoke` | Hub auth | Restart Spoke | `pkg/hub/saas.go:462` | +| `POST` | `/api/saas/hives/{id}/breaker` | Hub auth | Pause / Resume Hive (fleet breaker) | `pkg/hub/saas.go:465` | +| `GET` | `/api/saas/hive-config/{hiveID}` | Hub auth | Proxy Hive Config | `pkg/hub/saas.go:466` | +| `GET` | `/api/saas/latest-sha` | Hub handler-specific | Latest SHA | `pkg/hub/saas.go:467` | +| `GET` | `/api/hub/release/stable-promotion` | Public | Stable Promotion State | `pkg/hub/saas.go:469` | +| `POST` | `/api/saas/hub/upgrade` | Hub handler-specific | Hub Self Upgrade | `pkg/hub/saas.go:470` | +| `PUT` | `/api/saas/hub/auto-upgrade` | Hub handler-specific | Hub Auto Upgrade | `pkg/hub/saas.go:471` | +| `PUT` | `/api/hub/release/stable-promotion` | Hub admin | Stable Promotion Toggle (audit-logged) | `pkg/hub/saas.go:472` | +| `GET` | `/api/saas/auth-check` | Hub handler-specific | Saa SAuth Check | `pkg/hub/saas.go:477` | +| `POST` | `/api/saas/user-token` | Hub auth | User Token | `pkg/hub/saas.go:488` | +| `GET` | `/api/saas/hives/{id}/access` | Hub auth | Access List | `pkg/hub/saas.go:489` | +| `GET` | `/api/saas/grantable-users` | Hub auth | Grantable Users | `pkg/hub/saas.go:490` | +| `POST` | `/api/saas/hives/{id}/access` | Hub auth | Access Add | `pkg/hub/saas.go:491` | +| `DELETE` | `/api/saas/hives/{id}/access/{username}` | Hub auth | Access Remove | `pkg/hub/saas.go:492` | +| `POST` | `/api/saas/hives/{id}/request-access` | Hub auth | Request Access | `pkg/hub/saas.go:493` | +| `GET` | `/api/saas/hives/{id}/requests` | Hub auth | Get Requests | `pkg/hub/saas.go:494` | +| `GET` | `/api/saas/hives/{id}/timeline` | Hub auth | Hive Timeline | `pkg/hub/saas.go:495` | +| `POST` | `/api/saas/hives/{id}/requests/{username}/approve` | Hub auth | Approve Request | `pkg/hub/saas.go:497` | +| `POST` | `/api/saas/hives/{id}/requests/{username}/deny` | Hub auth | Deny Request | `pkg/hub/saas.go:498` | +| `PUT` | `/api/saas/hives/{id}/approve-access/{username}` | Hub auth | Approve Access | `pkg/hub/saas.go:499` | +| `DELETE` | `/api/saas/hives/{id}/deny-access/{username}` | Hub auth | Deny Access | `pkg/hub/saas.go:500` | +| `GET` | `/api/saas/access-status` | Hub handler-specific | Access Status | `pkg/hub/saas.go:501` | +| `POST` | `/api/saas/request-provision` | Hub auth | Request Provision | `pkg/hub/saas.go:509` | +| `PUT` | `/api/saas/approve-provision/{username}` | Hub handler-specific | Approve Provision | `pkg/hub/saas.go:510` | +| `DELETE` | `/api/saas/deny-provision/{username}` | Hub handler-specific | Deny Provision | `pkg/hub/saas.go:511` | +| `GET` | `/api/saas/admin/available-placeholders` | Hub handler-specific | Available Placeholders | `pkg/hub/saas.go:512` | +| `GET` | `/api/saas/admin/users` | Hub handler-specific | Admin Users | `pkg/hub/saas.go:515` | `GET /api/saas/admin/users` includes cached `affiliation`, `affiliation_source`, `affiliation_confidence` (only for a `colony:gitdm` or `colony:devstats` source), `cncf_contributions` (only while the hub devstats provider is on), `profile_bio`, `profile_location`, `public_activity`, `top_repo`, and `top_repo_url` fields for the Hub Admin Users **AFFILIATION** column. The cache identifies who a signup appears affiliated with from public GitHub/GHE footprint only, ranked as profile company, contributed-to repo owner/org (excluding the personal namespace), public org membership, then top-repo owner/independent fallback; bio/location are supporting tooltip context, and `public_activity` buckets recent public events as `quiet`, `active`, or `prolific`. Provider API refreshes are asynchronous and daily, so the table never blocks on GitHub/GHE and never requires Hive activity. Colony affiliation ([Hub affiliation from colony](/docs/hive/dashboard/data-collection-and-telemetry#hub-affiliation-from-colony)) ranks below an organization the user or an admin set on the hub (`affiliation_source` `user` or `admin`) and the GitHub/GHE profile company, and above the footprint heuristics. -| `PUT` | `/api/saas/admin/users/{username}` | Hub handler-specific | Admin Update User | `pkg/hub/saas.go:527` | -| `DELETE` | `/api/saas/admin/users/{username}` | Hub handler-specific | Admin Delete User | `pkg/hub/saas.go:528` | -| `POST` | `/api/saas/admin/impersonate/exit` | Hub handler-specific | Impersonate Exit | `pkg/hub/saas.go:534` | -| `POST` | `/api/saas/admin/impersonate/{username}` | Hub handler-specific | Impersonate Start | `pkg/hub/saas.go:535` | -| `GET` | `/api/saas/impersonation-status` | Hub auth | Impersonation Status | `pkg/hub/saas.go:536` | -| `POST` | `/api/saas/hives/{id}/assign` | Hub auth | Assign Hive | `pkg/hub/saas.go:537` | -| `POST` | `/api/saas/hives/{id}/reset-assignment` | Hub handler-specific | Reset Assignment | `pkg/hub/saas.go:541` | -| `GET` | `/api/saas/cluster-health` | Hub handler-specific | Cluster Health | `pkg/hub/saas.go:542` | -| `POST` | `/api/saas/admin/alert-ack` | Hub handler-specific | Alert Ack | `pkg/hub/saas.go:555` | -| `GET` | `/api/saas/admin/cluster-app-keys` | Hub handler-specific | Get Cluster App Keys | `pkg/hub/saas.go:559` | -| `PUT` | `/api/saas/admin/cluster-app-keys/{clusterID}` | Hub handler-specific | Put Cluster App Key | `pkg/hub/saas.go:560` | -| `POST` | `/api/saas/admin/hub-banner` | Hub handler-specific | Send Hub Banner | `pkg/hub/saas.go:561` | -| `DELETE` | `/api/saas/admin/hub-banner` | Hub handler-specific | Clear Hub Banner | `pkg/hub/saas.go:562` | -| `GET` | `/api/saas/admin/hub-banner` | Hub handler-specific | Get Hub Banner | `pkg/hub/saas.go:563` | -| `POST` | `/api/saas/slack/user/{username}` | Hub auth | Slack Message User | `pkg/hub/saas.go:570` | -| `POST` | `/api/saas/hives/{id}/slack` | Hub auth | Slack Message Hive Owner | `pkg/hub/saas.go:571` | -| `POST` | `/api/saas/admin/slack/broadcast` | Hub handler-specific | Slack Broadcast | `pkg/hub/saas.go:572` | -| `POST` | `/api/saas/admin/journey-snooze` | Hub handler-specific | Journey Snooze | `pkg/hub/saas.go:573` | -| `GET` | `/api/saas/admin/journey-status` | Hub handler-specific | Journey Status | `pkg/hub/saas.go:574` | -| `GET` | `/api/saas/me/country` | Hub auth | My Country Get | `pkg/hub/saas.go:416` | -| `PUT` | `/api/saas/me/country` | Hub auth | My Country Set (write blocked while impersonating) | `pkg/hub/saas.go:417` | -| `POST` | `/api/saas/lite/enroll` | Hub auth | Hive Lite Enroll | `pkg/hub/saas.go:418` | -| `PUT` | `/api/saas/hives/{id}/secondary-app` | Hub auth | Assign Secondary GitHub App | `pkg/hub/saas.go:450` | -| `POST` | `/api/saas/hives/{id}/agents/{agent}/restarts/reset` | Hub auth | Reset Agent Restart Counter | `pkg/hub/saas.go:441` | -| `GET` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch State | `pkg/hub/saas.go:464` | -| `POST` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch Toggle (audit-logged) | `pkg/hub/saas.go:465` | -| `GET` | `/api/saas/whoami` | Hub handler-specific | Session Identity (stable key + profile) | `pkg/hub/saas.go:472` | -| `GET` | `/api/saas/dibs/repos` | Hub handler-specific | Dibs Repo/Owner List (public, short shared cache) | `pkg/hub/saas.go:476` | -| `GET` | `/api/saas/hives/{id}/access-log` | Hub auth | Permission-Change Audit Log | `pkg/hub/saas.go:485` | -| `GET` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Get | `pkg/hub/saas.go:502` | -| `POST` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Set | `pkg/hub/saas.go:503` | +| `PUT` | `/api/saas/admin/users/{username}` | Hub handler-specific | Admin Update User | `pkg/hub/saas.go:538` | +| `DELETE` | `/api/saas/admin/users/{username}` | Hub handler-specific | Admin Delete User | `pkg/hub/saas.go:539` | +| `POST` | `/api/saas/admin/impersonate/exit` | Hub handler-specific | Impersonate Exit | `pkg/hub/saas.go:545` | +| `POST` | `/api/saas/admin/impersonate/{username}` | Hub handler-specific | Impersonate Start | `pkg/hub/saas.go:546` | +| `GET` | `/api/saas/impersonation-status` | Hub auth | Impersonation Status | `pkg/hub/saas.go:547` | +| `POST` | `/api/saas/hives/{id}/assign` | Hub auth | Assign Hive | `pkg/hub/saas.go:548` | +| `POST` | `/api/saas/hives/{id}/reset-assignment` | Hub handler-specific | Reset Assignment | `pkg/hub/saas.go:552` | +| `GET` | `/api/saas/cluster-health` | Hub handler-specific | Cluster Health | `pkg/hub/saas.go:553` | +| `POST` | `/api/saas/admin/alert-ack` | Hub handler-specific | Alert Ack | `pkg/hub/saas.go:570` | +| `GET` | `/api/saas/admin/cluster-app-keys` | Hub handler-specific | Get Cluster App Keys | `pkg/hub/saas.go:574` | +| `PUT` | `/api/saas/admin/cluster-app-keys/{clusterID}` | Hub handler-specific | Put Cluster App Key | `pkg/hub/saas.go:575` | +| `POST` | `/api/saas/admin/hub-banner` | Hub handler-specific | Send Hub Banner | `pkg/hub/saas.go:576` | +| `DELETE` | `/api/saas/admin/hub-banner` | Hub handler-specific | Clear Hub Banner | `pkg/hub/saas.go:577` | +| `GET` | `/api/saas/admin/hub-banner` | Hub handler-specific | Get Hub Banner | `pkg/hub/saas.go:578` | +| `POST` | `/api/saas/slack/user/{username}` | Hub auth | Slack Message User | `pkg/hub/saas.go:585` | +| `POST` | `/api/saas/hives/{id}/slack` | Hub auth | Slack Message Hive Owner | `pkg/hub/saas.go:586` | +| `POST` | `/api/saas/admin/slack/broadcast` | Hub handler-specific | Slack Broadcast | `pkg/hub/saas.go:587` | +| `POST` | `/api/saas/admin/journey-snooze` | Hub handler-specific | Journey Snooze | `pkg/hub/saas.go:588` | +| `GET` | `/api/saas/admin/journey-status` | Hub handler-specific | Journey Status | `pkg/hub/saas.go:589` | +| `GET` | `/api/saas/me/country` | Hub auth | My Country Get | `pkg/hub/saas.go:424` | +| `PUT` | `/api/saas/me/country` | Hub auth | My Country Set (write blocked while impersonating) | `pkg/hub/saas.go:425` | +| `POST` | `/api/saas/lite/enroll` | Hub auth | Hive Lite Enroll | `pkg/hub/saas.go:426` | +| `PUT` | `/api/saas/hives/{id}/secondary-app` | Hub auth | Assign Secondary GitHub App | `pkg/hub/saas.go:461` | +| `POST` | `/api/saas/hives/{id}/agents/{agent}/restarts/reset` | Hub auth | Reset Agent Restart Counter | `pkg/hub/saas.go:452` | +| `GET` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch State | `pkg/hub/saas.go:475` | +| `POST` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch Toggle (audit-logged) | `pkg/hub/saas.go:476` | +| `GET` | `/api/saas/whoami` | Hub handler-specific | Session Identity (stable key + profile) | `pkg/hub/saas.go:483` | +| `GET` | `/api/saas/dibs/repos` | Hub handler-specific | Dibs Repo/Owner List (public, short shared cache) | `pkg/hub/saas.go:487` | +| `GET` | `/api/saas/hives/{id}/access-log` | Hub auth | Permission-Change Audit Log | `pkg/hub/saas.go:496` | +| `GET` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Get | `pkg/hub/saas.go:513` | +| `POST` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Set | `pkg/hub/saas.go:514` | | `GET` | `/api/saas/admin/profile-share/counts` | Hub admin | Customers profile sharing: consent counts per hive (`hive_id`, `name`, `consents`, `awaiting_reconfirmation`). No person, field choice or value. `404` while `HIVE_HUB_CUSTOMERS_SHARE_ENABLED` is off | `pkg/hub/customer_consent.go` | -| `GET` | `/api/saas/admin/user-countries` | Hub admin | User Country Rollup | `pkg/hub/saas.go:512` | -| `GET` | `/api/saas/admin/auth-rollout` | Hub admin | Auth Rollout Readiness Summary | `pkg/hub/saas.go:517` | -| `GET` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Get | `pkg/hub/saas.go:518` | -| `PUT` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Update + hot reload | `pkg/hub/saas.go:519` | -| `GET` | `/api/saas/admin/key-generations` | Hub admin | Token-Crypto Key Generations | `pkg/hub/saas.go:525` | -| `POST` | `/api/saas/admin/rotate-master-key` | Hub admin | Rotate Token Master Key (double-call refused) | `pkg/hub/saas.go:526` | -| `GET` | `/api/saas/admin/advisory-diagnostics` | Hub admin | Fleet Advisory/App-State Diagnostics | `pkg/hub/saas.go:552` | +| `GET` | `/api/saas/admin/user-countries` | Hub admin | User Country Rollup | `pkg/hub/saas.go:523` | +| `GET` | `/api/saas/admin/auth-rollout` | Hub admin | Auth Rollout Readiness Summary | `pkg/hub/saas.go:528` | +| `GET` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Get | `pkg/hub/saas.go:529` | +| `PUT` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Update + hot reload | `pkg/hub/saas.go:530` | +| `GET` | `/api/saas/admin/key-generations` | Hub admin | Token-Crypto Key Generations | `pkg/hub/saas.go:536` | +| `POST` | `/api/saas/admin/rotate-master-key` | Hub admin | Rotate Token Master Key (double-call refused) | `pkg/hub/saas.go:537` | +| `GET` | `/api/saas/admin/advisory-diagnostics` | Hub admin | Fleet Advisory/App-State Diagnostics | `pkg/hub/saas.go:563` | +| `GET` | `/api/saas/admin/lfx-insights-projects` | Hub admin | Colony LFX Insights effective project set: `effective` slugs, and per project its `sources` (`pinned`, `derived`), the public fleet `repos` it was derived from, and why it was `dropped` (`excluded`, `over_cap`); plus the project map state (`fetched_at`, `next_fetch`, `ttl`, `pages`, `truncated`, the `walk` in progress, `last_error`), `fleet_skipped` counts per skip reason (never names) and `warnings` ([#20968](https://github.com/hivecommons/hive/issues/20968), [#20989](https://github.com/hivecommons/hive/issues/20989)) | `pkg/hub/saas.go:567` | | `POST` | `/api/saas/hives/bulk` | Hub auth | Bulk Hive Action | `pkg/hub/saas_bulk.go:89` | | `GET` | `/api/saas/build-contains` | Hub auth | Does each hive's running build contain a PR or commit ([#18915](https://github.com/hivecommons/hive/issues/18915)): `?q=` returns `{query:{kind,pr?,commit?}, commit?, reason?, hives:[{id,name?,commit?,channel?,contains,reason?}]}` for the hives the caller can see in My Hives. `contains` is `yes`, `no` or `unknown`, computed from the hive's already-reported commit and repository ancestry: `yes` when the PR's merge commit (or the SHA) is the running commit or an ancestor, `no` when ancestry resolved and it is not (an unmerged PR is `no`), `unknown` (with `reason`) when the commit cannot be resolved or the lookup failed. Never a guess. `400` when `q` is neither a PR number nor a SHA. See [Build visibility](/docs/hive/release-channels) | `pkg/hub/build_contains.go:225` | -| `GET` | `/api/saas/me/country` | Hub auth | My Country Get | `pkg/hub/saas.go:416` | -| `PUT` | `/api/saas/me/country` | Hub auth | My Country Set (write blocked while impersonating) | `pkg/hub/saas.go:417` | -| `POST` | `/api/saas/lite/enroll` | Hub auth | Hive Lite Enroll | `pkg/hub/saas.go:418` | -| `PUT` | `/api/saas/hives/{id}/secondary-app` | Hub auth | Assign Secondary GitHub App | `pkg/hub/saas.go:450` | -| `POST` | `/api/saas/hives/{id}/agents/{agent}/restarts/reset` | Hub auth | Reset Agent Restart Counter | `pkg/hub/saas.go:441` | -| `GET` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch State | `pkg/hub/saas.go:464` | -| `POST` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch Toggle (audit-logged) | `pkg/hub/saas.go:465` | -| `GET` | `/api/saas/whoami` | Hub handler-specific | Session Identity (stable key + profile) | `pkg/hub/saas.go:472` | -| `GET` | `/api/saas/dibs/repos` | Hub handler-specific | Dibs Repo/Owner List (public, short shared cache) | `pkg/hub/saas.go:476` | -| `GET` | `/api/saas/hives/{id}/access-log` | Hub auth | Permission-Change Audit Log | `pkg/hub/saas.go:485` | -| `GET` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Get | `pkg/hub/saas.go:502` | -| `POST` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Set | `pkg/hub/saas.go:503` | +| `GET` | `/api/saas/me/country` | Hub auth | My Country Get | `pkg/hub/saas.go:424` | +| `PUT` | `/api/saas/me/country` | Hub auth | My Country Set (write blocked while impersonating) | `pkg/hub/saas.go:425` | +| `POST` | `/api/saas/lite/enroll` | Hub auth | Hive Lite Enroll | `pkg/hub/saas.go:426` | +| `PUT` | `/api/saas/hives/{id}/secondary-app` | Hub auth | Assign Secondary GitHub App | `pkg/hub/saas.go:461` | +| `POST` | `/api/saas/hives/{id}/agents/{agent}/restarts/reset` | Hub auth | Reset Agent Restart Counter | `pkg/hub/saas.go:452` | +| `GET` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch State | `pkg/hub/saas.go:475` | +| `POST` | `/api/saas/upgrade-pause` | Hub admin | Upgrade Kill-Switch Toggle (audit-logged) | `pkg/hub/saas.go:476` | +| `GET` | `/api/saas/whoami` | Hub handler-specific | Session Identity (stable key + profile) | `pkg/hub/saas.go:483` | +| `GET` | `/api/saas/dibs/repos` | Hub handler-specific | Dibs Repo/Owner List (public, short shared cache) | `pkg/hub/saas.go:487` | +| `GET` | `/api/saas/hives/{id}/access-log` | Hub auth | Permission-Change Audit Log | `pkg/hub/saas.go:496` | +| `GET` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Get | `pkg/hub/saas.go:513` | +| `POST` | `/api/saas/admin/scale-settings` | Hub admin | Placeholder Pool Scale Settings Set | `pkg/hub/saas.go:514` | | `GET` | `/api/saas/admin/profile-share/counts` | Hub admin | Customers profile sharing: consent counts per hive (`hive_id`, `name`, `consents`, `awaiting_reconfirmation`). No person, field choice or value. `404` while `HIVE_HUB_CUSTOMERS_SHARE_ENABLED` is off | `pkg/hub/customer_consent.go` | -| `GET` | `/api/saas/admin/user-countries` | Hub admin | User Country Rollup | `pkg/hub/saas.go:512` | -| `GET` | `/api/saas/admin/auth-rollout` | Hub admin | Auth Rollout Readiness Summary | `pkg/hub/saas.go:517` | -| `GET` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Get | `pkg/hub/saas.go:518` | -| `PUT` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Update + hot reload | `pkg/hub/saas.go:519` | -| `GET` | `/api/saas/admin/key-generations` | Hub admin | Token-Crypto Key Generations | `pkg/hub/saas.go:525` | -| `POST` | `/api/saas/admin/rotate-master-key` | Hub admin | Rotate Token Master Key (double-call refused) | `pkg/hub/saas.go:526` | -| `GET` | `/api/saas/admin/advisory-diagnostics` | Hub admin | Fleet Advisory/App-State Diagnostics | `pkg/hub/saas.go:552` | +| `GET` | `/api/saas/admin/user-countries` | Hub admin | User Country Rollup | `pkg/hub/saas.go:523` | +| `GET` | `/api/saas/admin/auth-rollout` | Hub admin | Auth Rollout Readiness Summary | `pkg/hub/saas.go:528` | +| `GET` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Get | `pkg/hub/saas.go:529` | +| `PUT` | `/api/saas/admin/notifications` | Hub admin | Hub Notifications Update + hot reload | `pkg/hub/saas.go:530` | +| `GET` | `/api/saas/admin/key-generations` | Hub admin | Token-Crypto Key Generations | `pkg/hub/saas.go:536` | +| `POST` | `/api/saas/admin/rotate-master-key` | Hub admin | Rotate Token Master Key (double-call refused) | `pkg/hub/saas.go:537` | +| `GET` | `/api/saas/admin/advisory-diagnostics` | Hub admin | Fleet Advisory/App-State Diagnostics | `pkg/hub/saas.go:563` | +| `GET` | `/api/saas/admin/lfx-insights-projects` | Hub admin | Colony LFX Insights effective project set: `effective` slugs, and per project its `sources` (`pinned`, `derived`), the public fleet `repos` it was derived from, and why it was `dropped` (`excluded`, `over_cap`); plus the project map state (`fetched_at`, `next_fetch`, `ttl`, `pages`, `truncated`, the `walk` in progress, `last_error`), `fleet_skipped` counts per skip reason (never names) and `warnings` ([#20968](https://github.com/hivecommons/hive/issues/20968), [#20989](https://github.com/hivecommons/hive/issues/20989)) | `pkg/hub/saas.go:567` | | `GET` | `/api/ask/status` | Hub auth | Browser session only (no bearer, no impersonation). Ask AI help status for the signed-in person: `enabled`, `text_version`, `disclosure`, `consented`, `docs_url`, `ai_label`. Registered only when `HIVE_ASK_ENABLED` is on and fully configured; otherwise `404`. Never returns the vendor key, project id or integration id. See [Ask AI help](/docs/hive/hub/self-hosted-hub-deployment#ask-ai-help) | `pkg/hub/ask.go:131` | | `PUT` | `/api/ask/consent` | Hub auth | Browser session only. Record the person's consent to the Ask disclosure: body `{text_version}`; `409` when the page showed an older text; `204` on success. One audit line, no text | `pkg/hub/ask.go:132` | | `DELETE` | `/api/ask/consent` | Hub auth | Browser session only. Withdraw Ask consent; takes effect on the next request; `204` | `pkg/hub/ask.go:133` | diff --git a/docs/content/hive/api-reference/hub-server.md b/docs/content/hive/api-reference/hub-server.md index d3d3f6b9..f222085e 100644 --- a/docs/content/hive/api-reference/hub-server.md +++ b/docs/content/hive/api-reference/hub-server.md @@ -41,36 +41,36 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | `GET` | `/api/openrouter/models` | Hub auth | Hub Open Router Models | `pkg/hub/openrouter.go:28` | | `GET` | `/api/openrouter/credit` | Hub auth | Hub Open Router Credit | `pkg/hub/openrouter.go:29` | | `GET` | `/openrouter/callback` | Hub handler-specific | Hub Open Router Callback | `pkg/hub/openrouter.go:30` | -| `GET` | `/dashboard` | Hub handler-specific | Dashboard | `pkg/hub/saas.go:397` | -| `GET` | `/access-denied` | Hub handler-specific | Access Denied | `pkg/hub/saas.go:398` | -| `GET` | `/api/hub/clusters` | Hub auth | List Clusters | `pkg/hub/saas.go:556` | -| `GET` | `/api/hub/image-pulls` | Hub auth | Per-Release Image Pull Series | `pkg/hub/saas.go:405` | +| `GET` | `/dashboard` | Hub handler-specific | Dashboard | `pkg/hub/saas.go:405` | +| `GET` | `/access-denied` | Hub handler-specific | Access Denied | `pkg/hub/saas.go:406` | +| `GET` | `/api/hub/clusters` | Hub auth | List Clusters | `pkg/hub/saas.go:571` | +| `GET` | `/api/hub/image-pulls` | Hub auth | Per-Release Image Pull Series | `pkg/hub/saas.go:413` | | `POST` | `/api/benchmarks/ingest` | Per-hive heartbeat bearer | Spoke push target for anonymized [benchmark records](/docs/hive/benchmarks): body `{hive_id, records[]}`; the hub recomputes the hive hash from the authenticated id, rejects records whose `source.hive_id` differs (`401` bad bearer, `403` unregistered hive, `400` malformed), merges accepted records by id into `/data/benchmarks//.json` and returns `202 {accepted, rejected, files}` | `pkg/hub/benchmarks.go` | | `GET` | `/api/hub/benchmarks` | Public | Benchmark publisher status: `last_ingest_at`, `last_publish_at`, `last_publish_files`, `last_error`, `pending_files`, `hive_count`, `record_count` and per-hive-hash `hives{}` counts; the hub commits pending month files hourly to `hivecommons/benchmarks` (`HIVE_BENCHMARKS_REPO`) via its App identity | `pkg/hub/benchmarks.go` | -| `GET` | `/api/reach` | Hub admin | PR Reach Report (?pr=NNN or ?recent=K) | `pkg/hub/saas.go:547` | -| `GET` | `/fleet` | Hub handler-specific | My-Hives Fleet Page (static; data via `/api/saas/my-hives`) | `pkg/hub/server.go:1854` | -| `GET` | `/my-hives` | Hub handler-specific | 301 redirect to `/fleet` (query preserved) | `pkg/hub/server.go:1855` | +| `GET` | `/api/reach` | Hub admin | PR Reach Report (?pr=NNN or ?recent=K) | `pkg/hub/saas.go:558` | +| `GET` | `/fleet` | Hub handler-specific | My-Hives Fleet Page (static; data via `/api/saas/my-hives`) | `pkg/hub/server.go:1868` | +| `GET` | `/my-hives` | Hub handler-specific | 301 redirect to `/fleet` (query preserved) | `pkg/hub/server.go:1869` | | `GET` | `/activity` | Signed-in user | Fleet activity page ([#16063](https://github.com/hivecommons/hive/issues/16063)): read-only, data-free shell that polls `/api/hub/activity` every 15 s with `If-None-Match`. No session → `307` to `/login`; blocked user → `403`. Own Content-Security-Policy (scripts and styles from `'self'` only, `script-src-attr`/`style-src-attr` `'none'`), `Cache-Control: no-cache` + content `ETag`. See [Hub Fleet activity page](/docs/hive/hub/fleet-activity) | `pkg/hub/activity_page.go` | | `GET` | `/activity/public` | Public | Public-safe Fleet activity page ([#15966](https://github.com/hivecommons/hive/issues/15966)): the same data-free shell as `/activity`, served without a session; on this path the page polls `/api/hub/activity/public` with `credentials: 'omit'`. Source of the `twitch.tv/hivecommonsfleet` broadcast. Same CSP and cache headers as `/activity`. See [Hub Fleet activity page](/docs/hive/hub/fleet-activity#public-safe-view) | `pkg/hub/activity_public.go` | | `GET` | `/activity/assets/{name}` | Public | The shared tracker assets the Fleet activity page loads, byte-identical: the row asset (`pkg/webassets/trackerrow`, [#16062](https://github.com/hivecommons/hive/issues/16062)) and the `am.*` URL-view and display-playlist helpers (`pkg/webassets/trackerview`, [#16064](https://github.com/hivecommons/hive/issues/16064)); only names in `trackerrow.Files` or `trackerview.Files`, else `404`. `Cache-Control: no-cache` + content `ETag` | `pkg/hub/activity_page.go` | -| `POST` | `/api/shared-agent-pool/leases` | Hub handler-specific | Acquire or renew a shared CLI session lease | `pkg/hub/server.go:1773` | -| `PUT` | `/api/shared-agent-pool/leases` | Hub handler-specific | Renew an active shared CLI session lease | `pkg/hub/server.go:1774` | -| `DELETE` | `/api/shared-agent-pool/leases` | Hub handler-specific | Release a shared CLI session lease | `pkg/hub/server.go:1775` | -| `POST` | `/api/heartbeat` | Hub handler-specific | Heartbeat. A request carrying `X-Hive-Activity-Update` is an activity-only update ([#15963](https://github.com/hivecommons/hive/issues/15963)): body `{"activity_update":{"hive_id","activity"}}`, the same per-hive bearer, accepted only for a hive already in the registry (`404` otherwise); it replaces the in-memory activity digest and nothing else, and the signed response carries `ok`, `activity_etag` and `activity_events_ack` (the highest activity event sequence number the hub holds for the hive, [#15964](https://github.com/hivecommons/hive/issues/15964); full heartbeat responses carry it too). A full heartbeat may carry `protocol: {version, features}`; while `HIVE_HUB_HEARTBEAT_PROTOCOL` is on the response answers with `protocol: {version, accepted, ignored, unsupported_version?}`, and a heartbeat without it is answered unchanged ([#19237](https://github.com/hivecommons/hive/issues/19237)) | `pkg/hub/server.go:1776` | -| `POST` | `/api/task-status` | Hub handler-specific | Task Status | `pkg/hub/server.go:1777` | -| `GET` | `/api/registry` | Hub handler-specific | Registry | `pkg/hub/server.go:1788` | -| `GET` | `/api/hub/leaderboard` | Hub handler-specific | Leaderboard | `pkg/hub/server.go:1789` | -| `GET` | `/api/hub/stats` | Hub handler-specific | Stats | `pkg/hub/server.go:1790` | -| `GET` | `/api/fleet-stats` | Hub handler-specific | Fleet Stats | `pkg/hub/server.go:1791` | +| `POST` | `/api/shared-agent-pool/leases` | Hub handler-specific | Acquire or renew a shared CLI session lease | `pkg/hub/server.go:1787` | +| `PUT` | `/api/shared-agent-pool/leases` | Hub handler-specific | Renew an active shared CLI session lease | `pkg/hub/server.go:1788` | +| `DELETE` | `/api/shared-agent-pool/leases` | Hub handler-specific | Release a shared CLI session lease | `pkg/hub/server.go:1789` | +| `POST` | `/api/heartbeat` | Hub handler-specific | Heartbeat. A request carrying `X-Hive-Activity-Update` is an activity-only update ([#15963](https://github.com/hivecommons/hive/issues/15963)): body `{"activity_update":{"hive_id","activity"}}`, the same per-hive bearer, accepted only for a hive already in the registry (`404` otherwise); it replaces the in-memory activity digest and nothing else, and the signed response carries `ok`, `activity_etag` and `activity_events_ack` (the highest activity event sequence number the hub holds for the hive, [#15964](https://github.com/hivecommons/hive/issues/15964); full heartbeat responses carry it too). A full heartbeat may carry `protocol: {version, features}`; while `HIVE_HUB_HEARTBEAT_PROTOCOL` is on the response answers with `protocol: {version, accepted, ignored, unsupported_version?}`, and a heartbeat without it is answered unchanged ([#19237](https://github.com/hivecommons/hive/issues/19237)) | `pkg/hub/server.go:1790` | +| `POST` | `/api/task-status` | Hub handler-specific | Task Status | `pkg/hub/server.go:1791` | +| `GET` | `/api/registry` | Hub handler-specific | Registry | `pkg/hub/server.go:1802` | +| `GET` | `/api/hub/leaderboard` | Hub handler-specific | Leaderboard | `pkg/hub/server.go:1803` | +| `GET` | `/api/hub/stats` | Hub handler-specific | Stats | `pkg/hub/server.go:1804` | +| `GET` | `/api/fleet-stats` | Hub handler-specific | Fleet Stats | `pkg/hub/server.go:1805` | | `GET` | `/api/hub/evidence` | Hub admin | Read-only cross-hive evidence drill-down from each spoke's stored heartbeat `evidence` summary ([#12116](https://github.com/hivecommons/hive/issues/12116)); non-admins get `403`. Returns `spokes`, `reporting`, pooled `calibration` (bucket 0–5 → `{n, bad, rate, lo, hi}`; the hub view folds the six buckets into four reviewer-confidence ranges), `findings[]` (the plain-language *What this says* sentences, generated from the same fields; [#12456](https://github.com/hivecommons/hive/issues/12456)), `by_acmm_level` (`level`, `hives`, `merged_90d`, `revert_rate`, and `time_to_merge` — `median_of_hive_medians_s`, `hives`, `n` — the median of the level's per-hive median time-to-merge, omitted when no hive at the level reports one; [#12464](https://github.com/hivecommons/hive/issues/12464)), `family_false_approve_rate` (`same`/`cross`/`mixed`, hives classed by their reviewer vs author family sets), fleet `record_coverage` (merged PRs with an evidence record over `prs_merged_90d`), fleet panels ([#12370](https://github.com/hivecommons/hive/issues/12370)) `outcomes_by_author_kind[]` (`kind`, `hives`, `n`, `merged`, `reverted`, `merge_rate`, `revert_rate`), `write_counters[]` (`tier`, `hives`, `attempted`, `blocked`, `block_rate`) and `shadow_gate` (`review_gate` / `intent` → `held` / `passed` outcomes with `revert_rate`), each omitted while no spoke reports it and repeated per `by_acmm_level[]` row, and per hive `hives[]` with `acmm_level`, `prs_merged_90d`, `record_coverage`, `family_mix`, false-approve / false-block / revert rates, families, a calibration series the raw `counts` behind them (including `by_author_kind`) so the drill-down can re-pool a hive / ACMM-level selection client-side, and `criteria[]`: the per-axis criteria table derived hub-side from the quadrant criteria (`axis`, `label`, `scored`, `criteria[]` with `name`, `label`, `status` `met`/`unmet`/`not_reported`, `display`/`score` when measured, `reason` otherwise; offline, evidence-less or unscored hives are `not_reported`, never `unmet`; [#12463](https://github.com/hivecommons/hive/issues/12463)). Every rate is `{n, rate, lo, hi}` with a 95% Wilson interval; `rate`/`lo`/`hi` are null when `n` < 10. Window selection ([RFC #12062](https://github.com/hivecommons/hive/issues/12062)): `?hours=24|168|720` pools each hive's matching heartbeat `windows` block instead of its 90-day block (any other or absent `hours` → 90 days); `?from=YYYY-MM-DD|RFC3339[&to=…]` (date-only `to` is inclusive, `to` defaults to now, `to` ≥ `from`, span ≤ 366 days, else `400`) is served from the smallest reported window that reaches back to `from` and flagged `window.approximate`. The response carries `window` (`hours`, `key`, `label`, `from`, `to`, `approximate`, `coverage_available` — `record_coverage` is only computed for the 90-day window because `prs_merged_90d` is a 90-day count), `window_unreported` and per-hive `window_unreported` for hives whose spoke predates per-window reporting. `?hive=[,…]` (repeatable) and `?level=` restrict the registry server-side to those hives / that ACMM level before pooling. Hub admins open it from the Fleet quadrant card or its **🔬 Evidence** button ([#12117](https://github.com/hivecommons/hive/issues/12117)), pick a window (24h / 7d / 30d / 90d / custom), filter it by hive and ACMM level and read each section's ⓘ explainer; the per-hive author-kind revert counts behind the *Revert rate by author kind* panel are `hives[].counts.by_author_kind` ([#12326](https://github.com/hivecommons/hive/issues/12326)). Never consulted by merge decisions | `pkg/hub/evidence.go` | | `GET` | `/api/hub/evidence/report` | Hub admin | Plain-language report of the hub evidence view ([#12456](https://github.com/hivecommons/hive/issues/12456)), rendered server-side from the same `EvidenceView` as `/api/hub/evidence` so every figure reconciles with the modal; non-admins get `403`. Same `hours=` / `from=` / `to=` window and `hive=` / `level=` filter parameters. `format=md` (default, `text/markdown`) or `format=html` (standalone page, inline CSS, no scripts or external assets, hive names escaped); any other value → `400`. `download=1` sets `Content-Disposition: attachment; filename="hive-evidence---.md|html"`, otherwise inline. Sections: Summary (the generated findings), What we measured and why, The numbers, How to read these, What is not reported yet and why, Grade per section, footer link to `review-evidence.md`. `Cache-Control: no-store`. Read-only; never consulted by merge decisions | `pkg/hub/evidence_report.go` | | `GET` | `/api/hub/activity` | Signed-in user | Read-only hub-wide activity view ([#15951](https://github.com/hivecommons/hive/issues/15951), RFC [#15861](https://github.com/hivecommons/hive/issues/15861)) merged from each spoke's heartbeat `activity` digest, held in hub memory only. Authorization is per user and per hive before aggregation: hub admins see every registered hive; everyone else only hives they own or hold an unexpired grant for; anonymous → `401`. Returns `hives[]` (`hive_id`, `name`, `status` `ok`/`stale`/`not_reporting`/`missing`, `reporting`, `stale` once the block is older than two heartbeats, `last_heartbeat`, `received_at`, `generated_at`, `totals` — `items`, `by_stage`, `by_modifier`, counting private and truncated items too — `truncated` and `events_dropped`), `items[]` (`hive_id`, `repo`, `n`, `kind`, `title`, `author_kind`, `stage`, `stage_n`, `since`, `mods`, `private`) ordered needs-human/needs-decision, stalled, furthest stage, oldest, a response-level `truncated` (cap 2000), and `events[]` ([#15964](https://github.com/hivecommons/hive/issues/15964): `hive_id`, `received_at`, `seq`, `type` `opened`/`stage`/`merged`, `repo`, `n`, `kind`, `title`, `from`, `stage`, `at`, `private`), oldest first, from a fleet-wide in-memory ring of at most 1,000 events, none held longer than 24 hours (ageing out is not counted in `events_dropped`; when full, the oldest event of the hive holding the most events is dropped, counted in that hive's `events_dropped`, so one hive cannot evict the others' events). Events are filtered per user and per hive exactly like items, before aggregation, so an event for a hive the viewer cannot see is never delivered; `mod`/`author_kind` filters keep only events whose item is still on the hive's board. A spoke block carries at most 200 events; drops are disclosed per hive as `events_dropped`. New events change the `ETag`. Each digest carries at most 100 items by default and never more than the 250-item hub ceiling; private-repository items appear only when the spoke opts in. Filters: `hive`, `repo`, `stage`, `mod`, `author_kind`, `q` (title substring or `#`), each ≤ 200 characters (else `400`). `ETag` + `If-None-Match` → `304`; `Cache-Control: private, no-cache`, `Vary: Cookie, Authorization`. No actions | `pkg/hub/activity.go` | | `GET` | `/api/hub/activity/public` | Public | Public-safe activity view ([#15966](https://github.com/hivecommons/hive/issues/15966)): the `/api/hub/activity` shape for anyone, never reading a cookie, token or `Authorization` header (credentials do not change the response). Only hives the registry lists as public on github.com, and only items and events not marked `private`; `totals`, per-hive `truncated` and `events_dropped`, hive owners and per-user grants are omitted. Same filters (`400` on an invalid one). The body is built at most once per 2 s per parsed filter and shared by every anonymous caller, so rows, `generated_at` and the `ETag` change at most every 2 s; query strings that parse to the default view share one entry. Toggling a hive's visibility drops the cache at once. `ETag` + `If-None-Match` → `304`; `Cache-Control: no-cache` | `pkg/hub/activity_public.go` | -| `GET` | `/api/hub/version` | Hub handler-specific | Hub Version | `pkg/hub/server.go:1799` | -| `DELETE` | `/api/hub/registry/{id}` | Hub handler-specific | Registry Delete | `pkg/hub/server.go:1809` | -| `GET` | `/api/hub/selfservice/status` | Hub auth | Self-service registration status: `{enabled, max_per_user, count, expiry}`; always answers so the dashboard can decide whether **Register your own hive** opens the form or the self-hosting guide ([#18060](https://github.com/hivecommons/hive/issues/18060)) | `pkg/hub/server.go:1813` | -| `GET` | `/api/hub/selfservice/hives` | Hub auth | The caller's own self-service (`byo-`) hives: `{hives[]}` of `{id, owner, org, repos, dashboard_url, created_at, ownership_checked_at, last_accepted_heartbeat_at, online}`; never a key or a hash. `404` while `HIVE_HUB_SELFSERVICE_REGISTRATION` is off | `pkg/hub/server.go:1814` | -| `POST` | `/api/hub/selfservice/hives` | Hub auth | Register a self-hosted hive: body `{name, org, repos[], dashboard_url}`; the ID is `byo---` (the double hyphen keeps IDs unambiguous, since logins contain hyphens but never `--`). Proves `permissions.admin` on every `owner/name` repo with the caller's own stored GitHub token (`403` naming the refused repo, nothing stored); `400` invalid or reserved name, a login that contains `--` or starts or ends with `-`, bare-org or `.`/`..` repo, or non-`https`/private `dashboard_url`; `409` ID already registered; `429` over `HIVE_HUB_SELFSERVICE_MAX_PER_USER` (enforced again under the store lock, so concurrent registrations cannot exceed it). `201 {hive, key, hub_url, snippets{docker_compose, podman, kubernetes}}`: the raw key appears here once and only its hash is stored. `404` while the flag is off | `pkg/hub/server.go:1815` | +| `GET` | `/api/hub/version` | Hub handler-specific | Hub Version | `pkg/hub/server.go:1813` | +| `DELETE` | `/api/hub/registry/{id}` | Hub handler-specific | Registry Delete | `pkg/hub/server.go:1823` | +| `GET` | `/api/hub/selfservice/status` | Hub auth | Self-service registration status: `{enabled, max_per_user, count, expiry}`; always answers so the dashboard can decide whether **Register your own hive** opens the form or the self-hosting guide ([#18060](https://github.com/hivecommons/hive/issues/18060)) | `pkg/hub/server.go:1827` | +| `GET` | `/api/hub/selfservice/hives` | Hub auth | The caller's own self-service (`byo-`) hives: `{hives[]}` of `{id, owner, org, repos, dashboard_url, created_at, ownership_checked_at, last_accepted_heartbeat_at, online}`; never a key or a hash. `404` while `HIVE_HUB_SELFSERVICE_REGISTRATION` is off | `pkg/hub/server.go:1828` | +| `POST` | `/api/hub/selfservice/hives` | Hub auth | Register a self-hosted hive: body `{name, org, repos[], dashboard_url}`; the ID is `byo---` (the double hyphen keeps IDs unambiguous, since logins contain hyphens but never `--`). Proves `permissions.admin` on every `owner/name` repo with the caller's own stored GitHub token (`403` naming the refused repo, nothing stored); `400` invalid or reserved name, a login that contains `--` or starts or ends with `-`, bare-org or `.`/`..` repo, or non-`https`/private `dashboard_url`; `409` ID already registered; `429` over `HIVE_HUB_SELFSERVICE_MAX_PER_USER` (enforced again under the store lock, so concurrent registrations cannot exceed it). `201 {hive, key, hub_url, snippets{docker_compose, podman, kubernetes}}`: the raw key appears here once and only its hash is stored. `404` while the flag is off | `pkg/hub/server.go:1829` | | `GET` | `/api/hub/v1` | Public | Hub registration protocol v1 discovery ([#18642](https://github.com/hivecommons/hive/issues/18642)): `{protocol, version, base_path, operations[], patch_fields[], limits{max_repos, max_per_user, expiry, key_rotation_overlap}, proof_methods[], proof_method_details[{name, description, headers, scopes}]}`. Readable without signing in so a client learns the limits before it hits a `4xx`. `proof_methods` is `["hub-session-token"]` (ownership proven with the GitHub token stored at hub sign-in), plus `github-user-token` while `HIVE_HUB_PROOF_GITHUB_USER_TOKEN` is on (a token sent per request in `X-Hive-Proof-Token`, with the scopes listed in `proof_method_details`). `max_repos` is `HIVE_HUB_SELFSERVICE_MAX_REPOS`. `404` while `HIVE_HUB_SELFSERVICE_REGISTRATION` is off | `pkg/hub/selfservice_v1_api.go` | | `POST` | `/api/hub/v1/registrations` | Hub auth | Register a self-hosted hive as a resource ([#18642](https://github.com/hivecommons/hive/issues/18642)): the same body, proof and refusals as `POST /api/hub/selfservice/hives` (including `429` over `HIVE_HUB_SELFSERVICE_MAX_PER_USER`), except that a repo list over `HIVE_HUB_SELFSERVICE_MAX_REPOS` answers `413 {error, limit: "max_repos", max_repos}` instead of `400`, and `X-Hive-Proof-Method: github-user-token` picks the per-request token proof (`400` listing `proof_methods` when the hub does not offer it; `403 {error, proof_method, reason, repo, required_scopes, granted_scopes}` when it fails). `201 {registration, key, hub_url, snippets}` with `Location` and a strong `ETag` header; `registration` is the legacy view plus `etag` and `repo_proofs[{repo, checked_at}]` (when the owner's admin permission on each repo was last proven). The raw key appears once. `404` while `HIVE_HUB_SELFSERVICE_REGISTRATION` is off | `pkg/hub/selfservice_v1_api.go` | | `GET` | `/api/hub/v1/registrations` | Hub auth | The caller's own registrations: `{registrations[]}`, each with its `etag` and `repo_proofs`; never a key or a hash | `pkg/hub/selfservice_v1_api.go` | @@ -79,26 +79,26 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | `PATCH` | `/api/hub/v1/registrations/{id}` | Own registration bearer | `{"op":"sync-repos","repos":["owner/name"]}` replaces the desired list with the supplied nonempty list, up to `max_repos`. Retained proven repos stay active; other requested repos appear only in `registration.pending_proof` until the owner proves them. Omitted repos are removed. No GitHub calls. Requires `If-Match` (send `*` for the first sync or use the returned `ETag`; `428` missing, `412` stale). `200 {registration}` with its resulting `ETag`; `400` for a list that keeps no proven repo or for other fields or operations; `404` for a registration key used on a foreign or missing ID. Discovery advertises `sync-repos` only when `HIVE_HUB_SELFSERVICE_SYNC_REPOS` is on (off by default; also requires self-service registration to be enabled) | `pkg/hub/selfservice_v1_sync.go` | | `POST` | `/api/hub/v1/registrations/{id}/keys` | Hub auth | Owner only: rotate the heartbeat key; the previous key keeps authenticating for the 10 minute overlap, or for `HIVE_HUB_SELFSERVICE_KEY_GRACE_WINDOW` while `HIVE_HUB_SELFSERVICE_KEY_GRACE` is on, in which case a rotation inside an open window keeps the old key and replaces the pending one ([#19235](https://github.com/hivecommons/hive/issues/19235)). `201 {id, key, hub_url, overlap, snippets}` (the legacy rotate answers `200`) with the new `ETag`; the raw key appears once. Optional `If-Match` (`412` when stale). A body asking for a grace window is refused with `400`: caller-chosen grace is a later rollout step | `pkg/hub/selfservice_v1_api.go` | | `DELETE` | `/api/hub/v1/registrations/{id}` | Hub auth | Owner or hub admin: revoke the key and remove the registry entry. `200 {removed, id}`. Optional `If-Match` (`412` when stale, carrying the current `ETag`) | `pkg/hub/selfservice_v1_api.go` | -| `POST` | `/api/hub/selfservice/hives/{id}/rotate` | Hub auth | Owner only: mint a new heartbeat key for `{id}`; the previous key keeps authenticating for `overlap` (10 minutes, or the grace window while `HIVE_HUB_SELFSERVICE_KEY_GRACE` is on). `200 {id, key, hub_url, overlap, snippets}`, raw key once. Another user's hive, a missing hive and a hub admin who does not own it all get `404` | `pkg/hub/server.go:1816` | -| `DELETE` | `/api/hub/selfservice/hives/{id}` | Hub auth | Owner or hub admin: revoke the key and remove the registry entry. `200 {removed, id}`; another user's hive is `404` | `pkg/hub/server.go:1817` | -| `POST` | `/api/contribute/register` | Hub handler-specific | Contribute Proxy | `pkg/hub/server.go:1821` | -| `GET` | `/api/contribute/status` | Hub handler-specific | Contribute Status | `pkg/hub/server.go:1822` | -| `GET` | `/api/contribute/ws` | Hub handler-specific | Contribute WSProxy | `pkg/hub/server.go:1823` | -| `POST` | `/api/github/webhook` | Hub handler-specific | GitHub Webhook | `pkg/hub/server.go:1824` | +| `POST` | `/api/hub/selfservice/hives/{id}/rotate` | Hub auth | Owner only: mint a new heartbeat key for `{id}`; the previous key keeps authenticating for `overlap` (10 minutes, or the grace window while `HIVE_HUB_SELFSERVICE_KEY_GRACE` is on). `200 {id, key, hub_url, overlap, snippets}`, raw key once. Another user's hive, a missing hive and a hub admin who does not own it all get `404` | `pkg/hub/server.go:1830` | +| `DELETE` | `/api/hub/selfservice/hives/{id}` | Hub auth | Owner or hub admin: revoke the key and remove the registry entry. `200 {removed, id}`; another user's hive is `404` | `pkg/hub/server.go:1831` | +| `POST` | `/api/contribute/register` | Hub handler-specific | Contribute Proxy | `pkg/hub/server.go:1835` | +| `GET` | `/api/contribute/status` | Hub handler-specific | Contribute Status | `pkg/hub/server.go:1836` | +| `GET` | `/api/contribute/ws` | Hub handler-specific | Contribute WSProxy | `pkg/hub/server.go:1837` | +| `POST` | `/api/github/webhook` | Hub handler-specific | GitHub Webhook | `pkg/hub/server.go:1838` | | `GET` | `/api/mail/hosts` | hive-mx bearer (`HIVE_HUB_MAIL_TOKEN`) | Hosts the mail receiver accepts `hive@` for ([#18395](https://github.com/hivecommons/hive/issues/18395)): `{hosts[]}`, sorted, lower-case: every hosted hive's subdomain host, vanity URL host and reported dashboard URL host. A host claimed by two hives is left out. `401` bad token, `404` while `HIVE_HUB_MAIL_TOKEN` is unset. `Cache-Control: no-store` | `pkg/hub/mail_relay.go` | | `POST` | `/api/mail/inbound` | hive-mx bearer (`HIVE_HUB_MAIL_TOKEN`) | One parsed mail delivery from hive-mx (`pkg/mailin/wire.Delivery`): JSON, or `multipart/form-data` for a large files delivery, routed by the `X-Hive-Mail-Delivery`, `X-Hive-Mail-Kind` and `X-Hive-Mail-Recipient` headers (at most 48 MiB, `HIVE_HUB_MAIL_MAX_BODY_BYTES`, this route only; without the headers, JSON of at most 8 MiB). The body is spooled to disk, never held whole in memory. The hub matches the recipient host to a hosted hive, signs the body byte for byte with that hive's relay key (`X-Hive-Relay-Timestamp`, `X-Hive-Relay-Signature-256` bound to `X-Hive-Relay-Delivery`) and forwards it to the spoke's `/api/meetings/invites`, `/api/inbox/email`, `/api/meetings/calendar-emails/proof` or `/api/inbox/email/report` (a refusal report, [#18699](https://github.com/hivecommons/hive/issues/18699)) by `kind`, behind the webhook relay's private-address guard and without following redirects. A files delivery that is multipart or larger than one piece (`HIVE_HUB_MAIL_CHUNK_BYTES`, 768 KiB) goes to `/api/inbox/email/chunk` in signed pieces instead ([#18564](https://github.com/hivecommons/hive/issues/18564)). Stores nothing once relayed; logs the delivery id only. `202` delivered; `400` invalid delivery; `404` no such hive; `413` too large; `422` the spoke refused it (permanent); `502`/`503` hive not reachable yet or unavailable (hive-mx asks the sender to retry) | `pkg/hub/mail_relay.go` | -| `GET` | `/gh-setup` | Hub handler-specific | GitHub App Setup Router | `pkg/hub/server.go:1827` | -| `GET` | `/learn` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1828` | -| `GET` | `/get-started` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1829` | -| `GET` | `/api/docs` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1832` | -| `GET` | `/api/reading-list` | Hub handler-specific | Reading List | `pkg/hub/server.go:1835` | -| `GET` | `/reading` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1836` | -| `GET` | `/cncf-reference-architecture` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1843` | -| `GET` | `/cncf-reference-architecture/console` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1844` | -| `GET` | `/cncf-reference-architecture/bluefin` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1845` | -| `GET` | `/{$}` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1862` | -| `GET` | `/og-card.png` | Hub handler-specific | OGCard | `pkg/hub/server.go:1867` | -| `GET` | `/` | Public | Static asset fallback (`http.FileServerFS` over the embedded `static/` tree) for any path no other route claims | `pkg/hub/server.go:1869` | +| `GET` | `/gh-setup` | Hub handler-specific | GitHub App Setup Router | `pkg/hub/server.go:1841` | +| `GET` | `/learn` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1842` | +| `GET` | `/get-started` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1843` | +| `GET` | `/api/docs` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1846` | +| `GET` | `/api/reading-list` | Hub handler-specific | Reading List | `pkg/hub/server.go:1849` | +| `GET` | `/reading` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1850` | +| `GET` | `/cncf-reference-architecture` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1857` | +| `GET` | `/cncf-reference-architecture/console` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1858` | +| `GET` | `/cncf-reference-architecture/bluefin` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1859` | +| `GET` | `/{$}` | Hub handler-specific | Static HTML page | `pkg/hub/server.go:1876` | +| `GET` | `/og-card.png` | Hub handler-specific | OGCard | `pkg/hub/server.go:1881` | +| `GET` | `/` | Public | Static asset fallback (`http.FileServerFS` over the embedded `static/` tree) for any path no other route claims | `pkg/hub/server.go:1883` | | `GET` | `/api/marketplace/workflows` | Public | Workflow-model marketplace index ([#17620](https://github.com/hivecommons/hive/issues/17620) phase 7): `{generatedAt, entries:[{name, version, hash, tier, description, source, states, columns, publishedAt, publishedBy, sourceSHA?, newerIngestAvailable, adoption:{}, ratings:{}, benchmarks:{}}]}`. Strong `ETag` (sha256 of the body) + `Cache-Control: no-cache`; `If-None-Match` → `304`. Tiers: `built-in`, `curated`, `ingested-unreviewed`, `local-published`. `404` when `HIVE_HUB_MARKETPLACE_DISABLED` is set | `pkg/hub/marketplace.go:36` | | `GET` | `/api/marketplace/workflows/{name}/{version}/bundle` | Public | One immutable signed bundle (`{apiVersion, model, profile, hash, createdAt, createdBy, tier}`), `Cache-Control: immutable`; `404` unknown, `400` malformed key | `pkg/hub/marketplace.go:37` | | `POST` | `/api/marketplace/workflows` | Spoke heartbeat bearer + `X-Hive-ID`, or Hub admin session | Publish a bundle. Body = bundle (≤ 4 MiB); the hub re-verifies the hash and recompiles the model before storing. Publisher may assert tier `local`/`local-published` (normalised to `local-published`) or `ingested-unreviewed`; `curated`/`built-in` require a hub admin session (`403` otherwise). `201 {published, created:true, entry}`; identical republish `200 created:false`; different content under an existing `name@version` `409`; verification failure `422`; unknown hive `403`; no hub secret `503` | `pkg/hub/marketplace.go:38` | diff --git a/docs/content/hive/api-reference/inception.md b/docs/content/hive/api-reference/inception.md index 3dfec6a5..3724a50d 100644 --- a/docs/content/hive/api-reference/inception.md +++ b/docs/content/hive/api-reference/inception.md @@ -9,17 +9,17 @@ The inception API was retired in favour of [Inception (spek) sessions](/docs/hiv | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `POST` | `/api/inception/start` | Dashboard auth/session | Retired (was: Inception Start): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:444` | -| `POST` | `/api/inception/scan` | Dashboard auth/session | Retired (was: Inception Scan): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:445` | -| `GET` | `/api/inception/state` | Dashboard auth/session | Retired (was: Inception State): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:446` | -| `POST` | `/api/inception/questions` | Dashboard auth/session | Retired (was: Inception Set Questions): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:447` | -| `POST` | `/api/inception/answer` | Dashboard auth/session | Retired (was: Inception Answer): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:448` | -| `POST` | `/api/inception/facts` | Dashboard auth/session | Retired (was: Inception Record Facts): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:449` | -| `GET` | `/api/inception/scaffold` | Dashboard auth/session | Retired (was: Inception Scaffold): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:450` | -| `POST` | `/api/inception/approve` | Dashboard auth/session | Retired (was: Inception Approve): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:451` | -| `POST` | `/api/inception/reset` | Dashboard auth/session | Retired (was: Inception Reset): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:452` | -| `GET` | `/api/inception/ideation-facts` | Dashboard auth/session | Retired (was: Inception Ideation Facts): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:453` | -| `GET` | `/api/inception/download` | Dashboard auth/session | Retired (was: Inception Download): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:454` | -| `GET` | `/api/inception/has-files` | Dashboard auth/session | Retired (was: Inception Has Files): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:455` | -| `PUT` | `/api/inception/wiki-name` | Dashboard auth/session | Retired (was: Inception Rename Wiki): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:456` | -| `POST` | `/api/inception/import` | Dashboard auth/session | Retired (was: Inception Import): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:457` | +| `POST` | `/api/inception/start` | Dashboard auth/session | Retired (was: Inception Start): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:447` | +| `POST` | `/api/inception/scan` | Dashboard auth/session | Retired (was: Inception Scan): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:448` | +| `GET` | `/api/inception/state` | Dashboard auth/session | Retired (was: Inception State): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:449` | +| `POST` | `/api/inception/questions` | Dashboard auth/session | Retired (was: Inception Set Questions): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:450` | +| `POST` | `/api/inception/answer` | Dashboard auth/session | Retired (was: Inception Answer): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:451` | +| `POST` | `/api/inception/facts` | Dashboard auth/session | Retired (was: Inception Record Facts): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:452` | +| `GET` | `/api/inception/scaffold` | Dashboard auth/session | Retired (was: Inception Scaffold): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:453` | +| `POST` | `/api/inception/approve` | Dashboard auth/session | Retired (was: Inception Approve): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:454` | +| `POST` | `/api/inception/reset` | Dashboard auth/session | Retired (was: Inception Reset): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:455` | +| `GET` | `/api/inception/ideation-facts` | Dashboard auth/session | Retired (was: Inception Ideation Facts): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:456` | +| `GET` | `/api/inception/download` | Dashboard auth/session | Retired (was: Inception Download): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:457` | +| `GET` | `/api/inception/has-files` | Dashboard auth/session | Retired (was: Inception Has Files): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:458` | +| `PUT` | `/api/inception/wiki-name` | Dashboard auth/session | Retired (was: Inception Rename Wiki): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:459` | +| `POST` | `/api/inception/import` | Dashboard auth/session | Retired (was: Inception Import): answers `410 Gone` pointing to `/api/sessions` | `pkg/dashboard/api.go:460` | diff --git a/docs/content/hive/api-reference/knowledge.md b/docs/content/hive/api-reference/knowledge.md index 0dcc9b40..453dd466 100644 --- a/docs/content/hive/api-reference/knowledge.md +++ b/docs/content/hive/api-reference/knowledge.md @@ -7,39 +7,39 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/knowledge` | Dashboard auth/session | Paginated knowledge facts: `type` filter, `limit` (default 50, max 200; invalid/non-positive values use the default), `offset` (default 0). Returns `enabled`, `facts`, `count` (this page), `total`, `limit`, `offset`, `has_more`; ordered by layer then slug. Offsets are not snapshot cursors: concurrent edits may shift pages. | `pkg/dashboard/api.go:377` | -| `GET` | `/api/knowledge/export` | Dashboard auth/session | Knowledge Export | `pkg/dashboard/api.go:378` | -| `POST` | `/mcp/knowledge` | Public (read-only) when the dashboard setting or `HIVE_PUBLIC_KNOWLEDGE` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Public Knowledge MCP endpoint — `initialize`, `tools/list`, `tools/call` for `knowledge_search`/`knowledge_toc`/`knowledge_get`/`knowledge_export` ([docs](/docs/hive/public-knowledge-mcp)) | `pkg/dashboard/api.go:388` | -| `GET` | `/api/knowledge/search` | Dashboard auth/session | Knowledge Search | `pkg/dashboard/api.go:379` | -| `GET` | `/api/knowledge/toc` | Dashboard auth/session | Scoped knowledge table of contents: capped, body-free entries (`id`, `title`, `type`, `layer`, `repo`, `tags`, `status`, `confidence`, `updated`, `size_bytes`, `source`) plus `total`/`returned`/`truncated`. Query: `layers`, `repos`, `types`, `tags` (comma-separated), `limit` (default 50, max 200), `include_states` (operator opt-in for `draft`/`deprecated`/`superseded`/`all`), `format=prompt` with `max_chars` for a bounded markdown rendering, `agent` to apply that agent's `knowledge.agent_scopes` entry (the other parameters can only narrow it). Approved knowledge only by default ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-toc.md)) | `pkg/dashboard/api.go:380` | -| `GET` | `/api/knowledge/advisor/summary` | Dashboard auth/session (read or higher) | Read-only knowledge-advisor rank-versus-holdout summary: `window` (`since`, `first_decision`, `last_decision`, `rank_mode_start`, `decisions`), `settings` (`enabled`, `mode`, `model`, `holdout_percent`, `max_calls_per_day`, `max_calls_per_agent_hour`, `candidates`, `on_error`, `problem`; never the endpoint or key), `counts` (`by_mode`, `by_arm`, `by_outcome`, `by_verdict`, `by_budget`), `errors` (`by_class` and `top_reasons` of redacted HTTP status, provider error code and message), `arms` (per-arm closed-bead `beads` and mean fix attempts, CI failures and kicks over every closed work bead) with `mixed` and `none` listed separately, `coverage` (`closed_beads`, `with_closed_pr`, `no_ref`, `no_decision`), `cost` (mean latency and tokens where records carry them), and a `small_n`/`caveat` pair. Counts and means only: no slugs, refs, agents or content. Query: `since` (RFC 3339) narrows the decision counts and cost, not the bead means ([docs](/docs/hive/operations/automation-and-review/retro-lane#reading-the-comparison-from-the-dashboard)) | `pkg/dashboard/api.go:381` | -| `GET` | `/api/knowledge/effective` | Dashboard auth/session | Effective knowledge for one agent (`agent` required): the agent's `knowledge.agent_scopes` entry (unrestricted when it has none) intersected with the request scope (approved only unless `include_states` is set). Returns `scope` (resolved scope applied, with `configured`), `included` TOC entries, `excluded` entries each with a `reason` (`lifecycle`, `layer`, `repo`, `type` or `tag` — first failing check, in that order), `included_total`/`excluded_total`/`included_returned`/`excluded_returned` and `truncated`; `limit` caps each list (default 50, max 200) ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-toc.md#effective-knowledge)) | `pkg/dashboard/api.go:382` | -| `GET` | `/api/knowledge/entry/{id}` | Dashboard auth/session | Full read of one knowledge entry: `markdown` (front-matter plus body) and the fact. Takes the same scope, `include_states` and `agent` query as the table of contents and returns 404 for an entry outside it ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-toc.md)) | `pkg/dashboard/api.go:383` | -| `POST` | `/api/knowledge/cli-memory/drain-legacy` | Owner only | One-shot drain of the shared home's legacy Claude memory (`/data/home/.claude/projects/*/memory`) into `state: draft` entries in `bead-synth-wiki`, tagged `cli-memory` and `agent:shared`, deduplicated by content hash. Body `{"truncate": bool}` (default false) empties only files whose every fact is now stored. Returns `store`, `agent`, `sources`, `drained`, `dupes`, `skipped`, `truncate`, `truncated`, `kept`, `errors`; 409 when the vault is not connected. Audited as `knowledge_drain_legacy_memory` ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-lifecycle.md#auto-memory-drafts)) | `pkg/dashboard/api.go:385` | -| `GET` | `/api/knowledge/public` | Dashboard auth/session | Public Knowledge MCP sharing status (`enabled`, `tags`, `source`, endpoint URL) | `pkg/dashboard/api.go:389` | -| `PUT` | `/api/knowledge/public` | Owner only | Persist public Knowledge MCP sharing setting; overrides env vars until changed | `pkg/dashboard/api.go:390` | -| `GET` | `/api/knowledge/health` | Dashboard auth/session | Knowledge Health | `pkg/dashboard/api.go:391` | -| `GET` | `/api/knowledge/stats` | Dashboard auth/session | Knowledge Stats | `pkg/dashboard/api.go:392` | -| `GET` | `/api/knowledge/graph` | Dashboard auth/session | Knowledge Graph | `pkg/dashboard/api.go:393` | -| `GET` | `/api/knowledge/fact-history` | Dashboard auth/session | Fact History | `pkg/dashboard/api.go:394` | -| `POST` | `/api/knowledge/create` | Dashboard auth/session | Create one fact (`title`, `body`, `type`, `tags`, `layer`, `confidence`, `state`). `state` is `approved` (default) or `draft`; a draft is written with `state: draft` into the local channel named by `layer` (400 when there is none, 409 when its title already names an entry). A request tagged `cli-memory` must be a draft carrying only `cli-memory`, `agent:`, `cli:`, `memhash:` and `repo:/` tags (400 otherwise) | `pkg/dashboard/api.go:395` | -| `POST` | `/api/knowledge/import` | Dashboard auth/session | Knowledge Import | `pkg/dashboard/api.go:396` | -| `POST` | `/api/knowledge/promote` | Dashboard auth/session | Knowledge Promote | `pkg/dashboard/api.go:402` | -| `GET` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs List | `pkg/dashboard/api.go:403` | -| `POST` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Add | `pkg/dashboard/api.go:404` | -| `DELETE` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Remove | `pkg/dashboard/api.go:405` | -| `PUT` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Update | `pkg/dashboard/api.go:406` | -| `DELETE` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Delete | `pkg/dashboard/api.go:407` | -| `GET` | `/api/knowledge/{layer}` | Dashboard auth/session | Knowledge Layer | `pkg/dashboard/api.go:408` | -| `GET` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Fact | `pkg/dashboard/api.go:409` | -| `PUT` | `/api/knowledge/enabled` | Owner only | Knowledge Toggle | `pkg/dashboard/api.go:410` | -| `GET` | `/api/knowledge/bead-synthesizer` | Dashboard auth/session | Bead Synth Status | `pkg/dashboard/api.go:411` | -| `PUT` | `/api/knowledge/bead-synthesizer/enabled` | Owner only | Bead Synth Toggle | `pkg/dashboard/api.go:412` | -| `GET` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults List | `pkg/dashboard/api.go:413` | -| `POST` | `/api/knowledge/vaults` | Owner only | Vaults Connect | `pkg/dashboard/api.go:414` | -| `DELETE` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults Disconnect | `pkg/dashboard/api.go:415` | -| `POST` | `/api/knowledge/vaults/reindex` | Dashboard auth/session | Vaults Reindex | `pkg/dashboard/api.go:416` | -| `GET` | `/api/knowledge/vaults/{name}/facts` | Dashboard auth/session | Vault Facts | `pkg/dashboard/api.go:417` | +| `GET` | `/api/knowledge` | Dashboard auth/session | Paginated knowledge facts: `type` filter, `limit` (default 50, max 200; invalid/non-positive values use the default), `offset` (default 0). Returns `enabled`, `facts`, `count` (this page), `total`, `limit`, `offset`, `has_more`; ordered by layer then slug. Offsets are not snapshot cursors: concurrent edits may shift pages. | `pkg/dashboard/api.go:380` | +| `GET` | `/api/knowledge/export` | Dashboard auth/session | Knowledge Export | `pkg/dashboard/api.go:381` | +| `POST` | `/mcp/knowledge` | Public (read-only) when the dashboard setting or `HIVE_PUBLIC_KNOWLEDGE` is on; otherwise 404 to a signed-in caller and 401 to one who is not | Public Knowledge MCP endpoint — `initialize`, `tools/list`, `tools/call` for `knowledge_search`/`knowledge_toc`/`knowledge_get`/`knowledge_export` ([docs](/docs/hive/public-knowledge-mcp)) | `pkg/dashboard/api.go:391` | +| `GET` | `/api/knowledge/search` | Dashboard auth/session | Knowledge Search | `pkg/dashboard/api.go:382` | +| `GET` | `/api/knowledge/toc` | Dashboard auth/session | Scoped knowledge table of contents: capped, body-free entries (`id`, `title`, `type`, `layer`, `repo`, `tags`, `status`, `confidence`, `updated`, `size_bytes`, `source`) plus `total`/`returned`/`truncated`. Query: `layers`, `repos`, `types`, `tags` (comma-separated), `limit` (default 50, max 200), `include_states` (operator opt-in for `draft`/`deprecated`/`superseded`/`all`), `format=prompt` with `max_chars` for a bounded markdown rendering, `agent` to apply that agent's `knowledge.agent_scopes` entry (the other parameters can only narrow it). Approved knowledge only by default ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-toc.md)) | `pkg/dashboard/api.go:383` | +| `GET` | `/api/knowledge/advisor/summary` | Dashboard auth/session (read or higher) | Read-only knowledge-advisor rank-versus-holdout summary: `window` (`since`, `first_decision`, `last_decision`, `rank_mode_start`, `decisions`), `settings` (`enabled`, `mode`, `model`, `holdout_percent`, `max_calls_per_day`, `max_calls_per_agent_hour`, `candidates`, `on_error`, `problem`; never the endpoint or key), `counts` (`by_mode`, `by_arm`, `by_outcome`, `by_verdict`, `by_budget`), `errors` (`by_class` and `top_reasons` of redacted HTTP status, provider error code and message), `arms` (per-arm closed-bead `beads` and mean fix attempts, CI failures and kicks over every closed work bead) with `mixed` and `none` listed separately, `coverage` (`closed_beads`, `with_closed_pr`, `no_ref`, `no_decision`), `cost` (mean latency and tokens where records carry them), and a `small_n`/`caveat` pair. Counts and means only: no slugs, refs, agents or content. Query: `since` (RFC 3339) narrows the decision counts and cost, not the bead means ([docs](/docs/hive/operations/automation-and-review/retro-lane#reading-the-comparison-from-the-dashboard)) | `pkg/dashboard/api.go:384` | +| `GET` | `/api/knowledge/effective` | Dashboard auth/session | Effective knowledge for one agent (`agent` required): the agent's `knowledge.agent_scopes` entry (unrestricted when it has none) intersected with the request scope (approved only unless `include_states` is set). Returns `scope` (resolved scope applied, with `configured`), `included` TOC entries, `excluded` entries each with a `reason` (`lifecycle`, `layer`, `repo`, `type` or `tag` — first failing check, in that order), `included_total`/`excluded_total`/`included_returned`/`excluded_returned` and `truncated`; `limit` caps each list (default 50, max 200) ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-toc.md#effective-knowledge)) | `pkg/dashboard/api.go:385` | +| `GET` | `/api/knowledge/entry/{id}` | Dashboard auth/session | Full read of one knowledge entry: `markdown` (front-matter plus body) and the fact. Takes the same scope, `include_states` and `agent` query as the table of contents and returns 404 for an entry outside it ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-toc.md)) | `pkg/dashboard/api.go:386` | +| `POST` | `/api/knowledge/cli-memory/drain-legacy` | Owner only | One-shot drain of the shared home's legacy Claude memory (`/data/home/.claude/projects/*/memory`) into `state: draft` entries in `bead-synth-wiki`, tagged `cli-memory` and `agent:shared`, deduplicated by content hash. Body `{"truncate": bool}` (default false) empties only files whose every fact is now stored. Returns `store`, `agent`, `sources`, `drained`, `dupes`, `skipped`, `truncate`, `truncated`, `kept`, `errors`; 409 when the vault is not connected. Audited as `knowledge_drain_legacy_memory` ([docs](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-lifecycle.md#auto-memory-drafts)) | `pkg/dashboard/api.go:388` | +| `GET` | `/api/knowledge/public` | Dashboard auth/session | Public Knowledge MCP sharing status (`enabled`, `tags`, `source`, endpoint URL) | `pkg/dashboard/api.go:392` | +| `PUT` | `/api/knowledge/public` | Owner only | Persist public Knowledge MCP sharing setting; overrides env vars until changed | `pkg/dashboard/api.go:393` | +| `GET` | `/api/knowledge/health` | Dashboard auth/session | Knowledge Health | `pkg/dashboard/api.go:394` | +| `GET` | `/api/knowledge/stats` | Dashboard auth/session | Knowledge Stats | `pkg/dashboard/api.go:395` | +| `GET` | `/api/knowledge/graph` | Dashboard auth/session | Knowledge Graph | `pkg/dashboard/api.go:396` | +| `GET` | `/api/knowledge/fact-history` | Dashboard auth/session | Fact History | `pkg/dashboard/api.go:397` | +| `POST` | `/api/knowledge/create` | Dashboard auth/session | Create one fact (`title`, `body`, `type`, `tags`, `layer`, `confidence`, `state`). `state` is `approved` (default) or `draft`; a draft is written with `state: draft` into the local channel named by `layer` (400 when there is none, 409 when its title already names an entry). A request tagged `cli-memory` must be a draft carrying only `cli-memory`, `agent:`, `cli:`, `memhash:` and `repo:/` tags (400 otherwise) | `pkg/dashboard/api.go:398` | +| `POST` | `/api/knowledge/import` | Dashboard auth/session | Knowledge Import | `pkg/dashboard/api.go:399` | +| `POST` | `/api/knowledge/promote` | Dashboard auth/session | Knowledge Promote | `pkg/dashboard/api.go:405` | +| `GET` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs List | `pkg/dashboard/api.go:406` | +| `POST` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Add | `pkg/dashboard/api.go:407` | +| `DELETE` | `/api/knowledge/subscriptions` | Dashboard auth/session | Knowledge Subs Remove | `pkg/dashboard/api.go:408` | +| `PUT` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Update | `pkg/dashboard/api.go:409` | +| `DELETE` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Delete | `pkg/dashboard/api.go:410` | +| `GET` | `/api/knowledge/{layer}` | Dashboard auth/session | Knowledge Layer | `pkg/dashboard/api.go:411` | +| `GET` | `/api/knowledge/{layer}/{slug}` | Dashboard auth/session | Knowledge Fact | `pkg/dashboard/api.go:412` | +| `PUT` | `/api/knowledge/enabled` | Owner only | Knowledge Toggle | `pkg/dashboard/api.go:413` | +| `GET` | `/api/knowledge/bead-synthesizer` | Dashboard auth/session | Bead Synth Status | `pkg/dashboard/api.go:414` | +| `PUT` | `/api/knowledge/bead-synthesizer/enabled` | Owner only | Bead Synth Toggle | `pkg/dashboard/api.go:415` | +| `GET` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults List | `pkg/dashboard/api.go:416` | +| `POST` | `/api/knowledge/vaults` | Owner only | Vaults Connect | `pkg/dashboard/api.go:417` | +| `DELETE` | `/api/knowledge/vaults` | Dashboard auth/session | Vaults Disconnect | `pkg/dashboard/api.go:418` | +| `POST` | `/api/knowledge/vaults/reindex` | Dashboard auth/session | Vaults Reindex | `pkg/dashboard/api.go:419` | +| `GET` | `/api/knowledge/vaults/{name}/facts` | Dashboard auth/session | Vault Facts | `pkg/dashboard/api.go:420` | | `GET` | `/api/config/knowledge/connectors` | Dashboard auth/session | Knowledge connectors config (name, type, layer, scope, env/file auth reference) and registered types | `pkg/dashboard/api.go` | | `PUT` | `/api/config/knowledge/connectors` | Owner only | Replace `knowledge.connectors` after validation; inline secrets rejected | `pkg/dashboard/api.go` | | `GET` | `/api/config/knowledge/connectors/status` | Dashboard auth/session | Per-connector status pill, last sync, pages/facts, last error, `running` and the live `progress` block (phase, items_done/items_total, current item, started_at; see [knowledge-connectors.md](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-connectors.md#api)), plus the `publish` mirror status | `pkg/dashboard/api.go` | @@ -49,19 +49,19 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | `PUT` | `/api/config/knowledge/agent-scopes` | Owner only | Replace `knowledge.agent_scopes` after validating layer and state names; persisted and audited as `config_knowledge_agent_scopes` | `pkg/dashboard/api.go` | | `GET` | `/api/config/knowledge/pipeline` | Owner only | Scalar bead synthesizer, curator, code map and primer settings and `knowledge.sidecar_advise`, plus the read-only engine, advisor flag, vault paths and primer merge strategy ([docs](/docs/hive/dashboard/dashboard-settings-explained#knowledge)) | `pkg/dashboard/api.go` | | `PUT` | `/api/config/knowledge/pipeline` | Owner only | Update those settings after `config.ValidateKnowledgePipeline`; 0 or empty restores the default; the bead synthesizer switch and `sidecar_advise` apply at once, the rest after a restart; audited as `config_knowledge_pipeline` | `pkg/dashboard/api.go` | -| `GET` | `/api/knowledge/git-sources` | Dashboard auth/session | Git Sources List | `pkg/dashboard/api.go:427` | -| `POST` | `/api/knowledge/git-sources` | Owner only | Git Sources Connect | `pkg/dashboard/api.go:428` | -| `DELETE` | `/api/knowledge/git-sources` | Owner only | Git Sources Disconnect | `pkg/dashboard/api.go:429` | -| `POST` | `/api/knowledge/obsidian/sync` | Dashboard auth/session | Obsidian Sync | `pkg/dashboard/api.go:430` | -| `GET` | `/api/knowledge/documents` | Dashboard auth/session | Documents List | `pkg/dashboard/api.go:431` | -| `POST` | `/api/knowledge/documents` | Dashboard auth/session | Documents Import | `pkg/dashboard/api.go:432` | -| `GET` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Get | `pkg/dashboard/api.go:433` | -| `DELETE` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Delete | `pkg/dashboard/api.go:434` | -| `POST` | `/api/knowledge/documents/{slug}/reimport` | Dashboard auth/session | Document Reimport | `pkg/dashboard/api.go:435` | -| `GET` | `/api/knowledge/context7/search` | Dashboard auth/session | Context7 Search | `pkg/dashboard/api.go:436` | -| `POST` | `/api/knowledge/cleanup-orphans` | Dashboard auth/session | Cleanup Orphans | `pkg/dashboard/api.go:437` | -| `GET` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channels List | `pkg/dashboard/api.go:400` | -| `POST` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channel Create | `pkg/dashboard/api.go:401` | +| `GET` | `/api/knowledge/git-sources` | Dashboard auth/session | Git Sources List | `pkg/dashboard/api.go:430` | +| `POST` | `/api/knowledge/git-sources` | Owner only | Git Sources Connect | `pkg/dashboard/api.go:431` | +| `DELETE` | `/api/knowledge/git-sources` | Owner only | Git Sources Disconnect | `pkg/dashboard/api.go:432` | +| `POST` | `/api/knowledge/obsidian/sync` | Dashboard auth/session | Obsidian Sync | `pkg/dashboard/api.go:433` | +| `GET` | `/api/knowledge/documents` | Dashboard auth/session | Documents List | `pkg/dashboard/api.go:434` | +| `POST` | `/api/knowledge/documents` | Dashboard auth/session | Documents Import | `pkg/dashboard/api.go:435` | +| `GET` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Get | `pkg/dashboard/api.go:436` | +| `DELETE` | `/api/knowledge/documents/{slug}` | Dashboard auth/session | Document Delete | `pkg/dashboard/api.go:437` | +| `POST` | `/api/knowledge/documents/{slug}/reimport` | Dashboard auth/session | Document Reimport | `pkg/dashboard/api.go:438` | +| `GET` | `/api/knowledge/context7/search` | Dashboard auth/session | Context7 Search | `pkg/dashboard/api.go:439` | +| `POST` | `/api/knowledge/cleanup-orphans` | Dashboard auth/session | Cleanup Orphans | `pkg/dashboard/api.go:440` | +| `GET` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channels List | `pkg/dashboard/api.go:403` | +| `POST` | `/api/knowledge/channels` | Dashboard auth/session | Knowledge Channel Create | `pkg/dashboard/api.go:404` | | `GET` | `/api/knowledge/connectors` | Dashboard auth/session | Knowledge connector statuses, each with a live `progress` block while a sync runs, and publish mirror status (`{"connectors": [...], "publish": {...}\|null}`, see [knowledge-connectors.md](https://github.com/hivecommons/hive/blob/v5/src/docs/knowledge-connectors.md)) | `pkg/dashboard/api_knowledge_connectors.go:24` | | `POST` | `/api/knowledge/connectors/{name}/sync` | Owner only | Start one connector sync now (202; 404 unknown, 409 running) | `pkg/dashboard/api_knowledge_connectors.go:25` | | `POST` | `/api/knowledge/publish/sync` | Owner only | Run a publish mirror batch now (202 with publish status; 503 mirror not running, 409 batch in progress) | `pkg/dashboard/api_knowledge_connectors.go:26` | diff --git a/docs/content/hive/api-reference/nous.md b/docs/content/hive/api-reference/nous.md index 7581adb1..cb5206ef 100644 --- a/docs/content/hive/api-reference/nous.md +++ b/docs/content/hive/api-reference/nous.md @@ -7,28 +7,28 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| -| `GET` | `/api/nous/status` | Dashboard auth/session | Nous Status — includes `experimentLoop` (`dir`, `lastWriteAt`, `running`, `idleAfterSeconds`): whether the external experiment loop, the only producer of proposals, has written under `/var/run/nous/governor` within 24 evaluation cycles; ready cards then carry `experimentLoopIdle` ([#12541](https://github.com/hivecommons/hive/issues/12541)) | `pkg/dashboard/api.go:473` | -| `GET` | `/api/nous/ledger` | Dashboard auth/session | Nous Ledger | `pkg/dashboard/api.go:474` | -| `GET` | `/api/nous/principles` | Dashboard auth/session | Nous Principles | `pkg/dashboard/api.go:475` | -| `POST` | `/api/nous/approve` | Owner only | Nous Approve | `pkg/dashboard/api.go:476` | -| `POST` | `/api/nous/abort` | Owner only | Nous Abort | `pkg/dashboard/api.go:477` | -| `PUT` | `/api/nous/mode` | Owner only | Nous Mode | `pkg/dashboard/api.go:478` | -| `PUT` | `/api/nous/scope` | Owner only | Nous Scope | `pkg/dashboard/api.go:479` | -| `GET` | `/api/nous/phase` | Dashboard auth/session | Nous Phase | `pkg/dashboard/api.go:480` | -| `PUT` | `/api/nous/gate-decision` | Owner only | Nous Gate Decision | `pkg/dashboard/api.go:481` | -| `GET` | `/api/nous/gate-pending` | Dashboard auth/session | Nous Gate Pending | `pkg/dashboard/api.go:482` | -| `POST` | `/api/nous/gate-respond` | Owner only | Nous Gate Respond | `pkg/dashboard/api.go:483` | -| `GET` | `/api/nous/gate-response` | Dashboard auth/session | Nous Gate Response | `pkg/dashboard/api.go:484` | -| `GET` | `/api/nous/config` | Dashboard auth/session | Nous Config Get | `pkg/dashboard/api.go:485` | -| `PUT` | `/api/nous/config/goals` | Owner only | Nous Config Goals — legacy; the dashboard no longer exposes the research question in the ⚙ dialog, use `PATCH /api/nous/campaigns/{id}` | `pkg/dashboard/api.go:486` | -| `PUT` | `/api/nous/config/repos` | Owner only | Nous Config Repos — the allow-list of repos experiments may target (empty = any) | `pkg/dashboard/api.go:487` | -| `PUT` | `/api/nous/config/output` | Owner only | Nous Config Output | `pkg/dashboard/api.go:488` | -| `PUT` | `/api/nous/config/fast-fail` | Owner only | Nous Config Fast Fail | `pkg/dashboard/api.go:489` | -| `PUT` | `/api/nous/config/schedule` | Owner only | Nous Config Schedule | `pkg/dashboard/api.go:490` | -| `PUT` | `/api/nous/config/controllables` | Owner only | Nous Config Controllables | `pkg/dashboard/api.go:491` | -| `PUT` | `/api/nous/config/principles` | Owner only | Nous Config Principles | `pkg/dashboard/api.go:492` | -| `DELETE` | `/api/nous/principles/{id}` | Owner only | Nous Delete Principle | `pkg/dashboard/api.go:493` | -| `POST` | `/api/nous/campaign/start` | Owner only | Nous Campaign Start — archives the active campaign and starts a new experiment whose baseline restarts at 0 ([#12501](https://github.com/hivecommons/hive/issues/12501)) | `pkg/dashboard/api.go:494` | -| `GET` | `/api/nous/campaigns` | Any | Nous Campaigns List — every experiment with its per-campaign baseline, scope, results and stage ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:495` | -| `POST` | `/api/nous/campaigns` | Owner only | Nous Campaigns Create — starts an experiment alongside the running ones; 409 `scope_conflict` when a running experiment shares a repo target or both are hive-wide ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:496` | -| `PATCH` | `/api/nous/campaigns/{id}` | Owner only | Nous Campaign Patch — pause / resume / archive, or edit question, hypothesis and scope. Hypothesis/tag edits save in place (`status: "updated"`); a changed question or repo set needs `restart: true` (else 409 `restart_required`) and archives the campaign as version N while creating version N+1 with `restartedFrom` (`status: "restarted", campaign, archived`); resume, scope widening and restarts re-run the conflict guard ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:497` | +| `GET` | `/api/nous/status` | Dashboard auth/session | Nous Status — includes `experimentLoop` (`dir`, `lastWriteAt`, `running`, `idleAfterSeconds`): whether the external experiment loop, the only producer of proposals, has written under `/var/run/nous/governor` within 24 evaluation cycles; ready cards then carry `experimentLoopIdle` ([#12541](https://github.com/hivecommons/hive/issues/12541)) | `pkg/dashboard/api.go:476` | +| `GET` | `/api/nous/ledger` | Dashboard auth/session | Nous Ledger | `pkg/dashboard/api.go:477` | +| `GET` | `/api/nous/principles` | Dashboard auth/session | Nous Principles | `pkg/dashboard/api.go:478` | +| `POST` | `/api/nous/approve` | Owner only | Nous Approve | `pkg/dashboard/api.go:479` | +| `POST` | `/api/nous/abort` | Owner only | Nous Abort | `pkg/dashboard/api.go:480` | +| `PUT` | `/api/nous/mode` | Owner only | Nous Mode | `pkg/dashboard/api.go:481` | +| `PUT` | `/api/nous/scope` | Owner only | Nous Scope | `pkg/dashboard/api.go:482` | +| `GET` | `/api/nous/phase` | Dashboard auth/session | Nous Phase | `pkg/dashboard/api.go:483` | +| `PUT` | `/api/nous/gate-decision` | Owner only | Nous Gate Decision | `pkg/dashboard/api.go:484` | +| `GET` | `/api/nous/gate-pending` | Dashboard auth/session | Nous Gate Pending | `pkg/dashboard/api.go:485` | +| `POST` | `/api/nous/gate-respond` | Owner only | Nous Gate Respond | `pkg/dashboard/api.go:486` | +| `GET` | `/api/nous/gate-response` | Dashboard auth/session | Nous Gate Response | `pkg/dashboard/api.go:487` | +| `GET` | `/api/nous/config` | Dashboard auth/session | Nous Config Get | `pkg/dashboard/api.go:488` | +| `PUT` | `/api/nous/config/goals` | Owner only | Nous Config Goals — legacy; the dashboard no longer exposes the research question in the ⚙ dialog, use `PATCH /api/nous/campaigns/{id}` | `pkg/dashboard/api.go:489` | +| `PUT` | `/api/nous/config/repos` | Owner only | Nous Config Repos — the allow-list of repos experiments may target (empty = any) | `pkg/dashboard/api.go:490` | +| `PUT` | `/api/nous/config/output` | Owner only | Nous Config Output | `pkg/dashboard/api.go:491` | +| `PUT` | `/api/nous/config/fast-fail` | Owner only | Nous Config Fast Fail | `pkg/dashboard/api.go:492` | +| `PUT` | `/api/nous/config/schedule` | Owner only | Nous Config Schedule | `pkg/dashboard/api.go:493` | +| `PUT` | `/api/nous/config/controllables` | Owner only | Nous Config Controllables | `pkg/dashboard/api.go:494` | +| `PUT` | `/api/nous/config/principles` | Owner only | Nous Config Principles | `pkg/dashboard/api.go:495` | +| `DELETE` | `/api/nous/principles/{id}` | Owner only | Nous Delete Principle | `pkg/dashboard/api.go:496` | +| `POST` | `/api/nous/campaign/start` | Owner only | Nous Campaign Start — archives the active campaign and starts a new experiment whose baseline restarts at 0 ([#12501](https://github.com/hivecommons/hive/issues/12501)) | `pkg/dashboard/api.go:497` | +| `GET` | `/api/nous/campaigns` | Any | Nous Campaigns List — every experiment with its per-campaign baseline, scope, results and stage ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:498` | +| `POST` | `/api/nous/campaigns` | Owner only | Nous Campaigns Create — starts an experiment alongside the running ones; 409 `scope_conflict` when a running experiment shares a repo target or both are hive-wide ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:499` | +| `PATCH` | `/api/nous/campaigns/{id}` | Owner only | Nous Campaign Patch — pause / resume / archive, or edit question, hypothesis and scope. Hypothesis/tag edits save in place (`status: "updated"`); a changed question or repo set needs `restart: true` (else 409 `restart_required`) and archives the campaign as version N while creating version N+1 with `restartedFrom` (`status: "restarted", campaign, archived`); resume, scope widening and restarts re-run the conflict guard ([#12532](https://github.com/hivecommons/hive/issues/12532)) | `pkg/dashboard/api.go:500` | diff --git a/docs/content/hive/api-reference/packs-and-acmm.md b/docs/content/hive/api-reference/packs-and-acmm.md index 5f3d0657..50e5fbaa 100644 --- a/docs/content/hive/api-reference/packs-and-acmm.md +++ b/docs/content/hive/api-reference/packs-and-acmm.md @@ -9,10 +9,10 @@ For a PR hold release, send `{"held": false, "type": "pr", "head": "/` hash that opens it. | `pkg/dashboard/api.go:610` | -| `PUT` | `/api/packs/level` | Owner only | Set the ACMM level. Body `{"level": N}` persists and applies the pack; optional `{"release_level_holds": true}` performs a deliberate one-off release of Hive App level-applied `hold` labels for the transition. Level holds are otherwise never auto-released. When the change makes the L6 self-authored merge sweep eligible, the success body adds `self_merge_sweep_active`, `level_changed_at`, `level_holds_pending: [{repo, number, title, url, agent}]`, and `repos: [{repo, auto_merge}]` so the dashboard can show the owner an informational notice and repo toggles. | `pkg/dashboard/api.go:322` | +| `GET` | `/api/packs` | Dashboard auth/session | Packs List | `pkg/dashboard/api.go:323` | +| `POST` | `/api/packs/{level}/apply` | Owner only | Pack Apply | `pkg/dashboard/api.go:324` | +| `GET` | `/api/packs/{level}/preflight` | Owner only | What the level's pack needs before applying it. Read-only. Returns `{level, name, requires, ready, unmet: [{id, reason, settings, anchor}], notes: [string]}`: `requires` is the pack's declared `requires:` list, `unmet` reports unconfigured requirements (`ioscan-classifier`: a model endpoint or a tool-less `ioscan.classifier.backend` when the level makes the classifier fail closed; `trajectory-reviewer`: a reviewer endpoint and model while Trajectory Review is on; `github-app-permissions`: GitHub repository installation grants). `notes` describes agent token-tier limits without affecting `ready`; it may be null when empty. Forgejo repositories are skipped. A failed permission lookup is reported separately from a missing grant. `settings` names where to fix a requirement; `anchor`, when present, opens its Settings field. | `pkg/dashboard/api.go:613` | +| `PUT` | `/api/packs/level` | Owner only | Set the ACMM level. Body `{"level": N}` persists and applies the pack; optional `{"release_level_holds": true}` performs a deliberate one-off release of Hive App level-applied `hold` labels for the transition. Level holds are otherwise never auto-released. When the change makes the L6 self-authored merge sweep eligible, the success body adds `self_merge_sweep_active`, `level_changed_at`, `level_holds_pending: [{repo, number, title, url, agent}]`, and `repos: [{repo, auto_merge}]` so the dashboard can show the owner an informational notice and repo toggles. | `pkg/dashboard/api.go:325` | | `POST` | `/api/repos/rescan` | Dashboard auth/session | Re-enumerate watched repositories' open issues/PRs for the dashboard Projects cards. The scan is read-only with respect to agents/governor actions, collapses concurrent requests, and debounces repeated presses for 30 seconds (`repoRescanDebounce`) so the button cannot hammer GitHub | `pkg/dashboard/api.go`, `pkg/dashboard/api_repos_rescan.go` | | `POST` | `/api/repos/pause` | Owner | Quiet ONE repository without stopping the hive: agents stop writing to it and stop being handed work on it, while it keeps its dashboard card and ACMM eval. Body `{"repo": "...", "reason": "..."}` — the repo travels in the body because a `project.repos` entry may be an explicit cross-org `owner/name`. Records who/when/why; `changed: false` marks a no-op re-pause and leaves the original provenance intact; `persisted: false` means the pause is in force but could not be written to config. Rejects a repo outside `project.repos`. See [per-repo agent pause](https://github.com/hivecommons/hive/blob/v5/src/docs/repo-pause.md) | `pkg/dashboard/api_repo_pause.go` | | `POST` | `/api/repos/resume` | Owner | Lift a repository's pause. Unlike pause, does not require the repo to be in `project.repos`, so a pause left behind by a removed repo can still be cleared | `pkg/dashboard/api_repo_pause.go` | @@ -20,21 +20,21 @@ For a PR hold release, send `{"held": false, "type": "pr", "head": "` label (shortened with a hash suffix when the plain spelling would exceed GitHub's 50-character label cap, [#17037](https://github.com/hivecommons/hive/issues/17037)); `{"held": false}` removes exactly the labels causing the hold (`hive-pause/` and/or generic hold labels) and never removes `hive/` provenance. A GitHub failure answers `424` with the step and GitHub's reason — never `502`/`503`, which the hosted Ingress replaces with its generic "hive unavailable" page. Every toggle writes an audit-log entry; the #8851 upgrade migration writes `/data/hive-hold-migration-.json` with audit-backed, provenance-only, and ambiguous legacy `hive/` classifications. A hold added, or a release that removed a label, also records the dashboard user on the item in one App-authored comment under ``, edited in place (newest first, last 10) on the next hold action instead of repeated, because GitHub names the App as the label's actor ([#19852](https://github.com/hivecommons/hive/issues/19852)); `dashboard.attribute_label_actions: false` turns it off. A comment failure is logged and never fails the toggle. | `pkg/dashboard/api.go:342`, `pkg/dashboard/api_repo_hold.go` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/decision` | Owner or repo write/maintain/admin, signed-in GitHub user | Record an operator decision from the activity monitor's row menu / selection bar. Body `{"decision": "approve"|"direction"|"close-superseded"|"close-wontfix"|"close-read"|"close-issue"|"adopt"|"reroute"|"re-author"|"merge-now"|"queue-merge", "comment": "…", "type": "issue"|"pr", "superseded_by": "#458", "force": true, "to": ""|"any"}` (`force` only with `adopt`, `to` only with `reroute`; an unknown `decision` is a 400). On an issue parked at 045, `approve`/`direction` act exactly as a maintainer's `/hive approve` / `/hive decision ` comment would (labels, `approved-direction`, stage-engine Unparked fact, reply comment naming the operator). On a PR parked at 085 (`type: "pr"`), `approve` posts the `/lgtm` and `/approve` commands as two comments attributed to the operator, records the approval against the head as the human answer to a `requires_human` / decision-requested verdict (the lanes and the stage engine honour it like a trusted merger's Approve review), lifts `needs-human`, clears the sentinel label and acknowledges the bundle's sentinel findings for that head, re-derives the stage and drops the tracker cache — the response adds `released` (`approval-recorded`, `needs-human`, `sentinel-label`, `sentinel-acknowledged`) and `stage`; the merge gate decides from there (no review as the operator, no merge) — and `direction` records the text as a human change request against the head — the `/hive decision` fix lane — on a hive-authored PR, and on a contributor's clanker PR (`author/clanker` / hive attribution markers) where the text is posted to the contributor's hive and the PR moves to `stage/072-returned-to-contributor` (`status: "direction-returned-to-contributor"`); a person's PR, which no hive can carry direction to, answers 409. The close variants first post a required comment naming the operator (and the superseding PR when `superseded_by` is given); a failed comment prevents closure. `close-superseded` and `close-wontfix` close as **not planned**; `close-read` acknowledges an advisory issue and closes it **as completed**. `close-issue` (`type: "issue"` only) closes the single named open issue **as completed**, at any stage, leaving linked PRs and other issues untouched; it returns 400 for a PR (including one sent as an issue), 404 when the issue is not found, and 409 when already closed. It retains the existing permission and mutation gates, including the paused-repo `status: "refused"` result without writes. `adopt` and `re-author` require `type: "pr"` and queue adoption via the `adoption/supersede` label (409 unless `governor.labels.stage.adoption` is enabled). `adopt` with `"force": true` is *Adopt now* ([#15038](https://github.com/hivecommons/hive/issues/15038)): it bypasses the author's presence, the grace window and `maintainer_policy`, marks the stage record and nudges the automerge sweep so the adoption engine supersedes the head at once (responds `status: "already-adopted"` when nothing is left to do; 400 on the hive's own PR). `reroute` (`type: "pr"`, `"to": ""|"any"`) hands the PR's follow-up work to another online clanker through the contributor fix queue, posts a `` note and arms a pickup timer that falls back to Adopt now after `governor.reroute.pickup_timeout`; answers `status: "rerouted"`, 409 when no clanker is online or adoption is disabled. On a PR at 090, `queue-merge` (*Approve and let hive merge*, the lead action) records an approval attributed to the operator and applies the automerge label, returning `status: "queued-for-merge"` (on the hive's own PR, which the App cannot review, the queue note is a comment and the operator's approval is recorded as `approve` records it — `released` lists `approval-recorded`, `admitted`); hive's merge sweep merges on its next tick once CI is green and the head has soaked, and that recorded operator approval is the one thing that lets the sweep merge an untrusted-author PR (the merge comment names the operator). `merge-now` (*Merge now as maintainer*, secondary) posts an attributed comment and merges immediately through the hive's GitHub App, returning `status: "merged"`. Both require `type: "pr"` and a verified owner or `merger` role in addition to the route's repo permission check; both refuse closed/merged PRs and the operator's own PR. `merge-now` on a PR whose `mergeable_state` is `dirty`/`behind` instead answers `202` with `status: "rebase-queued"` (approval recorded, rebase kicked, merge follows via the follow-through once the hive's own rebase is green; a head pushed by anyone else fails the follow-through closed; `head-not-pushable` refusal on a fork without maintainer edits). `approve` on such a PR adds `rebase: {attempt, max, exhausted, head, text}` for the rebase episode it opened. `approve`, `merge-now` and `queue-merge` on a PR with an open change request from a reviewer with write access ([#20067](https://github.com/hivecommons/hive/issues/20067)) answer 409 with `status: "changes-requested"`, `needs_override_reason: true` and `change_requests: [{reviewer, review_id, commit_id, url}]`, and write nothing; resent with `"override_reason": "…"` and `"override_review_ids": [...]` naming every change request still open they proceed, the override covering exactly those change requests (`repo_item_decision_changes_requested_override` with the reason; the refusal is `repo_item_decision_changes_requested_blocked`). Every decision writes an audit-log entry (`repo_item_decision_*`, e.g. `repo_item_decision_adopt_now`, `repo_item_decision_reroute`). | `pkg/dashboard/api.go:344`, `pkg/dashboard/api_repo_item_decision.go` | -| `GET` | `/api/notes` | Signed-in GitHub user (or verified owner) | Maintainer notes — the private per-item notes maintainers leave each other on Activity Monitor rows ([#maintainer-notes](https://github.com/hivecommons/hive/blob/v5/src/docs/operator-reference.md#maintainer-notes)). `?repo=owner/name&number=N` lists one item's live notes oldest first; with no query, every live note in the hive (the SPA's count badges). `{notes: [{id, repo, number, author, text, created_at}]}`. Never read from or written to GitHub. | `pkg/dashboard/api.go:348`, `pkg/dashboard/api_maintainer_notes.go` | -| `POST` | `/api/notes` | Owner or repo write/maintain/admin, signed-in GitHub user | Append a maintainer note. Body `{repo, number, text}` — `text` is plain text up to 2000 characters; the author is the dashboard session's GitHub login, never a body field. `401` signed out, `403` without write on the repo, `400` for an empty/oversized note or a bad item. `201 {ok, note}`; appended to `/data/maintainer-notes.jsonl`, audited as `maintainer_note_add`, and broadcast as the `maintainer-notes` SSE event `{seq, repo, number, count, action}` so other maintainers' browsers refresh the row. | `pkg/dashboard/api.go:349`, `pkg/dashboard/api_maintainer_notes.go` | -| `DELETE` | `/api/notes/{id}` | The note's author, or a verified owner | Tombstone a maintainer note (append-only store: a `deleted_at` record, never a rewrite). `404` unknown or already deleted, `403` for anyone else. `{ok, note}`; audited as `maintainer_note_delete`, broadcast as `maintainer-notes`. | `pkg/dashboard/api.go:350`, `pkg/dashboard/api_maintainer_notes.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/hold` | Owner or repo write/maintain/admin | Add or remove a dashboard hold chip for an issue or PR. Body `{"held": true}` adds the hive's exact-match canonical `hive-pause/` label (shortened with a hash suffix when the plain spelling would exceed GitHub's 50-character label cap, [#17037](https://github.com/hivecommons/hive/issues/17037)); `{"held": false}` removes exactly the labels causing the hold (`hive-pause/` and/or generic hold labels) and never removes `hive/` provenance. A GitHub failure answers `424` with the step and GitHub's reason — never `502`/`503`, which the hosted Ingress replaces with its generic "hive unavailable" page. Every toggle writes an audit-log entry; the #8851 upgrade migration writes `/data/hive-hold-migration-.json` with audit-backed, provenance-only, and ambiguous legacy `hive/` classifications. A hold added, or a release that removed a label, also records the dashboard user on the item in one App-authored comment under ``, edited in place (newest first, last 10) on the next hold action instead of repeated, because GitHub names the App as the label's actor ([#19852](https://github.com/hivecommons/hive/issues/19852)); `dashboard.attribute_label_actions: false` turns it off. A comment failure is logged and never fails the toggle. | `pkg/dashboard/api.go:345`, `pkg/dashboard/api_repo_hold.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/decision` | Owner or repo write/maintain/admin, signed-in GitHub user | Record an operator decision from the activity monitor's row menu / selection bar. Body `{"decision": "approve"|"direction"|"close-superseded"|"close-wontfix"|"close-read"|"close-issue"|"adopt"|"reroute"|"re-author"|"merge-now"|"queue-merge", "comment": "…", "type": "issue"|"pr", "superseded_by": "#458", "force": true, "to": ""|"any"}` (`force` only with `adopt`, `to` only with `reroute`; an unknown `decision` is a 400). On an issue parked at 045, `approve`/`direction` act exactly as a maintainer's `/hive approve` / `/hive decision ` comment would (labels, `approved-direction`, stage-engine Unparked fact, reply comment naming the operator). On a PR parked at 085 (`type: "pr"`), `approve` posts the `/lgtm` and `/approve` commands as two comments attributed to the operator, records the approval against the head as the human answer to a `requires_human` / decision-requested verdict (the lanes and the stage engine honour it like a trusted merger's Approve review), lifts `needs-human`, clears the sentinel label and acknowledges the bundle's sentinel findings for that head, re-derives the stage and drops the tracker cache — the response adds `released` (`approval-recorded`, `needs-human`, `sentinel-label`, `sentinel-acknowledged`) and `stage`; the merge gate decides from there (no review as the operator, no merge) — and `direction` records the text as a human change request against the head — the `/hive decision` fix lane — on a hive-authored PR, and on a contributor's clanker PR (`author/clanker` / hive attribution markers) where the text is posted to the contributor's hive and the PR moves to `stage/072-returned-to-contributor` (`status: "direction-returned-to-contributor"`); a person's PR, which no hive can carry direction to, answers 409. The close variants first post a required comment naming the operator (and the superseding PR when `superseded_by` is given); a failed comment prevents closure. `close-superseded` and `close-wontfix` close as **not planned**; `close-read` acknowledges an advisory issue and closes it **as completed**. `close-issue` (`type: "issue"` only) closes the single named open issue **as completed**, at any stage, leaving linked PRs and other issues untouched; it returns 400 for a PR (including one sent as an issue), 404 when the issue is not found, and 409 when already closed. It retains the existing permission and mutation gates, including the paused-repo `status: "refused"` result without writes. `adopt` and `re-author` require `type: "pr"` and queue adoption via the `adoption/supersede` label (409 unless `governor.labels.stage.adoption` is enabled). `adopt` with `"force": true` is *Adopt now* ([#15038](https://github.com/hivecommons/hive/issues/15038)): it bypasses the author's presence, the grace window and `maintainer_policy`, marks the stage record and nudges the automerge sweep so the adoption engine supersedes the head at once (responds `status: "already-adopted"` when nothing is left to do; 400 on the hive's own PR). `reroute` (`type: "pr"`, `"to": ""|"any"`) hands the PR's follow-up work to another online clanker through the contributor fix queue, posts a `` note and arms a pickup timer that falls back to Adopt now after `governor.reroute.pickup_timeout`; answers `status: "rerouted"`, 409 when no clanker is online or adoption is disabled. On a PR at 090, `queue-merge` (*Approve and let hive merge*, the lead action) records an approval attributed to the operator and applies the automerge label, returning `status: "queued-for-merge"` (on the hive's own PR, which the App cannot review, the queue note is a comment and the operator's approval is recorded as `approve` records it — `released` lists `approval-recorded`, `admitted`); hive's merge sweep merges on its next tick once CI is green and the head has soaked, and that recorded operator approval is the one thing that lets the sweep merge an untrusted-author PR (the merge comment names the operator). `merge-now` (*Merge now as maintainer*, secondary) posts an attributed comment and merges immediately through the hive's GitHub App, returning `status: "merged"`. Both require `type: "pr"` and a verified owner or `merger` role in addition to the route's repo permission check; both refuse closed/merged PRs and the operator's own PR. `merge-now` on a PR whose `mergeable_state` is `dirty`/`behind` instead answers `202` with `status: "rebase-queued"` (approval recorded, rebase kicked, merge follows via the follow-through once the hive's own rebase is green; a head pushed by anyone else fails the follow-through closed; `head-not-pushable` refusal on a fork without maintainer edits). `approve` on such a PR adds `rebase: {attempt, max, exhausted, head, text}` for the rebase episode it opened. `approve`, `merge-now` and `queue-merge` on a PR with an open change request from a reviewer with write access ([#20067](https://github.com/hivecommons/hive/issues/20067)) answer 409 with `status: "changes-requested"`, `needs_override_reason: true` and `change_requests: [{reviewer, review_id, commit_id, url}]`, and write nothing; resent with `"override_reason": "…"` and `"override_review_ids": [...]` naming every change request still open they proceed, the override covering exactly those change requests (`repo_item_decision_changes_requested_override` with the reason; the refusal is `repo_item_decision_changes_requested_blocked`). Every decision writes an audit-log entry (`repo_item_decision_*`, e.g. `repo_item_decision_adopt_now`, `repo_item_decision_reroute`). | `pkg/dashboard/api.go:347`, `pkg/dashboard/api_repo_item_decision.go` | +| `GET` | `/api/notes` | Signed-in GitHub user (or verified owner) | Maintainer notes — the private per-item notes maintainers leave each other on Activity Monitor rows ([#maintainer-notes](https://github.com/hivecommons/hive/blob/v5/src/docs/operator-reference.md#maintainer-notes)). `?repo=owner/name&number=N` lists one item's live notes oldest first; with no query, every live note in the hive (the SPA's count badges). `{notes: [{id, repo, number, author, text, created_at}]}`. Never read from or written to GitHub. | `pkg/dashboard/api.go:351`, `pkg/dashboard/api_maintainer_notes.go` | +| `POST` | `/api/notes` | Owner or repo write/maintain/admin, signed-in GitHub user | Append a maintainer note. Body `{repo, number, text}` — `text` is plain text up to 2000 characters; the author is the dashboard session's GitHub login, never a body field. `401` signed out, `403` without write on the repo, `400` for an empty/oversized note or a bad item. `201 {ok, note}`; appended to `/data/maintainer-notes.jsonl`, audited as `maintainer_note_add`, and broadcast as the `maintainer-notes` SSE event `{seq, repo, number, count, action}` so other maintainers' browsers refresh the row. | `pkg/dashboard/api.go:352`, `pkg/dashboard/api_maintainer_notes.go` | +| `DELETE` | `/api/notes/{id}` | The note's author, or a verified owner | Tombstone a maintainer note (append-only store: a `deleted_at` record, never a rewrite). `404` unknown or already deleted, `403` for anyone else. `{ok, note}`; audited as `maintainer_note_delete`, broadcast as `maintainer-notes`. | `pkg/dashboard/api.go:353`, `pkg/dashboard/api_maintainer_notes.go` | | `POST` / `GET` | `/api/repos/{owner}/{repo}/items/{number}/decide-delegated` | Same as `…/hold` (owner or repo write), signed-in GitHub user; `decisions.delegate.enabled` (403 when off) | *Let hive decide*: enqueue a delegated-decision job in which the hive decides the parked item itself as the owner's delegate under `pkg/delegatedecision.PolicyText` and records it as a human decision (`/hive decision` comment with the `` marker, park labels off, `triage/accepted`, queue approval on a PR head). Body `{"type": "issue"|"pr", "reason", "caption", "sentinel_reason"}`. `POST` answers 202 with the job (`{id, status: "running"|"done"|"failed", decision: {verdict, rule, text, rationale, actions, keeps_park, ladder?: {decision, reason, ruled_out[]}}, notes, error}`; `ladder` is set on contributor-PR decisions and names the rung that decided — `already-fixed` → `mergeable-as-is` → `rebase-then-merge` → `return-to-contributor` → `contributor-offline` — and why each rung above it did not apply); 409 with the running job while one is in flight; `GET` reads it. Rails: never merges, refuses items wearing `hold`, never grants secrets/permissions (`needs-owner` + `hold` instead), recommends only on hive policy/governance questions (keeps 085), and never decides a PR whose CI is running or whose review is incomplete on the current head — it answers `no-effect` (rule `mid-flight`, nothing written; fails closed, "review state not yet loaded", when the PR's review state cannot be read from the tracker; per PR in the `prs` fan-out, where the PR is skipped and counted as such), and the policy itself never releases (`default-release`, `small-low-risk`) a head whose checks are pending (rule `ci-pending`). Audited as `repo_item_decision_delegated[_failed]`. See [dashboard-sections.md](/docs/hive/dashboard-sections#let-hive-decide). | `pkg/dashboard/api.go:329`, `pkg/dashboard/api_repo_item_decide_delegated.go` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/decide-delegated/plan` | Same as `…/decide-delegated` | Preview for *Let hive decide*: runs the same owner-delegate policy with **no side effects** (nothing written, no job) and answers `{would, rule, acting, title, summary, why, consequences[], ladder, mergeable_as_is, alternatives[], writes: false, prior, notes}` — `summary` is one verb-first sentence with no "Hive would:" prefix (*Send #15332 back to its author with one instruction: make CI green, nothing else.*), `why` one short line (*CI is red.*), `consequences` at most two items, `ladder` the rung that decided with its `ruled_out` list, and `mergeable_as_is` whether an as-is merge is honest (the queue-merge and merge-now alternatives are dropped when it is not). The dialog shows **Cancel** / **Let hive do that**, plus **Approve and let hive merge** (or **Merge now as maintainer** when the hive would approve anyway) only when `mergeable_as_is`; only then does the SPA post `…/decide-delegated` with `chosen` naming the button. A transient GitHub failure (5xx, rate limit, timeout) is retried twice with backoff before the plan gives up. A failure answers `{ok: false, error, reason, retryable, attempts, elapsed_ms, hive, hint}` under **409** when the item is no longer open (`reason: not-open`) or **424** when a read it depends on failed (`github`), is not configured (`config`) or the plan itself failed (`plan`) — never 502/503, which the hosted Ingress intercepts and replaces with its generic *hive unavailable* page (hivecommons/hive#16776). See [dashboard-sections.md](/docs/hive/dashboard-sections#let-hive-decide). | `pkg/dashboard/api.go:353`, `pkg/dashboard/api_repo_item_decide_delegated_plan.go` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/recheck` | Same as `…/hold` (owner or repo write), signed-in GitHub user | *Re-check permissions* on an issue parked on a capability blocker (#15099): probes the GitHub App installation's permissions; when the missing permission is granted, clears every ledger entry blocked on it and un-parks the item (`{result: {outcome: "released", …}}`), otherwise `{result: {outcome: "no-effect", reason: "blocker", options: [...]}}`; 404 when the item has no blocker, 409 when the blocker is not a capability gap | `pkg/dashboard/api.go:354` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/close-partial` | Same as `…/hold` (owner or repo write), signed-in GitHub user | Option (c) on a capability blocker (#15099): labels the issue `hive/partially-addressed`, posts the operator's `{"comment"}` naming what remains and closes it; the ledger entry is cleared | `pkg/dashboard/api.go:355` | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/accept-triage` | Owner or repo write/maintain/admin | Accept triage on an issue from the activity monitor's row menu — what a maintainer accepting triage on GitHub does by hand: adds the reporter-trust triage label (`triage/accepted`, or the first of `issue_filter.reporter_trust.untrusted_require_labels`; the label is created in the repo if missing) and removes the awaiting label (`needs-triage` / `reporter_trust.awaiting_label`) and a Hive-written `stage/015-triage-needed`. Empty body. Returns `{ok, repo, number, acceptLabel, added, removed, alreadyAccepted, minStatusSeq}`; an issue already carrying the accept label with nothing left to remove is a no-op (`alreadyAccepted: true`, no write, no audit). 404 for a pull request or an unknown item. The status snapshot's labels are patched so the next reconcile reads 010 Actionable before the engine's own 015 → 010 derivation. Every write is audited as `repo_item_accept_triage` under the dashboard user and recorded on the issue in the `` comment naming that user and the labels changed (same rules as `…/hold`). A PR `approve` / `queue-merge` decision that lifts `needs-human` or the sentinel label records it the same way under `kind=approval`. | `pkg/dashboard/api.go:575`, `pkg/dashboard/api_repo_item_accept_triage.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/decide-delegated/plan` | Same as `…/decide-delegated` | Preview for *Let hive decide*: runs the same owner-delegate policy with **no side effects** (nothing written, no job) and answers `{would, rule, acting, title, summary, why, consequences[], ladder, mergeable_as_is, alternatives[], writes: false, prior, notes}` — `summary` is one verb-first sentence with no "Hive would:" prefix (*Send #15332 back to its author with one instruction: make CI green, nothing else.*), `why` one short line (*CI is red.*), `consequences` at most two items, `ladder` the rung that decided with its `ruled_out` list, and `mergeable_as_is` whether an as-is merge is honest (the queue-merge and merge-now alternatives are dropped when it is not). The dialog shows **Cancel** / **Let hive do that**, plus **Approve and let hive merge** (or **Merge now as maintainer** when the hive would approve anyway) only when `mergeable_as_is`; only then does the SPA post `…/decide-delegated` with `chosen` naming the button. A transient GitHub failure (5xx, rate limit, timeout) is retried twice with backoff before the plan gives up. A failure answers `{ok: false, error, reason, retryable, attempts, elapsed_ms, hive, hint}` under **409** when the item is no longer open (`reason: not-open`) or **424** when a read it depends on failed (`github`), is not configured (`config`) or the plan itself failed (`plan`) — never 502/503, which the hosted Ingress intercepts and replaces with its generic *hive unavailable* page (hivecommons/hive#16776). See [dashboard-sections.md](/docs/hive/dashboard-sections#let-hive-decide). | `pkg/dashboard/api.go:356`, `pkg/dashboard/api_repo_item_decide_delegated_plan.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/recheck` | Same as `…/hold` (owner or repo write), signed-in GitHub user | *Re-check permissions* on an issue parked on a capability blocker (#15099): probes the GitHub App installation's permissions; when the missing permission is granted, clears every ledger entry blocked on it and un-parks the item (`{result: {outcome: "released", …}}`), otherwise `{result: {outcome: "no-effect", reason: "blocker", options: [...]}}`; 404 when the item has no blocker, 409 when the blocker is not a capability gap | `pkg/dashboard/api.go:357` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/blocker/close-partial` | Same as `…/hold` (owner or repo write), signed-in GitHub user | Option (c) on a capability blocker (#15099): labels the issue `hive/partially-addressed`, posts the operator's `{"comment"}` naming what remains and closes it; the ledger entry is cleared | `pkg/dashboard/api.go:358` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/accept-triage` | Owner or repo write/maintain/admin | Accept triage on an issue from the activity monitor's row menu — what a maintainer accepting triage on GitHub does by hand: adds the reporter-trust triage label (`triage/accepted`, or the first of `issue_filter.reporter_trust.untrusted_require_labels`; the label is created in the repo if missing) and removes the awaiting label (`needs-triage` / `reporter_trust.awaiting_label`) and a Hive-written `stage/015-triage-needed`. Empty body. Returns `{ok, repo, number, acceptLabel, added, removed, alreadyAccepted, minStatusSeq}`; an issue already carrying the accept label with nothing left to remove is a no-op (`alreadyAccepted: true`, no write, no audit). 404 for a pull request or an unknown item. The status snapshot's labels are patched so the next reconcile reads 010 Actionable before the engine's own 015 → 010 derivation. Every write is audited as `repo_item_accept_triage` under the dashboard user and recorded on the issue in the `` comment naming that user and the labels changed (same rules as `…/hold`). A PR `approve` / `queue-merge` decision that lifts `needs-human` or the sentinel label records it the same way under `kind=approval`. | `pkg/dashboard/api.go:578`, `pkg/dashboard/api_repo_item_accept_triage.go` | | `POST` | `/api/repos/{owner}/{repo}/items/{number}/sha-waiver` | Owner or repo write/maintain/admin | Waive or restore the SHA-hold requirement on an issue from the activity monitor's row menu. Body `{"waived": true\|false}`. Waiving adds the persistent `sha-waived` label (created if missing), removes `needs-sha` at once and posts one App-authored comment with a `` marker; restoring removes `sha-waived`. A repeat is a no-op; pull requests are 404. Returns `{ok, repo, number, waived, added, removed, minStatusSeq, result}`. Audited as `repo_item_sha_waiver`. | -| `POST` | `/api/repos/{owner}/{repo}/items/{number}/sentinel-confirm` | Owner or repo write/maintain/admin | **Confirm safe** on the activity monitor's human-gate pill ([#17470](https://github.com/hivecommons/hive/issues/17470)): a person confirms a sentinel finding is intended. Body `{comment?, type?}` (`type` is `pr` or `issue`, comment ≤ 4000 characters). Posts the confirmation as a comment first — ``, `@user confirmed the sentinel finding safe from the dashboard.`, then the comment text — and removes every label matching the configured sentinel label (`sentinel.label`, default `sentinel-alert`, case-insensitive). Returns `{ok, repo, number, label, removed, alreadyClear, result}`; with no sentinel label on the item the comment is still posted and `alreadyClear` is true. 403 for a repository the hive does not watch. Audited as `repo_item_sentinel_confirm` under the dashboard user; the operator-action ledger records it as `confirm-sentinel`. | `pkg/dashboard/api.go:345`, `pkg/dashboard/api_repo_item_sentinel_confirm.go` | -| `GET` | `/api/acmm/evaluation` | Dashboard auth/session | ACMMEvaluation — combined codebase + operational result, cached server-side for 1 hour (`acmmEvalTTL`). `?refresh=1` (the dashboard's "🔄 Re-evaluate" button, #5877) bypasses the hourly TTL but is debounced server-side: requests within 1 minute of the last evaluation (`acmmRefreshDebounce`) still serve the cache, since a full refresh costs up to ~29 GitHub GetContents calls per repo. The response's `last_evaluated_at` timestamp reports when the cached evaluation was computed | `pkg/dashboard/api.go:357`, `pkg/dashboard/api_acmm_eval.go` | -| `POST` | `/api/acmm/issue` | Owner only | ACMMCreate Issue — files on GitHub or, with `governor.acmm.issue_tracker: work_source` / body `tracker: "work_source"` on a Linear-sourced hive, on Linear; response `tracker` says which. See [ACMM policy matrix](/docs/hive/acmm-policy-matrix#where-acmm-gap-issues-are-filed) | `pkg/dashboard/api.go:358` | -| `GET` | `/api/acmm-recommendation` | Dashboard auth/session | Advisory level-up recommendation (`acmmadvisor.Recommendation`, JSON): never changes the applied level — see [ACMM advisor](https://github.com/hivecommons/hive/blob/v5/src/docs/acmm-advisor.md) | `pkg/dashboard/api.go:359` | -| `GET` | `/api/hive-advice` | Dashboard auth/session | Weekly owner advice (`hiveadvisor.Result`, JSON) shared with the advisory digest: recommendations with `items`, `links` (Overview export paths) and `bands`; `bands[]` rule text; `counts` naming the governor actionable queue vs. the Overview total. Which recommendations show is frozen for 7 days; their numbers refresh every call — see [Owner advice](/docs/hive/operations/automation-and-review/advisory-digest#owner-advice) | `pkg/dashboard/api.go:361`, `pkg/dashboard/api_hive_advice.go` | +| `POST` | `/api/repos/{owner}/{repo}/items/{number}/sentinel-confirm` | Owner or repo write/maintain/admin | **Confirm safe** on the activity monitor's human-gate pill ([#17470](https://github.com/hivecommons/hive/issues/17470)): a person confirms a sentinel finding is intended. Body `{comment?, type?}` (`type` is `pr` or `issue`, comment ≤ 4000 characters). Posts the confirmation as a comment first — ``, `@user confirmed the sentinel finding safe from the dashboard.`, then the comment text — and removes every label matching the configured sentinel label (`sentinel.label`, default `sentinel-alert`, case-insensitive). Returns `{ok, repo, number, label, removed, alreadyClear, result}`; with no sentinel label on the item the comment is still posted and `alreadyClear` is true. 403 for a repository the hive does not watch. Audited as `repo_item_sentinel_confirm` under the dashboard user; the operator-action ledger records it as `confirm-sentinel`. | `pkg/dashboard/api.go:348`, `pkg/dashboard/api_repo_item_sentinel_confirm.go` | +| `GET` | `/api/acmm/evaluation` | Dashboard auth/session | ACMMEvaluation — combined codebase + operational result, cached server-side for 1 hour (`acmmEvalTTL`). `?refresh=1` (the dashboard's "🔄 Re-evaluate" button, #5877) bypasses the hourly TTL but is debounced server-side: requests within 1 minute of the last evaluation (`acmmRefreshDebounce`) still serve the cache, since a full refresh costs up to ~29 GitHub GetContents calls per repo. The response's `last_evaluated_at` timestamp reports when the cached evaluation was computed | `pkg/dashboard/api.go:360`, `pkg/dashboard/api_acmm_eval.go` | +| `POST` | `/api/acmm/issue` | Owner only | ACMMCreate Issue — files on GitHub or, with `governor.acmm.issue_tracker: work_source` / body `tracker: "work_source"` on a Linear-sourced hive, on Linear; response `tracker` says which. See [ACMM policy matrix](/docs/hive/acmm-policy-matrix#where-acmm-gap-issues-are-filed) | `pkg/dashboard/api.go:361` | +| `GET` | `/api/acmm-recommendation` | Dashboard auth/session | Advisory level-up recommendation (`acmmadvisor.Recommendation`, JSON): never changes the applied level — see [ACMM advisor](https://github.com/hivecommons/hive/blob/v5/src/docs/acmm-advisor.md) | `pkg/dashboard/api.go:362` | +| `GET` | `/api/hive-advice` | Dashboard auth/session | Weekly owner advice (`hiveadvisor.Result`, JSON) shared with the advisory digest: recommendations with `items`, `links` (Overview export paths) and `bands`; `bands[]` rule text; `counts` naming the governor actionable queue vs. the Overview total. Which recommendations show is frozen for 7 days; their numbers refresh every call — see [Owner advice](/docs/hive/operations/automation-and-review/advisory-digest#owner-advice) | `pkg/dashboard/api.go:364`, `pkg/dashboard/api_hive_advice.go` | diff --git a/docs/content/hive/api-reference/snapshots-and-style.md b/docs/content/hive/api-reference/snapshots-and-style.md index 19879925..77b18491 100644 --- a/docs/content/hive/api-reference/snapshots-and-style.md +++ b/docs/content/hive/api-reference/snapshots-and-style.md @@ -8,7 +8,7 @@ Part of the [Dashboard REST API reference](https://github.com/hivecommons/hive/b | Method | Path | Auth | Purpose | Source | |---|---|---|---|---| | `GET` | `/api/style` | Public | Sanitized custom dashboard CSS | `pkg/dashboard/api.go:50` | -| `GET` | `/branding/custom.css` | Dashboard auth/session | Operator branding stylesheet override, read per request (see [branding](https://github.com/hivecommons/hive/blob/v5/src/docs/branding.md)) | `pkg/dashboard/server.go:1931` | -| `GET` | `/api/snapshot/frame-ancestors` | Public | Snapshot framing allowlist | `pkg/dashboard/api.go:93` | -| `GET` | `/api/snapshot` | Public | Snapshot data | `pkg/dashboard/api.go:94` | -| `GET` | `/snapshot` | Public | Public read-only snapshot page | `pkg/dashboard/api.go:95` | +| `GET` | `/branding/custom.css` | Dashboard auth/session | Operator branding stylesheet override, read per request (see [branding](https://github.com/hivecommons/hive/blob/v5/src/docs/branding.md)) | `pkg/dashboard/server.go:1935` | +| `GET` | `/api/snapshot/frame-ancestors` | Public | Snapshot framing allowlist | `pkg/dashboard/api.go:94` | +| `GET` | `/api/snapshot` | Public | Snapshot data | `pkg/dashboard/api.go:95` | +| `GET` | `/snapshot` | Public | Public read-only snapshot page | `pkg/dashboard/api.go:96` | diff --git a/docs/content/hive/cli-pins.md b/docs/content/hive/cli-pins.md index a49033bc..f88a0a9d 100644 --- a/docs/content/hive/cli-pins.md +++ b/docs/content/hive/cli-pins.md @@ -12,7 +12,7 @@ Every agent CLI hive drives is baked into the images at a fixed version: | pi | `PI_VERSION` (hub), `PI_CODING_AGENT_VERSION` (contributor) | npm `@earendil-works/pi-coding-agent` | npm | | Goose | `GOOSE_VERSION`, `GOOSE_SHA256_{AMD64,ARM64}` | GitHub releases `aaif-goose/goose` | SHA-256 per arch | | Antigravity (agy) | `AGY_VERSION` + `AGY_BUILD`, `AGY_SHA512_*` (hub); `AGY_VERSION=-`, `AGY_SHA256_*` (contributor) | Google's updater artifact, as tracked by the Homebrew `antigravity-cli` cask | SHA-512 (hub) / SHA-256 (contributor) per arch | -| spektacular | `SPEKTACULAR_VERSION`, `SPEKTACULAR_SHA256_{AMD64,ARM64}` | GitHub releases `hivecommons/spektacular` | SHA-256 per arch, from the release `checksums.txt` (manual bump for now; not yet in `cli-pin-bump.sh`) | +| spektacular | `SPEKTACULAR_VERSION` = `0.35.0`, `SPEKTACULAR_SHA256_{AMD64,ARM64}`; must equal `spektacular.PinnedVersion` | GitHub releases `hivecommons/spektacular` | SHA-256 per arch, from the release `checksums.txt` (manual bump for now; not yet in `cli-pin-bump.sh`). See [the spektacular pin](#the-spektacular-pin) | | quorum (meetings bundle, not a CLI backend) | `QUORUM_VERSION`, `QUORUM_SHA256`, `QUORUM_DAVEY_VERSION` | GitHub releases `hivecommons/quorum` (`quorum.mjs` asset); `@snazzah/davey` at the version quorum's `package-lock.json` pins | SHA-256 of the single arch-independent bundle from the release `quorum.mjs.sha256`; davey through npm (manual bump) | | Oh My Pi (omp) | `OMP_VERSION`, `OMP_SHA256_*` | GitHub releases `can1357/oh-my-pi` | SHA-256 per arch, cross-checked with `SHA256SUMS.txt` | | Muse Code | `MUSE_VERSION`, `MUSE_SHA256_*` | `api.meta.ai/muse-code/channels/muse-stable` and its release manifest | SHA-256 per arch, cross-checked with the manifest | @@ -26,6 +26,31 @@ codex pins differ. Pinning is deliberate ([#2903](https://github.com/hivecommons a floating `@latest` makes builds non-reproducible, and the per-arch digest makes a tampered download fail the build instead of running. +## The spektacular pin + +Each image installs spektacular exactly once, at one version that serves both +of Hive's callers ([#20838](https://github.com/hivecommons/hive/issues/20838); +the images used to install two versions to the same path, so neither image +served both): + +- **Runs** (`src/pkg/spektacular`) read `spektacular status --format json` + and, for a plan without task structure, `spektacular plan file read plan`. + The per-kind `spec status` / `plan status`, `plan export` and the joined + `/plan.md` address were removed upstream in 0.25.0. +- **Inbox -> RFC** (`src/pkg/inbox/spek.go`) drives `init`, `spec new`, + `spec goto` and the agent's `spek-new` skill, then `publish`, which arrived + in 0.30.0. + +`0.35.0` is the newest release and serves both. To bump it, change +`SPEKTACULAR_VERSION` and both digests in `src/Dockerfile` and +`src/Dockerfile.contributor`, `PinnedVersion` in +`src/pkg/spektacular/runner.go` and the table row above in one PR, re-record +`src/pkg/spektacular/testdata/status-0.35.0` if the status report changed, +and read the release notes for changes to the commands listed here. +`pkg/spektacular/pin_test.go` fails when a Dockerfile declares the version +more than once, downloads the release more than once, or disagrees with +`PinnedVersion` or this page. + ## Why a bump workflow Nothing else moves these pins. `.github/dependabot.yml` covers Go modules, diff --git a/docs/content/hive/contributor-relay.md b/docs/content/hive/contributor-relay.md index 95024e0b..1b6f8afc 100644 --- a/docs/content/hive/contributor-relay.md +++ b/docs/content/hive/contributor-relay.md @@ -2,15 +2,26 @@ # ClankeR contributor relay -ClankeR lets you lend your AI coding tool to a hive. A **CLI** is a command-line program; its **backend** is the tool selected for the relay to drive. A **hive** assigns tasks from a project's work queue. The **relay** runs on your machine, receives a task, drives your chosen tool/model, and reports the result, including any **PR** (pull request), over a WebSocket connection. Your **registration token** identifies you to that hive; it is separate from your coding-provider login and the task's GitHub credential. +ClankeR lets you lend your AI coding tool to a hive. A **CLI** is a command-line program; its **backend** is the tool selected for the relay to drive. A **hive** assigns tasks from a project's work queue. The **relay** runs on your machine, receives a task, drives your chosen tool/model, and reports the result, including any **PR** (pull request), over a WebSocket connection. Your **registration token** identifies you to that hive; it is separate from your coding-provider login and the task's forge credential. For labels that make work eligible or ineligible for contributors, see [Hive Labels and Control Signals](/docs/hive/labels-and-control-signals). For help getting to your first PR, [Join our Discord](https://hivecommons.dev/discord). -The hive operator chooses eligible repositories, labels, and models. You choose the coding tool, model, and machine. Your provider credentials stay local; Hive supplies short-lived GitHub access for each assigned task. +The hive operator chooses eligible repositories, labels, and models. You choose the coding tool, model, and machine. Your provider credentials stay local; Hive supplies short-lived forge access for each assigned task. -Contributor assignments currently support GitHub repositories only: task credentials are minted by a GitHub App. GitLab, Gitea, and Forgejo repositories are excluded from the repository catalog and issue selection, including on mixed-forge hives. A hive with only those repositories therefore has no contributor work to offer. +Contributor assignments support GitHub and Forgejo repositories. GitHub tasks use a GitHub App; Forgejo tasks require an HTTPS forge and an operator-configured integration scoped to the individual repository, acting as a dedicated Forgejo user (`contributor_login`) that is never the hive's own user. Before a Forgejo credential is handed out, the hub checks that it does not act as the hive and cannot write to the hive's other repositories; a credential that fails either check is never sent. A Forgejo task's PR must come from the branch `hive-task/`, which the relay names in the prompt, because every contributor on that repository shares the one Forgejo user. See [Forgejo contributor task credentials](https://github.com/hivecommons/hive/blob/v5/src/docs/forge-app-setup.md#contributor-task-credentials). GitLab and Gitea repositories remain excluded from the catalog and issue selection. -When actionable issues are skipped for this reason, `task_unavailable.filtered` includes `unsupported_forge` with the number skipped. An unrestricted relay receives `no_matching_work`; a relay with a selected repository scope receives `no_selected_work` and only counts matching repositories, including their configured forge and host. Forgejo repositories also match existing `gitea` scope IDs on the same host. The ready queue excludes unsupported repositories and identifies them as `unsupported_forge` in withheld diagnostics. +When actionable issues on unsupported forges are skipped, `task_unavailable.filtered` includes `unsupported_forge` with the number skipped. An unrestricted relay receives `no_matching_work`; a relay with a selected repository scope receives `no_selected_work` and only counts matching repositories. Forgejo repositories also match existing `gitea` scope IDs on the same host. The ready queue identifies unsupported repositories as `unsupported_forge` in withheld diagnostics. + +Forgejo repositories without a valid per-repository audience or HTTPS forge +configuration are omitted from the catalog and withheld as +`missing_forgejo_credential`. Relays must advertise `forgejo_contributor_v1`; +otherwise selection reports `forgejo_capability_required`. Only contributor, +trusted and merger tiers can receive Forgejo task credentials; other tiers are +filtered as `forgejo_tier_ineligible`. External execution is not supported for +Forgejo tasks (`forgejo_external_execution_unsupported`). +Forgejo assignments also require the claims ledger and its live admission +checks to be enabled. If admission cannot be verified, the task is not +assigned and no task credential is delivered. ## Pick your route @@ -196,7 +207,7 @@ With an explicitly configured shared pool, `just contribute-quota status` inspec ## What happens on a task 1. A successful connection logs `Connected to …`, followed by `Authenticated with … as … (tier: …)`, plus `[hive: ]` when the hive states its display name on `auth_ok` (`hive_name`; the relay shows it lowercased with dashes, so "hivecommons hive" reads `hivecommons-hive`). A hub that sends no name leaves the relay on the short name derived from the hostname. Authentication is not yet a task assignment. -2. The hive assigns an issue that fits your trust tier and its filters. When it assigns you nothing, the relay prints one plain sentence instead of a raw reason code. The hive's `no_matching_work` reason covers both an empty queue and a queue whose every issue was dropped for you by a filter the hive does not name on the wire (cooldown, a disabled or denied repository, an open or recently merged PR already claiming the issue, your own work, your CLI, trust tier or quota), so the relay never claims the queue is empty from it. It says `No work was assigned to you on right now. The hive may have nothing queued, or nothing that matches your setup (CLI, trust tier, repo, quota).`, then asks the hive's public `/api/contribute/status` for `actionable_items` and follows up once with either ` has N actionable items, but none was assigned to you` or ` reports 0 actionable items, so nothing is queued there right now`. `The queue for is empty` is printed only when the hive explicitly answers `queue_empty` (sent when no actionable item was seen at all, [#19052](https://github.com/hivecommons/hive/issues/19052)). A `no_matching_work` answer may also carry an optional `filtered` object mapping each filter that dropped candidates (`disabled_repo`, `unsupported_forge`, `operator_hold`, `cooldown`, `no_work_verdict`, `failure_cooldown`, `reclaim_cooldown`, `in_flight`, `claimed_by_pr`, `excluded`, `role_mismatch`, `denied_by_filter`, `assigned_to_others`) to a count; relays that do not know a key may print it as is. A `no_selected_work` answer may also carry `filtered.unsupported_forge` when selected repositories use unsupported forges. The relay stays connected, says each state once, repeats only a short `Still no work assigned` line every ten minutes, backs off from checking every 30 seconds to every 5 minutes while the answer stays the same (with more than one hive the 30 second poll rotation is kept), and prints `Work available on , claiming #` when work appears. Refusals that do name their filter are worded differently: `capability_mismatch` (`filter: capability`), `no_selected_work` (`filter: repo`), `tier_disabled` (`filter: level`) and `hourly_limit` / `daily_limit` / `concurrency_limit` (`filter: quota`). With several hives on one relay every line names its hive by a short public name (the name the hive states on `auth_ok`, or else the hostname with `hosted-` and the 4-character suffix stripped, for example `hosted--ab12.` shows as ``), and when every enabled hive is idle one line says so (`All 3 queues are empty, nothing to do right now.` only when each is confirmed empty, otherwise `No work was assigned to you on any of the 3 hives right now`). The state is also written to the relay status file as `queue_state` (`no-match`, `queue-empty`, `filtered:`, `working`, `waiting-on-cli`), per hive as `queue_state` and `actionable_items` on each `subscriptions` entry, and shown when you attach as one compact tmux status row, for example `alpha: idle: no match | beta: empty | gamma: working #123`. The per-retry `Requesting work ...` and `Cancelled ready retry ...` bookkeeping lines are internal and only printed with `HIVE_RELAY_DEBUG=1`. Other reasons may require the hive operator, not another registration. +2. The hive assigns an issue that fits your trust tier and its filters. When it assigns you nothing, the relay prints one plain sentence instead of a raw reason code. The hive's `no_matching_work` reason covers both an empty queue and a queue whose every issue was dropped for you by a filter the hive does not name on the wire (cooldown, a disabled or denied repository, an open or recently merged PR already claiming the issue, your own work, your CLI, trust tier or quota), so the relay never claims the queue is empty from it. It says `No work was assigned to you on right now. The hive may have nothing queued, or nothing that matches your setup (CLI, trust tier, repo, quota).`, then asks the hive's public `/api/contribute/status` for `actionable_items` and follows up once with either ` has N actionable items, but none was assigned to you` or ` reports 0 actionable items, so nothing is queued there right now`. `The queue for is empty` is printed only when the hive explicitly answers `queue_empty` (sent when no actionable item was seen at all, [#19052](https://github.com/hivecommons/hive/issues/19052)). A `no_matching_work` answer may also carry an optional `filtered` object mapping each filter that dropped candidates (`disabled_repo`, `unsupported_forge`, `missing_forgejo_credential`, `forgejo_capability_required`, `forgejo_tier_ineligible`, `forgejo_external_execution_unsupported`, `operator_hold`, `cooldown`, `no_work_verdict`, `failure_cooldown`, `reclaim_cooldown`, `in_flight`, `claimed_by_pr`, `excluded`, `role_mismatch`, `denied_by_filter`, `assigned_to_others`) to a count; relays that do not know a key may print it as is. A `no_selected_work` answer may also carry `filtered.unsupported_forge`, or one of the Forgejo keys above, when selected repositories cannot be served for that reason. The relay stays connected, says each state once, repeats only a short `Still no work assigned` line every ten minutes, backs off from checking every 30 seconds to every 5 minutes while the answer stays the same (with more than one hive the 30 second poll rotation is kept), and prints `Work available on , claiming #` when work appears. Refusals that do name their filter are worded differently: `capability_mismatch` (`filter: capability`), `no_selected_work` (`filter: repo`), `tier_disabled` (`filter: level`) and `hourly_limit` / `daily_limit` / `concurrency_limit` (`filter: quota`). With several hives on one relay every line names its hive by a short public name (the name the hive states on `auth_ok`, or else the hostname with `hosted-` and the 4-character suffix stripped, for example `hosted--ab12.` shows as ``), and when every enabled hive is idle one line says so (`All 3 queues are empty, nothing to do right now.` only when each is confirmed empty, otherwise `No work was assigned to you on any of the 3 hives right now`). The state is also written to the relay status file as `queue_state` (`no-match`, `queue-empty`, `filtered:`, `working`, `waiting-on-cli`), per hive as `queue_state` and `actionable_items` on each `subscriptions` entry, and shown when you attach as one compact tmux status row, for example `alpha: idle: no match | beta: empty | gamma: working #123`. The per-retry `Requesting work ...` and `Cancelled ready retry ...` bookkeeping lines are internal and only printed with `HIVE_RELAY_DEBUG=1`. Other reasons may require the hive operator, not another registration. 3. The relay prepares the checkout, injects a short-lived GitHub token, and drives your coding CLI. In interactive mode, use the **attach command printed by your launch** to watch the tmux session. Container mode prints the Docker/Podman form; native mode prints `tmux attach`. Headless backends have no interactive pane. 4. Progress is reported every 2 minutes; completion/PR metadata is reported when the CLI finishes. Check the linked PR and its checks, not just a local “success” line. PRs retain the task's base branch, required hold gates, and DCO sign-off (`git commit -s`). 5. To stop your foreground relay, press **Ctrl-C** in the terminal running it; detaching from tmux is not stopping the relay. The relay cleans up its connection. If work is in flight, it is not thereby completed: inspect the PR/worktree and the hive's recorded task state before deleting local work or starting another relay. @@ -999,7 +1010,8 @@ Withheld rows carry a stable reason code and, where the refusing gate had one, t | `dependency_blocked` | A declared dependency is established as unsatisfied. | Blocker keys, observed record/generation | | `dependency_unknown` | A declared dependency could not be resolved, so satisfaction cannot be asserted. | Blocker keys, observed record/generation | | `disabled_repo` | The repository is switched off for contribution (`disabled_repos`). | — | -| `unsupported_forge` | The repository is not on GitHub; contributor credentials require a GitHub App. | — | +| `unsupported_forge` | The repository is on an unsupported forge, such as GitLab or Gitea. | — | +| `missing_forgejo_credential` | The Forgejo repository lacks a valid per-repository integration audience or HTTPS forge configuration. | — | | `tracker` | A tracker/umbrella issue; its children carry the work and queue independently. Recognised by an `epic`/`tracker`/`tracking`/`meta-tracker` label (including prefixed spellings such as `kind/epic`), an `[Epic]`/`[Tracker]` title prefix, or a body listing three or more child issues. | — | | `umbrella` | An umbrella, epic, tracker or decomposed parent under the `hub.contribute_umbrella` rules: a label (default `umbrella`, `tracker`, `epic`, `meta-tracker`), the `` body marker, a title prefix (default `[Tracking]`, `[Epic]`, `[Umbrella]`, `[Tracker]`), a task list of two or more issue or PR references, or sub-issues. It stays actionable for the owner and the hive and is never offered to a contributor ([#19078](https://github.com/hivecommons/hive/issues/19078)). | Matched rule | | `human_only` | The issue waits on a person: label `needs-human`, `human-only` or `human-only:*`, or the `` body marker. Never offered to a contributor. | Matched rule | @@ -1265,18 +1277,18 @@ The notes below record the evolution of claim scanning, verified verdicts, prose A contributor can narrow which of a hive's repositories it is offered work from ([#12805](https://github.com/hivecommons/hive/issues/12805), part of RFC [#12570](https://github.com/hivecommons/hive/issues/12570) §4). The scope can only **narrow**: disabled repos, holds, cooldowns, claims, trust tiers, model filters, quotas and task-token scoping all still run unchanged, so eligible work is the intersection of operator admission and the contributor's scope. -- **Discovery.** `GET /api/contribute/repositories` (public, unauthenticated, like `/api/contribute/status`) lists the contribution-eligible repositories — the hive's monitored GitHub repos minus `hub.disabled_repos`, with the same matching rule selection uses. Non-GitHub repositories are excluded: +- **Discovery.** `GET /api/contribute/repositories` (public, unauthenticated, like `/api/contribute/status`) lists the contribution-eligible repositories — the hive's monitored GitHub repos, and Forgejo repos with a per-repository contributor audience and an HTTPS `forge_url`, minus `hub.disabled_repos`, with the same matching rule selection uses. GitLab and Gitea repositories, and Forgejo repositories without that credential, are excluded: ```json {"repositories":[{"id":"github/github.com/org/name","forge":"github","host":"github.com","full_name":"org/name"}],"generated_at":"2026-10-17T19:00:00Z"} ``` - `id` is the canonical, lower-cased `{forge}/{host}/{owner}/{name}`. The forge is `github`; the host is the hive's configured forge host (`github.com` by default). + `id` is the canonical, lower-cased `{forge}/{host}/{owner}/{name}`. For a GitHub repository the forge is `github` and the host is the hive's configured GitHub host (`github.com` by default); for a Forgejo repository the forge is `forgejo` and the host is that repository's `forge_url` host (for example `forgejo/code.example/org/name`). - **Scope.** After `auth_ok`, the relay sends `{"type":"repo_scope","scope_version":N,"mode":"selected","repositories":["github/github.com/org/a", …]}`. `scope_version` is a positive integer the relay increments on every change. `mode:"all"` — or never sending `repo_scope` — keeps today's unrestricted behaviour. - **Acknowledgement.** The hub answers `{"type":"repo_scope_ack","scope_version":N,"accepted":true,"mode":"selected","unknown":[…]}`. `unknown` lists well-formed ids this hive does not offer; they are kept but never match. A malformed scope (non-positive version, unknown mode, more than 1000 ids, or an id that is not four non-empty `/`-separated segments) is answered with `accepted:false` and a `reason` (`invalid_scope_version`, `invalid_mode`, `too_many_repositories`, `invalid_repository_id`). The hub then **fails closed**: the connection is served nothing — `task_unavailable` with reason `repo_scope_invalid` — until a valid scope is acknowledged. - **Version fencing.** `ready` may carry `scope_version`. The hub selects only when it equals the acknowledged version; otherwise it answers `task_unavailable` with reason `no_selected_work` and the relay waits for its `repo_scope_ack`. This closes the race where a relay reloads its scope while a `ready` is in flight. - **Filtering.** Repositories outside an acknowledged `selected` scope are skipped while candidates are collected — before any lease is taken or task token minted — so an out-of-scope item is never leased for this connection and stays available to other contributors. A restricted contributor is therefore served its selected lower-priority work instead of being offered the hive's top out-of-scope item. When nothing admissible remains inside the scope, the reason is `no_selected_work` rather than `no_matching_work`. Queued fix-pr tasks for the contributor's own red PRs are not scope-filtered. The hub owns offering fix-pr for the contributor's own PRs regardless of scope; the relay owns applying the contributor's current selection, and declines an out-of-scope fix-pr with `out_of_contributor_scope`, which the hub treats like any other scope decline. -- **Assignment identity.** Every `task_assign` (issue and fix-pr) carries `forge` and `host` beside `repo`, taken from the same source as the advertised ids (`github` and the hive's configured GitHub host), so a relay can build the full `forge/host/owner/name` id without inferring it from the URL. Both are optional and omitted by older hubs. +- **Assignment identity.** Every `task_assign` (issue and fix-pr) carries `forge` and `host` beside `repo`, taken from the same source as the advertised ids (`github` with the hive's configured GitHub host, or `forgejo` with the repository's `forge_url` host), so a relay can build the full `forge/host/owner/name` id without inferring it from the URL. Forgejo assignments also carry `forge_url` (the HTTPS forge root) and `forge_login` (the `contributor_login` user the task credential acts as; the relay credits a PR to the task only when that user opened it from `hive-task/`). All are optional and omitted by older hubs. - **Decline.** If an out-of-scope offer still arrives (for example a scope change racing an assignment), the relay sends `task_declined` with `reason: "out_of_contributor_scope"` before the credential is delivered. The hub revokes the lease, clears the release cooldown and hands back the hourly/daily rate-window slot, so the decline books no failure, streak or cooldown and consumes no allowance. Like the quota-preflight decline, it is honoured only while the credential is still withheld, i.e. when the relay also advertises `quota_preflight_v1` or the hive requires explicit acceptance. ### Protocol compatibility @@ -1982,6 +1994,11 @@ itself — under the default auto-accept this is immediate, and under the opt-in explicit-acceptance mode it waits for the human. The relay's handler writes it to a single `0600` file (`GH_TOKEN_CACHE`, overridable with `HIVE_GH_TOKEN_CACHE`); that file is the only place the token lives. +A Forgejo task credential is kept apart from GitHub tooling, in +`.forgejo` (also `0600`, replaced on refresh); the task +prompt refers to it as `${HIVE_FORGEJO_TOKEN_CACHE}`. It carries +`write:repository`, `read:issue` and `read:user` only, so the relay writes +no issue comment or label on a Forgejo task. **Refresh.** On every heartbeat the hub checks whether the active task's token was minted at least **50 minutes** ago (`wsTokenRefreshPeriod`) and, if so, diff --git a/docs/content/hive/customers-enrichment.md b/docs/content/hive/customers-enrichment.md index b1e2d31b..6df941ff 100644 --- a/docs/content/hive/customers-enrichment.md +++ b/docs/content/hive/customers-enrichment.md @@ -29,8 +29,11 @@ is stored or shown. | crowd.dev (LFX Insights) | Affiliation and activity from crowd.dev | The person's GitHub login, never an email, sent to the crowd.dev API with your token | `customers.enrichment.crowddev.enabled` | Rollout status: the gitdm and devstats sources are live. crowd.dev is not: -LFX Insights has no public API it can use today (hivecommons/colony#5), so its -switch and token field are accepted but make no request. +LFX Insights has no per-person API it can use today (hivecommons/colony#5, +linuxfoundation/insights#2573), so its switch and token field are accepted but +make no request. The hub has a separate, hub-only LFX Insights source that uses +the project and organization routes LFX Insights does offer; see +[LFX Insights on the hub](/docs/hive/dashboard/data-collection-and-telemetry#lfx-insights-on-the-hub). ## How gitdm works diff --git a/docs/content/hive/dashboard.md b/docs/content/hive/dashboard.md index ea0018a6..06395fd5 100644 --- a/docs/content/hive/dashboard.md +++ b/docs/content/hive/dashboard.md @@ -207,6 +207,57 @@ the header on every page, turn on **Also show the usage gauge in the header** needle shows the limit closest to empty across every provider, and clicking it opens the gauge on the Overview. +While the usage gauge is on, a small block of mini gauges is pinned at the top +right, just under the navbar, whenever the Overview's "Usage left" panel is +off screen: on another section, or once the panel is scrolled away. It has one +horseshoe per provider the hive is signed in with, showing that provider's +total (Claude's weekly limit, Copilot's premium requests); model-specific +limits such as "Weekly (Fable)" stay on the Overview only. Like the Overview +dials, the mini gauges show the share **remaining**: the coloured arc and the +number in the middle are the percentage remaining, amber at 25% remaining or +less and red at 10% or less. Hovering or focusing a gauge shows "Claude · 63% +remaining · resets …"; clicking it goes to the usage panel on the Overview. +The block hides again while that panel is on screen. It flies out of the big +gauges into the corner when they leave the screen and simply fades out on the +way back; with reduced motion turned on it just appears and disappears. It +uses the same readings as the Overview gauge and makes no requests of its own. + +### Signed-in accounts + +Viewers with write access or higher (the owner, read-write and merger) see +which accounts the hive's agents use: + +- Each **agent card** shows the GitHub account the agents act as (the App bot, + such as `hive-app[bot]`, or the account behind the hive's token) and the + account the agent is signed in with at the provider whose plan its backend + spends, each with its stable ID. +- For the owner, who is the only viewer of the usage gauges, each + **Overview** usage row also says "Signed in as" that provider's account, and + the **mini usage gauges** show it only in the hover tooltip, next to the + provider name and reset time, never on the gauge itself. + +Every provider hive measures is covered: + +- **Claude:** the account email Claude Code uses as its login and the account + UUID. They are read from each agent's own Claude Code record, then the + shared one. +- **Copilot:** the GitHub login and user ID behind the Copilot token. +- **Codex:** the ChatGPT account email and account ID. +- **Antigravity (`agy`):** the Google account and its Google ID from agy's own + sign-in. +- **Gemini CLI:** the active Google account and its Google ID. +- **Kiro, DeepSeek and any API-key sign-in:** "API key (no account login)", + because a key has no account login. + +Agents on a backend with no measured plan, such as a gateway (OpenRouter, +LiteLLM, vLLM) or a CLI hive does not measure, show only their GitHub account. + +Only a login and an ID are ever sent: never a token, key or other credential. +The check is made on the server: `GET /api/agents/identity` answers read-only +and anonymous viewers with an empty object, and the `accounts` field of the +usage readings is sent only with the owner-only `GET /api/providers/headroom`. +The identities are refreshed every five minutes. + ## Governor card The dashboard **Governor** card summarizes queue depth, operating mode, budget diff --git a/docs/content/hive/data-janitor.md b/docs/content/hive/data-janitor.md new file mode 100644 index 00000000..5e1e80e6 --- /dev/null +++ b/docs/content/hive/data-janitor.md @@ -0,0 +1,173 @@ +> **Synced from Hive.** This page is pulled from [hivecommons/hive@v5](https://github.com/hivecommons/hive/blob/v5/src/docs/data-janitor.md) during the docs build. Edit the canonical source in the Hive repository. + +# Data janitor + +Every hive keeps its state on one persistent volume mounted at `/data`. On +hosted hives that volume is a CephFS RWX PVC (50 GiB). Two costs grow with it: + +- **Bytes.** They fill the shared Ceph pool that other tenants also use. +- **File count.** CRI-O relabels the whole volume for SELinux before every new + pod starts. With many files, the relabel times out under load + (`context deadline exceeded ... stage container volume configuration`), and + the pod does not start. + +The data janitor (`src/pkg/datajanitor`, +[#20927](https://github.com/hivecommons/hive/issues/20927)) keeps `/data` +bounded without operator action. It is on by default. + +## What it removes + +Each run applies these rules. A rule only selects data the hive owns and can +regenerate. Its retention is measured from the newest write anywhere inside the +item, so an item still being written to is never selected. + +| Rule | Selects | Default retention | +|---|---|---| +| `worktrees` | Linked git worktrees under `/data/home/*` and `/data/agents/*/*` clones. A worktree qualifies only when its branch is merged into `origin/HEAD` or its upstream branch was deleted (`[gone]`), it has no uncommitted work (no modified tracked files and no new untracked files; ignored build output does not count), and it is not locked or detached. Metadata for worktrees whose directory is already gone is cleared with `git worktree prune`. | 7 days | +| `caches` | Individual files in `/data/home/.cache/go-build`, `/data/home/.cache/pip`, `/data/home/.npm/_cacache` and `/data/home/go/pkg/mod/cache/download`, plus `extra_cache_dirs`. | 14 days | +| `tmp` | Files in `/data/tmp` and `/data/home/tmp`, plus `extra_tmp_dirs`, and the empty directories they leave. | 3 days | +| `logs` | Rotated logs only (`*.log.N`, `*.gz`, or a date in the name) in `data.logs_dir` and `/data/agents/*/.bob/.bob-errors`. The file a process is writing to is never selected. The retention is never shorter than `governor.logging.max_age_days`. | 14 days | +| `transcripts` | CLI transcripts (`*.jsonl`) in `data.claude_sessions_dir`. The default matches the token scanners' 30-day window, so dashboard token history is not cut short. | 30 days | +| `orphan_agents` | Workspace directories under `/data/agents` of agents the operator removed: names in `removed_agents` (replicas such as `guide-2` count as `guide`) that are not configured again. An unrecognised name alone is never treated as an orphan. Interactive homes under `/data/home/agents`, which hold CLI credentials and memory, are never swept. | 14 days | + +The janitor also runs the older session-state and agent-home prunes +(`src/pkg/sessionprune`) on the same schedule. Before this change those prunes +ran once at startup only, because their loop stopped as soon as it was wired. +They run in dry-run mode too: they predate the janitor and are not part of its +dry-run contract. + +The hourly workspace sweep (`HIVE_WORKSPACE_CLEANUP_*`, `pkg/dashboard/workspace_cleanup.go`) +is separate and unchanged. It removes non-git scratch entries from agent +workspaces after 2 hours. + +## What it never removes + +Every selected path is checked against a protection list before removal. A path +is refused when it is, is inside, or contains any of these: + +- `hive.yaml`, `config.env`, `/data/.hive`, `/data/agent-configs` +- credentials: `/data/secrets`, `/data/vaults`, the GitHub App key and user + tokens, `/data/home/.claude/.credentials.json`, `/data/home/.claude.json`, + `/data/home/.config`, `/data/home/.codex`, `/data/home/.gemini`, + `/data/home/.ssh`, `/data/home/.gitconfig`, `/data/home/.git-credentials` +- beads (`/data/beads`), the knowledge store (`/data/knowledge`), policies, + skills, snapshots, contributors and hub (`/data/saas`) state +- anything in `extra_protected_paths` + +Live user-session worktrees under `/data/session-sandbox` are skipped. They have +their own sweeper that knows which sessions are alive. Shared crux state beside +the agent workspaces (`/data/agents/sandbox`, `sandbox-runs`, +`sandbox-review-spools`, `gates`, `runs`, `signals`, `checkouts`) is protected. + +Rules never follow symlinks. A rule root with a symlink anywhere below `/data` +is skipped. Only regular files and symlinks are selected, never sockets, FIFOs +or device files. + +The orphan rule has two extra safety checks: + +- It acts only on tombstoned agents (`removed_agents`). With none, it does + nothing. +- It skips a whole root when it would remove more than + `orphan_max_fraction_percent` of the agent directories there. A directory that +holds anything named like a credential (`auth.json`, `.credentials.json`, +`*.pem`, `*.key`) is never removed by the orphan rule. + +## Size guard + +Every `size_guard_check_minutes`, the janitor measures `/data`. On CephFS this +reads the `ceph.dir.rbytes` and `ceph.dir.rfiles` xattrs, which is two cheap +reads. Elsewhere it uses statfs (used blocks and inodes of the volume holding +`/data`). Only if statfs fails does it walk the tree, up to 2,000,000 entries. + +Capacity comes from `capacity_bytes` if that is set. Otherwise it is the +subvolume quota (`ceph.quota.max_bytes`), and failing that, statfs. + +When usage reaches `size_guard_percent` (80% by default), the guard: + +1. runs the janitor immediately, unless any run finished within `size_guard_cooldown_minutes`; +2. raises a yellow dashboard banner (`data-janitor-size-guard`) until usage + falls back under the threshold; +3. reports `guard_tripped` to the hub in the heartbeat, which raises a + `data-volume-full` warning in the hub's fleet alerts. + +## Where to see it + +`GET /api/status` has a `data_janitor` block: + +```json +"data_janitor": { + "enabled": true, + "dry_run": false, + "interval_seconds": 21600, + "usage": {"bytes": 7340032000, "files": 412000, "capacity_bytes": 53687091200, + "percent": 13.7, "source": "cephfs", "measured_at": "..."}, + "size_guard": {"threshold_percent": 80, "tripped": false}, + "last_run": {"trigger": "schedule", "freed_bytes": 1048576000, "freed_files": 52000, + "freed_dirs": 900, "failed": 0, "pruned_repos": 1, + "rules": {"caches": {"selected": 50000, "removed": 50000, "freed_bytes": 900000000, + "freed_files": 50000, "examples": ["..."]}}}, + "runs": 4, + "total_freed_bytes": 2147483648, + "total_freed_files": 104000 +} +``` + +Each run that frees something logs one `data janitor run complete` line with +the same totals. A refused candidate logs `data janitor: refused candidate` +with the reason. + +## Configuration + +All keys live under `data.janitor` in `hive.yaml`. Each one is optional, and a +retention of `0` turns that rule off. + +| Key | Default | Meaning | +|---|---|---| +| `enabled` | `true` | Run the janitor. Env `HIVE_DATA_JANITOR_ENABLED` overrides. | +| `dry_run` | `false` | Select and report without deleting. Env `HIVE_DATA_JANITOR_DRY_RUN` overrides. | +| `interval_minutes` | `360` | Time between scheduled runs. | +| `worktree_retention_days` | `7` | See `worktrees`. | +| `cache_retention_days` | `14` | See `caches`. | +| `tmp_retention_days` | `3` | See `tmp`. | +| `log_retention_days` | `14` | See `logs`. | +| `transcript_retention_days` | `30` | See `transcripts`. | +| `orphan_agent_retention_days` | `14` | See `orphan_agents`. | +| `orphan_max_fraction_percent` | `50` | Maximum share of one root's agent directories the orphan rule may remove in one run. | +| `size_guard_percent` | `80` | Fill level that triggers an immediate run and the warnings. `0` disables the guard. | +| `size_guard_check_minutes` | `15` | How often the guard measures `/data`. | +| `size_guard_cooldown_minutes` | `60` | Minimum time between guard-triggered runs. | +| `capacity_bytes` | `0` | Capacity override. `0` reads the CephFS quota, then statfs. | +| `extra_cache_dirs` | `[]` | Extra cache trees, trimmed file by file. | +| `extra_tmp_dirs` | `[]` | Extra scratch trees. | +| `extra_protected_paths` | `[]` | Extra paths that are never removed. | + +To try the janitor safely on a hive, set `HIVE_DATA_JANITOR_DRY_RUN=true`, wait +for a run (one runs at startup), and read `data_janitor.last_run` on +`/api/status`. + +## Hub: slots and deprovision + +The hub handles the volumes of pool slots and deleted hives +(`src/pkg/hub/storage_hygiene.go`): + +- **Deprovision frees the volume.** Before it deletes the namespace of a + dynamic-storage hive, the hub sets the bound PV's reclaim policy to `Delete` + (only when that PV's `claimRef` is this hive's `hive-data` claim) and + deletes the PVC. This also applies when an owner deletes their own hive. Without that step, a `Retain` storage class + would keep the CephFS subvolume, and its bytes, after the hive is gone. +- **Stale unclaimed slots are reported.** An unclaimed slot whose reported + `/data` (measured within `HIVE_HUB_SLOT_DATA_MAX_AGE`, 6h) is over `HIVE_HUB_SLOT_DATA_STALE_BYTES` (2 GiB) raises a + `slot-data-stale` info alert. +- **Idle stale slots are reset.** Once such a slot has sat unclaimed for + `HIVE_HUB_SLOT_RESET_MIN_IDLE` (24h), the hourly lane marks it `resetting` + (which the claim paths never pick), waits a few seconds, re-reads it, and + only if it is still `resetting` removes its record and deprovisions it, + which deletes its PVC. A claim that raced the mark wins, and the reset backs + off. The pool replenisher then seeds a + fresh slot with a clean volume. At most `HIVE_HUB_SLOT_RESETS_PER_RUN` (1) + slots are reset per cluster per pass. Set + `HIVE_HUB_SLOT_STORAGE_RESET_ENABLED=false` to report without resetting. + +A slot qualifies only when it meets every one of these conditions: status +`available`, owned by a hub admin, org prefixed `available-`, no vanity URL, +and no claim in flight. Customer hives are never reset automatically. diff --git a/docs/content/hive/design/colony-customer-data-backend.md b/docs/content/hive/design/colony-customer-data-backend.md index 4bf6e5b2..673b0a64 100644 --- a/docs/content/hive/design/colony-customer-data-backend.md +++ b/docs/content/hive/design/colony-customer-data-backend.md @@ -607,6 +607,7 @@ The trust domain narrows "spokes" to the project's own hives. | Spoke to hub match request | Salted hashes of confirmed logins | Spoke to hub | No values sent | Existing. Unchanged. | | Spoke gitdm match | Confirmed login and confirmed emails, matched on the spoke | Local | Private-domain email stays on the spoke | Existing | | Spoke devstats, crowd.dev | Confirmed public GitHub login | Spoke to CNCF / LFX | Public forge identity | Existing, off. crowd.dev blocked. | +| Hub LFX Insights (#20878, #20968) | The project listing request, project slugs (derived on the hub from public fleet repos, no repo name sent), and an organization slug from a publicly derived Affiliation; the login is matched on the hub | Hub to LFX Insights | No person identifier leaves the hub. Results are `local_only` and not in the customer match | New, off by default | | Spoke to hub: any customer fact | Nothing | n/a | customers.md section 12: any such proposal is its own RFC | **Not proposed here** | | colony.db on disk | Everything the deployment already holds | Local | No new egress. Locality is stored per fact. | P2 to P4 | @@ -686,6 +687,7 @@ works. This section is about what to do with it once it does. | `HIVE_HUB_AFFILIATION_COLONY_DEVSTATS` | hub | `false` | P1 | | `HIVE_HUB_AFFILIATION_COLONY_DEVSTATS_HOURLY_LIMIT` | hub | `30` (at most `120`) | P1 | | `HIVE_HUB_AFFILIATION_COLONY_TIMEOUT` | hub | `2m` (at most `10m`) | P1 | +| `HIVE_HUB_LFX_INSIGHTS_ENABLED` (and the other `HIVE_HUB_LFX_INSIGHTS_*`, see [telemetry](/docs/hive/dashboard/data-collection-and-telemetry#lfx-insights-on-the-hub)) | hub | `false` | #20878 | | `HIVE_HUB_CUSTOMERS_TRUSTED_HIVES` | hub | empty | P1 PR (#19854) | | `HIVE_HUB_CUSTOMER_STORE` | hub | `colony` (was `json` until #19972) | P4, default P5 | | `customers.store` / `HIVE_CUSTOMERS_STORE` | spoke | `shadow` (was `json` until #19972; moves to `colony` once parity is confirmed on the project's own hive) | P3, default P5 | diff --git a/docs/content/hive/design/workflow-models.md b/docs/content/hive/design/workflow-models.md index ab44d989..321c22d8 100644 --- a/docs/content/hive/design/workflow-models.md +++ b/docs/content/hive/design/workflow-models.md @@ -631,6 +631,31 @@ now also remembers what it provisioned and reconciles on change that was never bound, nothing is remembered and nothing is deleted; the pre-P4 path is unchanged and its tests are byte-identical. +### Sticky label removal + +A bound model's whose-turn labels (`labels.entries` bound to a state) are kept in step with the item +by the stage reconciler, so a label a maintainer removes would come back on the next pass. With +`workflow.sticky_label_removal` (default `true`; `WorkflowConfig.StickyLabelRemoval`) the hive +leaves it off. + +- **Detection.** After each pass the reconciler remembers which of the state's model labels were on + the item and under which *fingerprint* (head SHA, model state, stage, open/merged/draft). A label + that was there and is missing from a later read, with no hive write in between, was removed by + someone else, so it is recorded as a suppression keyed by (item, label). The record keeps the + fingerprint and the time but not who removed it: the removal is found by comparing reads, not by + the webhook actor. Facts read before the hive's own last write are ignored, and labels the hive + removes itself are never remembered as expected, so they never suppress. +- **Effect.** While the fingerprint is unchanged the label is left out of what the reconciler + writes. Stage labels (`stage/*`), roles, gates and labels the model does not bind to a state are + unaffected. A person putting the label back clears the suppression. +- **Clears** when the head SHA or the model state changes, the item is merged, or the setting is + turned off (turning it off forgets every suppression). +- **Persistence.** Suppressions live in `sticky-label-removals.json` under the workflows data root + (`data.workflows_dir`, `HIVE_WORKFLOWS_DATA_DIR`), survive restarts, and an item untouched for 30 + days is dropped. +- **Settings.** Settings → Repos, under the first bound repository's workflow row; owners only, + `PUT /api/workflows/sticky-label-removal {enabled}`, applied on the next pass with no restart. + ### Model replies as human-gate commands A model's `replies[state]` lists the verbs a human may answer the gate with. They now flow through @@ -730,6 +755,10 @@ workflow: prompt_template: "" # default: the built-in prompt techdocs-verifier: disabled: true # never dispatch automatically + handoff_retry: # see Hand-off retries below + max_attempts: 3 # hand-offs of one item and state in all, the first included + cooldown_s: 1800 # wait before handing it back to the same agent; doubles per attempt + max_cooldown_s: 14400 # the doubling stops here ``` An unset `agent` resolves to an enabled agent named after the profile, else the first enabled @@ -812,14 +841,11 @@ The hand-off is recorded `not_started`, with the reason, when: (`WorkflowHandoffCeiling`). A hand-off that was not started releases the issue claim its agent took, logs -`workflow dispatch: hand-off not started` with the reason and what comes next, and is no -longer "done" (`WorkflowDispatchLog.Done`), so the next pass plans it again for a **different** -agent that qualifies (`WorkflowDispatchNeed.Exclude`): one automatic retry -(`WorkflowDispatchMaxAttempts` = 2 hand-offs in all, the owner's manual sends included). If no -other agent qualifies, or the retry is not started either, the item waits for the owner's -**Send to *profile***. The retry's prompt names the earlier agent and the reason. A hand-off -to an agent that could never have done the work counts as no attempt and does not exclude the -agent, so it is picked once its mode allows. +`workflow dispatch: hand-off not started` with the reason, what the agent last showed +(`last_output`) and what comes next, and is no longer "done" (`WorkflowDispatchLog.DoneUnder`), +so the next pass plans it again (see **Hand-off retries** below). The retry's prompt names the +earlier agent and the reason. A hand-off to an agent that could never have done the work +counts as no attempt and does not exclude the agent, so it is picked once its mode allows. **Recovery of records from before this was tracked.** A record with no `status` is a hand-off whose kick landed and of which nothing more is known. It blocks re-planning as before until @@ -829,7 +855,8 @@ what the profile needs (an Accepted request "dispatched" to an advisory scanner) qualifies, with no owner action. `GET /api/workflows` lists the not-started hand-offs whose item still waits under each -profile (`dispatch[].not_started`), and the tracker payload carries them per repository as +profile (`dispatch[].not_started`, each with `max_attempts`, `last_output`, `same_agent_retry_at` while +an automatic attempt is left, and `parked_at` once parked), and the tracker payload carries them per repository as `workflows.repos[repo].handoffs` keyed by item number, so the workflow row on Settings → Repos and the item's Activity Monitor row (`not started: ` badge) both show them (`Dependencies.WorkflowDispatchHandoffs`). @@ -893,6 +920,58 @@ are never to be applied. `prompt_template` replaces it; placeholders: `${REF}`, `${NUMBER}`, `${TITLE}`, `${URL}`, `${KIND}`, `${MODEL}`, `${STATE}`, `${STATE_LABEL}`, `${PROFILE}`, `${AGENT}`, `${AGENT_MODE}`, `${TRIGGER}`, `${INSTRUCTIONS}`, `${DELIVERABLE}`. +### Hand-off retries + +`workflow.dispatch.handoff_retry` (hivecommons/hive#20877, +`config.WorkflowHandoffRetryConfig`, `scheduler.WorkflowHandoffRetryPolicy`) bounds how often a +hand-off that was not started is made again. Every field is optional; zero takes the default. + +| Key | Default | Bound | Meaning | +|-----|---------|-------|---------| +| `max_attempts` | 3 | 10 | Hand-offs of one item and state in all, the first included | +| `cooldown_s` | 1800 (30 minutes) | 7 days | Wait before handing the item back to the same agent, counted from when the hand-off was found not started. It doubles with every attempt already made | +| `max_cooldown_s` | 14400 (4 hours) | 7 days | The doubled wait stops here | + +The owner edits them on Settings → Repos, in the **Hand-off retries** row under the workflow +dispatch profiles (shown once, under the first bound repository whose model hands items to a +profile), saved through `PUT /api/workflows/dispatch/retry`; `GET /api/workflows` carries the +configured, effective, default and largest values as `handoff_retry`. The next pass reads the +live config. + +The pass plans a not-started hand-off again as follows: + +1. A **different** agent that qualifies (`WorkflowDispatchNeed.Exclude` names the agents that + already tried) gets it at once. +2. When no other agent qualifies (a hive where only `quality` may open pull requests in the + repository, as on cncf/techdocs#335), it goes back to the agent the profile resolves to, + once the cooldown has passed (`WorkflowHandoffRetryPolicy.SameAgentRetryAt`). It does not + while that agent is paused or gated (`Eligible`), nor while the item carries a hold label or + `needs-human`. Until then the `item not handed off` line carries `same_agent_retry` with the + time it is due. The prompt tells the agent it was handed the item before and what the last + turn ended on. +3. When `max_attempts` hand-offs were not started (`WorkflowDispatchEntry.Exhausted`), the item + is **parked** for a person: the pass labels it `needs-human` (the hive's existing park label, + which every lane already leaves alone) and posts **one** comment + (`scheduler.WorkflowHandoffParkComment`) with the number of hand-offs, the agents, the last + reason, what the agent last showed, and how to resend. The record keeps `parked_at`, so the + comment is posted once per run of attempts; a park that failed (a GitHub error) is tried + again on the next pass, and at most five items are parked per pass. No comment is posted + per attempt. + +**Send to *profile*** starts the count over: the owner's send is recorded as attempt 1 under the +same key the governor's pass uses (hivecommons/hive#18902), and when the item was parked the +`needs-human` label is removed once the kick lands. Removing the label by hand does not resend +the item. + +**Why the agent did not start it.** When a kicked turn ends, the agent manager keeps the last +eight lines the agent showed, without CLI chrome or the kick's own echo, masked by +`logscrub.RedactPaneTokens` and cut to 600 characters (`crux.KickOutcome.Tail`). A hand-off +found not started stores that excerpt, or the stand-down line when there is no excerpt, as +`last_output` on its record in `workflow-dispatch.json` (scrubbed again and bounded to 600 +characters, `WorkflowHandoffLastOutputMaxRunes`). It appears on the `hand-off not started` and +`item parked` log lines, in `dispatch[].not_started[].last_output` on `GET /api/workflows`, on the +Settings → Repos line, and in the park comment. + ## Ingest from cluster and from written specs (RFC phase 6) Two more ways into a draft model, beside the repository ingest of phase 3a. Both end in the diff --git a/docs/content/hive/documentation-map.md b/docs/content/hive/documentation-map.md index 5da2ace4..5310dc30 100644 --- a/docs/content/hive/documentation-map.md +++ b/docs/content/hive/documentation-map.md @@ -24,6 +24,7 @@ Documentation for the current Hive line (branch `v5`; the code and docs live und - [Docker Compose quick start](https://github.com/hivecommons/hive/blob/v5/src/docs/quickstart-docker-compose.md) — default standalone installation, prerequisites, and verification. - [Podman quick start](https://github.com/hivecommons/hive/blob/v5/src/docs/quickstart-podman.md) — standalone Quadlet/systemd installation, with rootless/rootful prerequisites. - [Kubernetes deployment](https://github.com/hivecommons/hive/blob/v5/src/docs/kubernetes-deployment.md) — standalone cluster installation, storage, authentication, and dashboard access. Related: [health checks](https://github.com/hivecommons/hive/blob/v5/src/docs/health-checks.md). +- [Opening a hive that is down or upgrading](/docs/hive/hosted-hive-upgrade-gate) - the hub's waiting page on `/open` and the nginx-ingress error fallback for hosted hives, with the cluster apply steps. - [Manual provisioning](/docs/hive/manual-provisioning) — **Operator:** choose standalone Kubernetes, hub-reachable provisioning, or heartbeat-only provisioning. ### Configuration and day-to-day control @@ -78,6 +79,7 @@ Documentation for the current Hive line (branch `v5`; the code and docs live und - [Environment variable reference](/docs/hive/env-vars) — centralized list of runtime, deployment, hub, backup, and contributor environment variables. ### Recovery, moves, and fleet health +- [Data janitor](/docs/hive/data-janitor): the automatic `/data` cleanup, its size guard, the knobs, and the hub's stale-slot reset. - [DiskPressure recovery runbook](https://github.com/hivecommons/hive/blob/v5/src/docs/diskpressure-recovery-runbook.md) — diagnose storage eviction, recover safely, and expand or migrate volumes. - [Agent backend-auth failure recovery runbook](https://github.com/hivecommons/hive/blob/v5/src/docs/backend-auth-recovery-runbook.md) — identify affected agents, re-authenticate the backend, and clear recovered fleet reports. - [Fork PR stalled on Prow presubmits recovery runbook](/docs/hive/fork-pr-presubmit-stall-runbook) — start missing presubmits with `/ok-to-test` and apply `/lgtm` and `/approve` as a person when relayed ones are rejected. @@ -155,6 +157,7 @@ Documentation for the current Hive line (branch `v5`; the code and docs live und ## Contributors and access - [Getting started as a first-time contributor](https://github.com/hivecommons/hive/blob/v5/docs/getting-started-contributing.md) — the end-to-end path for a first code or documentation contribution, tying the reference docs together and answering the Hive-specific questions they don't. +- [AI contribution policy template](/docs/hive/ai-contribution-policy): a fill-in `AI_POLICY.md` for any project, with an ACMM-level section, and how Hive agents disclose AI use. - [RFC and proposal process](/docs/hive/rfc-process) — when a change needs an RFC, how to file a `📝 RFC:` issue, who decides, what accepted means, how RFCs are tracked and closed, and where to see open ones. - [Local development](https://github.com/hivecommons/hive/blob/v5/docs/development.md) — the local workflow for contributing to the Go codebase on `v4`: prerequisites, build, and test loop. - [ClankeR contributor relay](/docs/hive/contributor-relay) — local contributor setup, multi-hub subscriptions, moving a relay to another machine, and role requests. diff --git a/docs/content/hive/env-vars.md b/docs/content/hive/env-vars.md index 903edb33..c6840eb1 100644 --- a/docs/content/hive/env-vars.md +++ b/docs/content/hive/env-vars.md @@ -98,6 +98,22 @@ behavior. [Maintenance limitations](#keeping-this-reference-current) still apply | `HIVE_HUB_AFFILIATION_COLONY_GITDM_REFRESH` | No | `24h` | Hub only. How long a loaded gitdm snapshot is used before its files are revalidated (ETags). Go duration; values below `1h` or invalid use the default. | | `HIVE_HUB_AFFILIATION_COLONY_DEVSTATS` | No | `false` | Hub only. Sends each user's public github.com login, and nothing else, to CNCF DevStats during the daily affiliation refresh, for their CNCF contribution count (`colony:devstats`). Listed in [telemetry.md](/docs/hive/dashboard/data-collection-and-telemetry#hub-affiliation-from-colony). | | `HIVE_HUB_AFFILIATION_COLONY_DEVSTATS_HOURLY_LIMIT` | No | `30` | Hub only. devstats lookups across all users in one hour. Values above `120` are capped; invalid or below `1` use the default. | +| `HIVE_HUB_LFX_INSIGHTS_ENABLED` | No | `false` | Hub only. Turns on LFX Insights as a source for the daily affiliation refresh ([#20878](https://github.com/hivecommons/hive/issues/20878)): contribution totals and roles from the contributor leaderboards of the listed projects, matched against the user's login on the hub, and the LF membership level of their organization. Inert without a token. Read per refresh. See [LFX Insights on the hub](/docs/hive/dashboard/data-collection-and-telemetry#lfx-insights-on-the-hub). | +| `HIVE_HUB_LFX_INSIGHTS_TOKEN` | No | unset | Hub only. The LFX Insights API token (`lfi_` prefix), sent as a bearer token. Wins over `HIVE_HUB_LFX_INSIGHTS_TOKEN_FILE`. A secret: never logged. | +| `HIVE_HUB_LFX_INSIGHTS_TOKEN_FILE` | No | unset | Hub only. Path of a file holding the LFX Insights API token, such as a mounted Secret key. Read per refresh, so a rotated Secret needs no restart. An unreadable file pauses the source (stored facts are kept) and is logged once, naming the variable only. | +| `HIVE_HUB_LFX_INSIGHTS_PROJECTS` | No | empty | Hub only. Comma-separated LFX project slugs always read (at most 20), on top of the projects derived from the joined hives' public repos ([#20968](https://github.com/hivecommons/hive/issues/20968)). | +| `HIVE_HUB_LFX_INSIGHTS_EXCLUDE` | No | empty | Hub only. Comma-separated LFX project slugs never read, even when pinned or derived (at most 200). | +| `HIVE_HUB_LFX_INSIGHTS_AUTO_PROJECTS` | No | `true` | Hub only. Derives the LFX project list from the repos the joined hives manage, public github.com repos only, while the LFX source is on. `false` leaves the pins minus the exclusions. | +| `HIVE_HUB_LFX_INSIGHTS_PROJECT_MAP_TTL` | No | `24h` | Hub only. How often the LFX project listing is read to map repos to projects, and how long a derived project no hive matches any more is kept. Go duration from `1h`; above `168h` is capped. | +| `HIVE_HUB_LFX_INSIGHTS_LIST_MAX_PAGES` | No | `1000` | Hub only. Bound on the pages (100 projects each) of one walk of the LFX project listing. At most `5000`. The walk spans refresh passes and spends at most half the hourly limit in any hour, whatever this bound; a walk that hits it is logged and shown as a warning on the admin report ([#20989](https://github.com/hivecommons/hive/issues/20989)). | +| `HIVE_HUB_LFX_INSIGHTS_VERIFY_PER_PASS` | No | `50` | Hub only. GitHub repo visibility checks one LFX derivation pass makes for fleet repos with no verdict yet; a pass stops after 3 failed checks in a row (a rate limit or outage). At most `500`. | +| `HIVE_HUB_LFX_INSIGHTS_MAX_PROJECTS` | No | `40` | Hub only. Cap on the effective LFX project set: pins first, then derived projects by number of matching repos. At most `200`. | +| `HIVE_HUB_LFX_INSIGHTS_API_URL` | No | `https://api.insights.linuxfoundation.org` | Hub only. LFX Insights API base URL. Must be https with no query or fragment; anything else turns the source off (stored facts are kept). | +| `HIVE_HUB_LFX_INSIGHTS_HOURLY_LIMIT` | No | `200` | Hub only. LFX Insights requests in one hour. Values above `3600` are capped; invalid or below `1` use the default. | +| `HIVE_HUB_LFX_INSIGHTS_CACHE_TTL` | No | `24h` | Hub only. How long an LFX Insights answer is reused. Go duration from `5m`; above `168h` is capped. | +| `HIVE_HUB_LFX_INSIGHTS_TIMEOUT` | No | `20s` | Hub only. Timeout for one LFX Insights request. Go duration, at most `2m`. | +| `HIVE_HUB_LFX_INSIGHTS_MAX_PAGES` | No | `10` | Hub only. Contributor leaderboard pages (200 entries each) read per project. At most `50`. Keep projects times pages well under the hourly limit. | +| `HIVE_HUB_LFX_INSIGHTS_PER_LOGIN` | No | `false` | Hub only. Allows the per-GitHub-login route once LFX Insights ships one (linuxfoundation/insights#2573). That route sends each user's login to LFX, so it is a separate opt-in; until it is set, logins are matched on the hub only. | | `HIVE_HUB_AFFILIATION_COLONY_TIMEOUT` | No | `2m` | Hub only. Time budget for one user's colony lookups, kept apart from the GitHub profile budget because the first gitdm load downloads every file. Go duration, at most `10m`. | | `HIVE_HUB_KIOSK_CTA_URL` | No | `https://hive.hivecommons.dev/get-started` (`kioskcta.DefaultURL`, `src/pkg/webassets/kioskcta`) | Destination of the call-to-action badge the hub Fleet activity page shows bottom-right when loaded with `?kiosk=1` (the fleet Twitch stream). Rendered as text and as a QR code. | | `HIVE_HUB_KIOSK_CTA_TEXT` | No | `🐝 Want this for your repos?` (`kioskcta.DefaultText`) | Copy line above the URL on that badge. | @@ -179,6 +195,8 @@ behavior. [Maintenance limitations](#keeping-this-reference-current) still apply | `HIVE_REFERENCE_REPOS_DERIVE_INTERVAL` | No | `10m` | How often the hive re-lists accepted request issues to derive `project.reference_repos` entries between config reloads (`src/cmd/hive/reference_repos_derive.go`, #18159). A closed request issue or a removed `triage/accepted` label drops the derived entry on the next pass. Go duration; unset, unparseable or non-positive values fall back to the default. | | `HIVE_WORKSPACE_CLEANUP_INTERVAL` | No | `1h` | How often the workspace cleanup sweep runs (Go duration, e.g. `30m`). Unset, unparseable, or non-positive values fall back to the default. | | `HIVE_WORKSPACE_CLEANUP_MAX_AGE` | No | `2h` | How old an entry under `/data/agents/*/` must be before the cleanup sweep removes it (Go duration, e.g. `6h`). Unset, unparseable, or non-positive values fall back to the default. | +| `HIVE_DATA_JANITOR_ENABLED` | No | `true` | Turns the `/data` janitor (`src/pkg/datajanitor`, [#20927](https://github.com/hivecommons/hive/issues/20927)) on or off, overriding `data.janitor.enabled`. The session-state prunes keep running either way. See [data-janitor.md](/docs/hive/data-janitor). | +| `HIVE_DATA_JANITOR_DRY_RUN` | No | `false` | When `true`, the janitor selects and reports what it would free on `/api/status` but deletes nothing. Overrides `data.janitor.dry_run`. | | `HIVE_FORGE_COUNT_CACHE_TTL` | No | `20m` | How long the dashboard metrics collector reuses its GitHub Search-API count queries (hive-attributed merged PRs / closed issues per repo for the Cost tiles, outreach PR counts) before re-asking (Go duration, e.g. `30m`). A failed refresh serves the last-good counts (marked stale), retries after 10 minutes and logs at most once per 15 minutes; refreshes are also deferred while the GitHub slow-start caution window is engaged. Unset, unparseable, or non-positive values fall back to the default. | | `HIVE_DOSSIER_CACHE_MAX_ENTRIES` | No | `512` | Caps each public dossier cache. Bounds username-spray memory while keeping normal contributor reuse hot. | | `HIVE_CONTRIBUTOR_KNOWLEDGE_EXPORT_MAX_FACTS` | No | `80` | Caps the number of facts returned by the contributor knowledge export API. Unset, non-numeric, or non-positive values fall back to the default. | @@ -311,6 +329,11 @@ new value at the same time. | `HIVE_AGENT_PROSE_FILTER` | No | on | Rewrites em-dashes (and spaced en-dashes) in text an agent wrote itself: its GitHub and Linear writes through the egress proxy (JSON text fields only) and its HEAD commit message in the push broker. `false`, `0`, `off` or `no` turns it off. Text hive composes is always filtered. See [outbound-prose.md](/docs/hive/outbound-prose) ([#19103](https://github.com/hivecommons/hive/issues/19103)). | | `HIVE_AGENT_AI_ATTRIBUTION_FILTER` | No | on | Keeps AI tool attribution (a `Co-authored-by:` naming Claude, Copilot or another AI tool, or a "Generated with" footer) out of agent work: the egress proxy removes it from agent-written PR, issue and comment text and refuses an in-pod lane push whose commits carry it, the push broker removes it from the lane's outgoing commits (refusing only when it cannot rewrite them), and hive's PR, issue and comment relays drop it. Human co-authors and `Signed-off-by:` are never touched. `false`, `0`, `off` or `no` turns it off. The squash message hive builds is always filtered. See [outbound-prose.md](/docs/hive/outbound-prose#ai-tool-attribution) ([#20620](https://github.com/hivecommons/hive/issues/20620)). | | `HIVE_PROXY_INJECT_GH_AUTH` | No | unset (off on every hive, including hosted) | Exact `true` enables proxy-side App-token injection. **Requires GitHub App auth. Refuses startup (exit 19) with `HIVE_PROXY_ADVISORY_OK=true`.** Other spellings do not enable it. Read [behavior and exceptions](#proxy-credential-injection). | +| `HIVE_PROXY_LANE_GITHUB_TUNNEL` | No | unset (off) | Operator rollback for the person's-PR guard. The proxy normally terminates TLS for lanes and unidentified callers to `github.com` and verified registered GHE hosts, relaying requests with their original credentials and refusing pushes onto a person's PR branch. Other requests pass through and each connection closes after one request. A tunneled CONNECT to `:443` is checked for an inner ClientHello naming an intercepted GitHub host; malformed and IP-literal SNI are refused. HTTPS by address without SNI, SSH on `:443` to GitHub, GitLab and Bitbucket, and people's dashboard terminal sessions keep their tunnels. Exact `true` restores the unread tunnel for these guarded paths, including GHE, and logs a boot warning. | +| `HIVE_PROXY_GHE_HOSTS` | No | unset | JSON array of GitHub Enterprise hostnames to register with the proxy, for example `["github.example.com"]`. | +| `HIVE_PROXY_GHE_CA_BUNDLES` | No | unset | JSON object mapping registered GHE hostnames to PEM CA bundle paths readable by the proxy, for example `{"github.example.com":"/etc/hive/ghe-ca.pem"}`. The proxy checks each registered host's bundle and TLS handshake at startup; only a validated host is routed through the person's-PR guard. A host with a bundle that has not validated (unreachable, slow, unreadable or wrong CA) is denied to lanes and unidentified callers with a 403 naming this variable, and validation is retried in the background (see `HIVE_PROXY_GHE_RETRY_INITIAL`) until it succeeds, with no restart; the bundle file is re-read on each attempt. The hive's own control plane and `HIVE_PROXY_LANE_GITHUB_TUNNEL=true` keep the tunnel. A host with no bundle keeps its existing tunnel. State (`validated`, `pending`, `failed` plus last error) appears in gateway health as `ghe:` while not validated, and each state change logs once. Bundles are scoped to their host, do not modify system trust, and do not enable credential injection. | +| `HIVE_PROXY_GHE_RETRY_INITIAL` | No | `5s` | First delay before retrying validation of an unvalidated GHE host. Go duration; doubles after each failure up to `HIVE_PROXY_GHE_RETRY_MAX`. | +| `HIVE_PROXY_GHE_RETRY_MAX` | No | `5m` | Upper bound on the GHE validation retry delay. Go duration. | | `HIVE_AUTHZ_SHADOW` | No | unset (off) | Parseable true value (`true`, `1`) turns on the authorization decision seam in shadow mode ([design](https://github.com/hivecommons/hive/blob/v5/src/docs/design/authorization-decision-point.md), RFC #18988 phase 0/1): the push broker's changed-files guard is re-evaluated by `authz.Decide` after it decides, one decision event per call is kept on a bounded in-memory stream and a difference from the guard is logged. It enforces nothing and changes no behaviour. Read once at first use, so a change needs a restart. | | `HIVE_AUTHZ_SHADOW_BUFFER` | No | `1000` | Number of decision events the shadow stream keeps (oldest evicted first, evictions counted). Positive integer, capped at `10000`; anything else uses the default. Only read when `HIVE_AUTHZ_SHADOW` is on. | | `HIVE_DEPLOYMENT_RUNTIME` | No | none (config `deployment.runtime` fallback; hub-registered Kubernetes hives are auto-detected) | Declares the deployment runtime (`kubernetes`, `podman-quadlet`, or `docker-compose`) so the dashboard can offer standalone upgrades. Unset/unrecognized means `unknown` and the upgrade button stays hidden. See [dashboard-standalone-upgrades.md](https://github.com/hivecommons/hive/blob/v5/src/docs/dashboard-standalone-upgrades.md). | @@ -657,8 +680,15 @@ section requires for lookups. | `HIVE_CONTRIBUTE_DISCONNECT_GRACE` | No | `5s` | Go duration the contribute hub waits after a contributor socket dies before booking the task as `abandoned_disconnect` (activity row + run-log row). A relay that reconnects and resumes the task — or finishes it — inside the window withdraws the booking; the short #2356 release cooldown is still booked immediately. `0` restores the pre-[#7838](https://github.com/hivecommons/hive/issues/7838) synchronous booking. | | `HIVE_HUB_OAUTH_CLIENT_SECRET` | Required when hub OAuth is enabled | none | OAuth client secret used during callback token exchange. | | `HIVE_HUB_SLACK_BOT_TOKEN` | No | none | Slack bot token for hub Slack notifications. | -| `HIVE_NTFY_SERVER` | No | none | ntfy server for hub auth-audit alerts. | -| `HIVE_NTFY_TOPIC` | No | none | ntfy topic for hub auth-audit alerts. | +| `HIVE_HOSTED_POD_NO_READY_THRESHOLD` | No | `15m` | Go duration (e.g. `30m`) a hosted hive may have no ready pod before the hub reports it red and sends an alert. See `fleet-health.md`. | +| `HIVE_NTFY_SERVER` | No | none | ntfy server for hub auth-audit and hosted-pod-not-ready alerts. | +| `HIVE_NTFY_TOPIC` | No | none | ntfy topic for hub auth-audit and hosted-pod-not-ready alerts. | +| `HIVE_HUB_SLOT_DATA_STALE_BYTES` | No | `2147483648` (2 GiB) | An unclaimed pool slot whose reported `/data` holds more than this many bytes raises a `slot-data-stale` alert and is reset once idle (`src/pkg/hub/storage_hygiene.go`, [#20927](https://github.com/hivecommons/hive/issues/20927)). | +| `HIVE_HUB_SLOT_DATA_MAX_AGE` | No | `6h` | A slot is only judged on a `/data` size the spoke measured within this Go duration; older carried-forward reports are ignored. | +| `HIVE_HUB_SLOT_STORAGE_RESET_ENABLED` | No | `true` | Set `false` to report stale unclaimed slots without resetting them. Claimed (customer) hives are never reset either way. | +| `HIVE_HUB_SLOT_RESET_MIN_IDLE` | No | `24h` | Go duration a stale slot must sit unclaimed (since it was created or last assigned) before it is reset. | +| `HIVE_HUB_SLOT_STORAGE_INTERVAL` | No | `1h` | How often the hub's slot-storage lane runs (Go duration, minimum `1m`). | +| `HIVE_HUB_SLOT_RESETS_PER_RUN` | No | `1` | Maximum stale slots reset per cluster per pass (0 to 10), so the pool refills gradually. | | `HIVE_BACKUP_KEY` | Yes for hub DR backups; optional for spoke backups | none | 64-character hex AES-256 key. For spoke backups it is now a **fallback**: owners set the key from Governor Config → Security → Backup (`governor.backup.key_file`), which takes precedence and needs no deployment access. With no key from any source, backup creation fails rather than writing plaintext. | | `HIVE_BACKUP_BUCKET` | Required for OCI upload mode | none | OCI Object Storage bucket for hub backup archives. | | `HIVE_BACKUP_DATA_DIR` | No | `/data` | Hub data directory used by `hive-backup`. | @@ -691,10 +721,13 @@ section requires for lookups. | `HIVE_PROVISION_WORKERS` | No | saved scale setting, else built-in default | Provision queue worker count. The saved dashboard scale setting takes precedence over this variable. | | `HIVE_PROVISION_PER_CLUSTER` | No | saved scale setting, else built-in default | Maximum concurrent provisions per cluster. | | `HIVE_KUBECTL_MAX_PER_CLUSTER` | No | saved scale setting, else built-in default | Maximum concurrent `kubectl` executions per cluster. | -| `HIVE_UPGRADE_WAVE_SIZE` | No | saved scale setting, else built-in default | Number of spokes upgraded per wave. | +| `HIVE_UPGRADE_WAVE_SIZE` | No | saved scale setting, else built-in default | Maximum number of hives on one cluster that may be mid-upgrade at once (default `4`). Auto-upgrades over the cap wait for a later poll cycle; a daily/weekly hive keeps its window open while it waits. | +| `HIVE_UPGRADE_SPREAD_MINUTES` | No | saved scale setting, else `120` | Width of the per-hive stagger for daily/weekly auto-upgrades ([#20919](https://github.com/hivecommons/hive/issues/20919)). Each hive starts at the 13:00 ET window plus a fixed offset derived from a hash of its hive id, so its start time is stable across hub restarts. Clamped so the start never leaves the window's calendar day. | | `HIVE_UPGRADE_DEBOUNCE_SECONDS` | No | built-in default | Debounce window before an upgrade wave starts. | | `HIVE_UPGRADE_MAX_HOLD_SECONDS` | No | built-in default | Maximum time an upgrade may be held before proceeding. | | `HIVE_UPGRADE_COOLDOWN_SECONDS` | No | `21600` (6h) | Minimum interval between automatic upgrades of the same instant-mode hive; a newer target inside the cooldown is deferred and the newest one is applied once it expires. Negative disables. | +| `HIVE_UPGRADE_PREPULL` | No | off | Set to `on`/`true`/`yes`/`1` to pre-pull the target hive image onto each cluster's schedulable nodes before a daily or weekly upgrade window opens (#20920). One short-lived pull pod per node lacking the image is created in a hosted hive namespace and deleted once the node has the image, the pod finishes, or two hours pass. Needs pod get/list/create/delete and node get/list access on the cluster; a Failed pull pod is kept (not recreated) until the two hours pass; the lane is off, and existing pull pods are cleaned up, while spoke upgrades are paused; push-reported clusters are skipped. | +| `HIVE_UPGRADE_PREPULL_LEAD_MINUTES` | No | `120` | How many minutes before a scheduled upgrade window opens the pre-pull starts. Invalid or non-positive values use the default. | | `HIVE_VANITY_REPAIR_SUCCESS_COOLDOWN` | No | `24h` | Go duration a hive is skipped by the heartbeat-kick vanity-URL repair after a **successful** repair (mint or drift-adopt). One of the [#5923](https://github.com/hivecommons/hive/issues/5923) guardrails (`pkg/hub/saas_provision.go`); the env overrides exist for emergency production tuning without a rebuild. Invalid or non-positive values fall back to the default. | | `HIVE_VANITY_REPAIR_FAILURE_BACKOFF` | No | `1h` | Go duration the same repair path waits after a **failed** attempt before retrying a hive, preventing tight loops against unreachable clusters or an exhausted mint budget. | | `HIVE_VANITY_MINT_BUDGET` | No | `20` | Fleet-wide cap (positive integer) on vanity-host certificate **mints** from the repair path per window — sized well under Let's Encrypt's 50 certificates / registered domain / 168h limit so the remainder stays reserved for claim-time provisioning. | diff --git a/docs/content/hive/fleet-health.md b/docs/content/hive/fleet-health.md index a6dad9ad..d529a602 100644 --- a/docs/content/hive/fleet-health.md +++ b/docs/content/hive/fleet-health.md @@ -24,10 +24,28 @@ The verdict is computed on the hub at read time from signals the spoke already reports in its heartbeat; it costs the spoke no extra work and no extra GitHub API calls. +Hosted hives also have a hub-side pod availability check. A hosted hive with +no ready pod past the threshold is red even when its heartbeat is offline. +Set the hub environment variable `HIVE_HOSTED_POD_NO_READY_THRESHOLD` to a Go +duration such as `30m`; the default is `15m`. The reason and node, when +available, appear in the WHY chip for hub admins; other users see only that +no pod is ready. `/api/saas/my-hives` entries carry this as `hostedPodIncident` +(`reason`, `node`, `since`, `csiCorrelated`; `reason`, `node` and +`csiCorrelated` are admin-only). A +FailedMount affecting two or more hives on the same node is flagged as a +likely node or CSI problem. The operator is notified once per observed +incident; a ready pod clears the incident. A hub crash between notification +delivery and recording it can result in a duplicate. +The hub's cluster credentials need permission to list pods and core +Kubernetes events in hosted namespaces. Without event access, readiness +remains visible but FailedMount attribution and correlation are unavailable. +Notifications use the hub's existing `HIVE_NTFY_SERVER` and `HIVE_NTFY_TOPIC` +settings. Failed deliveries are retried while the incident remains active. + This is a different check from [dashboard route and health checks](https://github.com/hivecommons/hive/blob/v5/src/docs/health-checks.md), which covers HTTP probes of the dashboard URL. A hive can pass every route probe and still be -red here, because the verdict measures *output*, not *reachability*. +red here because its output is stale or its hosted pod is not ready. It is also distinct from [fleet drift signals](https://github.com/hivecommons/hive/blob/v5/src/docs/fleet-drift-signals.md), the per-hive deviation badges on My Hives (`heartbeat-stale`, `duplicate-spoke`, diff --git a/docs/content/hive/github-app-setup.md b/docs/content/hive/github-app-setup.md index ad7a924b..1fba3ae0 100644 --- a/docs/content/hive/github-app-setup.md +++ b/docs/content/hive/github-app-setup.md @@ -255,6 +255,14 @@ Do this before 2026-12-02 for every repository whose required `verify PR content 5. **Pin the context to the App (recommended).** In the branch rule or ruleset, set the source of the required `verify PR contents` check to the Hive App instead of "any source". Only the Hive App's status then satisfies it. Do this only after step 4 shows the hive's status on new heads: from that moment the workflow's own check run no longer counts, and a repository whose hive is in `shadow` or `off` would block every merge. 6. **Roll back** by setting `mode: shadow` (or `off`) and, if step 5 was done, setting the check's source back to any source. +### Retire the verifier workflow + +Once `enforce` is verified on real PRs, the `pull_request_target` verifier workflow is a second source of the same required names, and from the cutoff its runs are never created. Retire it in the repository: + +1. Delete the workflow (Hive's own `.github/workflows/pr-verifier.yml` was deleted in [#19040](https://github.com/hivecommons/hive/issues/19040)). Do not move it to `pull_request` under the same job name: it would post a second `verify PR contents` that can disagree with the hive's, and on a fork PR its read-only token cannot write the check runs at all. If you want an informational copy, give its job and check runs names no branch rule requires. +2. Remove anything that only existed to re-run the verifier after a `github.token` push (a `workflow_dispatch` of the verifier, or a step that records the verifier's context itself). The backstop sweep posts the gate on such heads. +3. Keep the hive in `enforce` from then on. In `shadow` or `off` no source posts `verify PR contents`, and every PR waits on it. + ## Install and configure Hive 1. After creating the app, note the **App ID**, **Client ID**, and app slug from the app page/URL. diff --git a/docs/content/hive/hosted-hive-upgrade-gate.md b/docs/content/hive/hosted-hive-upgrade-gate.md new file mode 100644 index 00000000..c544de4f --- /dev/null +++ b/docs/content/hive/hosted-hive-upgrade-gate.md @@ -0,0 +1,151 @@ +> **Synced from Hive.** This page is pulled from [hivecommons/hive@v5](https://github.com/hivecommons/hive/blob/v5/src/docs/hosted-hive-upgrade-gate.md) during the docs build. Edit the canonical source in the Hive repository. + +# Opening a hive that is down or upgrading + +While a hosted hive's pod is down, upgrading or restarting, nothing is there to +serve the hive's own "starting" screen. Without help, a browser sent to the hive +sees whatever sits in front of it: the OpenShift router's "Application is not +available", or the nginx controller's stock 503. Two layers replace that with a +hive-branded page ([#20912](https://github.com/hivecommons/hive/issues/20912)). + +| Layer | Covers | Where | +|---|---|---| +| Hub gate on `/open` | Every hive opened from the hub, on every cluster type | `src/pkg/hub/open_gate.go` | +| Ingress error fallback | Direct visits to hosted hives on nginx-ingress clusters | `src/pkg/hub/saas_provision.go`, `src/deploy/k8s/error-pages.yaml` | + +## 1. Hub gate on `/open` + +`GET /api/saas/hives/{id}/open` is the SSO handoff every hub "open hive" link +uses. After its access check passes, and before it mints the SSO token, the hub +decides whether the spoke can take the browser: + +- **The hub probes the spoke**: an unauthenticated `GET + /robots.txt` with a 3 second timeout and no redirect following. + The spoke answers that path before authentication and the hub's ingress + auth-check lets it through, so the answer comes from the pod (or, if there is + no pod, from the router or ingress), never from the auth layer. The probe uses + the hub's SSRF-guarded transport, so a dashboard URL on a private address is + never fetched. Answers are reused for 3 seconds; a probe that could not + complete is remembered for 5 minutes so hub-unreachable spokes do not pay the + timeout on every click. +- **Only 502, 503, 504 (or a CDN's 520-524) mean "not serving".** Every other + status, including a probe that could not complete at all, lets the navigation + through. The hub cannot reach every spoke (some clusters are firewalled from + it), and the gate must never hold a working hive behind a waiting page. +- **The upgrade flag only changes the wording.** When the registry entry has + `upgrading` set with an `upgradeStartedAt` younger than the stuck-upgrade + window (10 minutes), a not-serving hive is described as upgrading to the + target version. It does not gate on its own: an armed upgrade waits for the + next heartbeat and a drain while the old pod keeps serving. + +When the hive is not ready the hub answers `200` with its own page instead of +the redirect. `200` is deliberate: the hub's own Ingress would replace a 5xx +with the generic error backend page. The page: + +- says the hive is upgrading (naming the target version when known) or starting; +- polls `GET /api/saas/hives/{id}/open-status` (`{ready, upgrading, + targetVersion}`), starting at 3 seconds and backing off by 1.5x to 30 + seconds; +- once ready, continues through `/open` again with the original query string + and URL fragment, so the normal SSO handoff runs with a fresh token; +- after 10 minutes (counted across reloads of the page in the same tab) shows "still not up" with a **Contact the operator** link + (`HIVE_SUPPORT_URL`, default the project issue tracker) and keeps polling once + a minute; +- always offers **Open anyway** (`/open?open_anyway=1`), which skips the gate + but not the access check. + +### Who sees what + +The gate runs after the same access check `/open` always applied (hive owner, +granted user or hub admin). A signed-in user without access still gets the +plain `403 {"error":"access denied"}`, and the probe never runs for them. The +status endpoint checks access before looking anything up, so for such a user +it answers the same `403` for a hive that is up, one that is down and one that +does not exist. A signed-out caller gets `401`. + +## 2. Ingress error fallback (nginx-ingress clusters) + +Each hosted hive on an nginx-ingress cluster gets several Ingress objects. +Their error interception is: + +| Ingress | Paths | `custom-http-errors` | Why | +|---|---|---|---| +| `hive` | `/` (pages) | `502,503,504` | Nothing on page paths answers these on purpose; `/sso` fails with 4xx so it is never intercepted | +| `hive-api-xhr` | `/api` | `401,502,503` | The spoke answers some `/api` calls with a JSON `504` (backup timeout, workflow dispatch, TTS); intercepting it would replace that detail with "hive unavailable" | +| `hive-contribute` | `/api/contribute` | `502,503` | JSON consumers, same reasoning | +| `hive-terminal` | `/terminal` | none | A websocket; an HTML page is no use to it | +| `hive-api` | `/api/v1` | not set, inherits the controller's global list | Bearer-token API | + +Each intercepting Ingress also carries +`nginx.ingress.kubernetes.io/default-backend: hive-error-pages`. The shared +backend (`src/deploy/k8s/error-pages.yaml`, namespace `ingress-nginx`) serves the +branded "Hive is starting" page to browsers and an `{"ok":false,...}` JSON body +to API callers, and always reproduces the intercepted status (it never answers +`200`). + +### 503 and the hive's own 503s + +ingress-nginx cannot tell a 503 it generated (no ready endpoint, the upgrade +window) from a 503 the pod sent. Both are intercepted on an Ingress that lists +503. That is why each list is per Ingress and as narrow as its paths allow: +page paths never send an intentional 503 (the SSO handoff was changed to 4xx +for exactly this reason, #16652), while the JSON Ingresses already accepted +that a spoke 503 comes back as the backend's JSON 503. 500 and every 4xx other +than the XHR 401 always pass through unchanged. + +### Controller requirements + +- `custom-http-errors` and `default-backend` are standard annotations; they do + **not** need `allow-snippet-annotations`, which stays disabled. +- ingress-nginx resolves the per-Ingress `default-backend` Service in the + **Ingress's own namespace**. Hosted hive namespaces have no `hive-error-pages` + Service, so the controller falls back to its global default backend. The + controller must therefore run with + `--default-backend-service=ingress-nginx/hive-error-pages` + (Helm: `controller.extraArgs.default-backend-service`), or intercepted + statuses get the controller's stock page. +- Keep the controller ConfigMap's global `custom-http-errors` at + `502,503,504` (see the comment in `error-pages.yaml`, #17431). + +### Applying it to a cluster + +New hives get the annotations from the template. For a cluster that already +runs hosted hives: + +```bash +CTX= + +# 1. Shared error backend (idempotent). +kubectl --context "$CTX" apply -f src/deploy/k8s/error-pages.yaml +kubectl --context "$CTX" -n ingress-nginx rollout status deploy/hive-error-pages + +# 2. Controller points its default backend at it. Expect +# --default-backend-service=ingress-nginx/hive-error-pages in the output. +kubectl --context "$CTX" -n ingress-nginx get deploy ingress-nginx-controller \ + -o jsonpath='{.spec.template.spec.containers[0].args}' | tr ',' '\n' | grep default-backend +kubectl --context "$CTX" -n ingress-nginx get cm ingress-nginx-controller \ + -o jsonpath='{.data.custom-http-errors}{"\n"}' + +# 3. Existing hive page Ingresses pick up 504. +kubectl --context "$CTX" get ingress -A --field-selector metadata.name=hive -o json \ + | jq -r '.items[] | select(.metadata.annotations["nginx.ingress.kubernetes.io/default-backend"] == "hive-error-pages") | .metadata.namespace' \ + | while read -r ns; do + kubectl --context "$CTX" -n "$ns" annotate ingress hive --overwrite \ + nginx.ingress.kubernetes.io/custom-http-errors=502,503,504 + done +``` + +If step 2 shows no `--default-backend-service` flag, add it through the +controller's Helm values (`controller.extraArgs.default-backend-service: +ingress-nginx/hive-error-pages`) and roll the controller. + +To check a hive end to end, scale it to zero and request its page: the answer +must be `503` with the "Hive is starting" HTML, and an `/api/` request must get +the JSON body. + +## OpenShift clusters + +Hives on OpenShift use Routes, and the router's error pages are left alone. Only +the hub gate applies there: a hive opened from the hub shows the hub's waiting +page, but a **direct** visit to the hive URL during an upgrade or restart still +shows the router's "Application is not available" page until the pod is back. diff --git a/docs/content/hive/hub-deployment.md b/docs/content/hive/hub-deployment.md index 98b39845..51568b35 100644 --- a/docs/content/hive/hub-deployment.md +++ b/docs/content/hive/hub-deployment.md @@ -790,7 +790,7 @@ This is **read-side only**: it is derived per request from data the registry alr ## Verifying the hub Deployment -The hub's own container is named `hub` and it is the only container in the Deployment. Always scope container-level kubectl commands with `-c hub` (for example `kubectl -n hive-hub logs deploy/hive-hub -c hub`); `kubectl set env` without `-c hub` writes to every container. `HIVE_HUB_OAUTH_CLIENT_SECRET` and `HIVE_NPS_RELAY_PULL_SECRET` must come from a Secret via `valueFrom.secretKeyRef`, never a literal `value:`. Check a live or rendered Deployment with: +The hub's own container is named `hub` and it is the only container in the Deployment. Always scope container-level kubectl commands with `-c hub` (for example `kubectl -n hive-hub logs deploy/hive-hub -c hub`); `kubectl set env` without `-c hub` writes to every container. `HIVE_HUB_OAUTH_CLIENT_SECRET`, `HIVE_NPS_RELAY_PULL_SECRET` and `HIVE_HUB_LFX_INSIGHTS_TOKEN` must come from a Secret via `valueFrom.secretKeyRef`, never a literal `value:`. The LFX Insights settings and the read-only mount of the `lfx-insights-token` Secret are checked in as a patch for this Deployment, `src/deploy/hub/lfx-insights-patch.yaml` (apply it with `kubectl -n hive-hub patch deployment hive-hub --patch-file src/deploy/hub/lfx-insights-patch.yaml`); it passes the token as a file, `HIVE_HUB_LFX_INSIGHTS_TOKEN_FILE`. Check a live or rendered Deployment with: ```sh kubectl -n hive-hub get deploy hive-hub -o yaml | python3 src/deploy/check-hub-manifest.py - diff --git a/docs/content/hive/inbox-voice-sources.md b/docs/content/hive/inbox-voice-sources.md index a30316e1..7e417eac 100644 --- a/docs/content/hive/inbox-voice-sources.md +++ b/docs/content/hive/inbox-voice-sources.md @@ -39,8 +39,10 @@ see the issue linked from the changelog entry. a kick prompt: `inbox.spek.agent` if set, otherwise the first enabled, unpaused agent by name. Spektacular never calls an LLM itself and has no command that turns a transcript into a spec (there is no `spektacular - voice`), so the agent drives the `spek-new` workflow (`spektacular skill - spek-new`, `spektacular spec new`, then each `spec goto` step), answers + voice`), so the agent drives the `spek-new` workflow (the `spek-new` + skill `spektacular init` installs in the clone, such as + `.claude/skills/spek-new/SKILL.md`; then `spektacular spec new` and each + `spec goto` step), answers the interview from the item, and files one RFC issue plus native child issues with `spektacular publish --repo --allow-draft --format json`. The hive's normal scanner then claims the diff --git a/docs/content/hive/integration-guide.md b/docs/content/hive/integration-guide.md index 3c99aa1b..0759ea75 100644 --- a/docs/content/hive/integration-guide.md +++ b/docs/content/hive/integration-guide.md @@ -21,7 +21,7 @@ flowchart LR Clanker[ClankeR contributor relay\n/api/contribute/ws] --> Agents Flue[Flue external workflow\nextwork adapter] --> Clanker Crustify[Crustify / Wavefront\nmigration graph] --> WorkSource - Spek[Spektacular CLI\nspec/plan status + plan export] --> Runs[Long-running run leases] + Spek[Spektacular CLI\nstatus --format json] --> Runs[Long-running run leases] Runs --> WorkSource Runs --> Governor ``` diff --git a/docs/content/hive/integrations/forgejo.md b/docs/content/hive/integrations/forgejo.md index 38fd0bc3..b05368c3 100644 --- a/docs/content/hive/integrations/forgejo.md +++ b/docs/content/hive/integrations/forgejo.md @@ -8,7 +8,7 @@ This page is for teams whose repositories live on [Forgejo](https://forgejo.org/ ## Status: partial, in progress -**A Forgejo-only hive finds work, clones, pushes and merges, with gaps.** Hive has a first-class `forgejo` forge kind, and a hive with every repository on Forgejo boots without GitHub credentials. The governor discovers issues and pull requests through the forge adapter ([#19673](https://github.com/hivecommons/hive/pull/19673)), sandbox Job kicks and dashboard Sessions clone from and push to the Forgejo host ([#19678](https://github.com/hivecommons/hive/pull/19678)), a pod-run agent (`sandbox.runtime` off) gets no credential for the Forgejo host and clones a private repository through the hive's clone relay, `hive-clone`, which needs `forgejo.integration` ([#19997](https://github.com/hivecommons/hive/issues/19997)), `hive-gh pr view`, `issue view` and `pr checks` on a Forgejo repository are answered by the hive's read relay with the same compact JSON key names as on GitHub (without `mergeStateStatus`, `reviewDecision`, the diff stats, `stateReason` or `milestone`), and the Forgejo-only kick tells agents to use them ([#20230](https://github.com/hivecommons/hive/issues/20230)), the same relay answers `hive-gh pr reviews` (reviewer, state, commit and inline comments), `pr comments` / `issue comments`, and `run view --log` / `--log-failed` / `run view --job --log` with the last 256 KiB of each job's log, at most 512 KiB a run; reading a job log needs a Forgejo token that may read the repository's Actions ([#20277](https://github.com/hivecommons/hive/issues/20277)), agent issue and pull request requests go through the forge ([#19681](https://github.com/hivecommons/hive/pull/19681)), and the automerge and close-on-merge sweeps run on Forgejo repositories ([#19676](https://github.com/hivecommons/hive/pull/19676)). The gaps a live run against Forgejo 17 found are tracked in [#19909](https://github.com/hivecommons/hive/issues/19909). This page is updated as each piece merges. +**A Forgejo-only hive finds work, clones, pushes and merges, with gaps.** Hive has a first-class `forgejo` forge kind, and a hive with every repository on Forgejo boots without GitHub credentials. The governor discovers issues and pull requests through the forge adapter ([#19673](https://github.com/hivecommons/hive/pull/19673)), sandbox Job kicks and dashboard Sessions clone from and push to the Forgejo host ([#19678](https://github.com/hivecommons/hive/pull/19678)), a pod-run agent (`sandbox.runtime` off) gets no credential for the Forgejo host and clones a private repository through the hive's clone relay, `hive-clone`, which needs `forgejo.integration` ([#19997](https://github.com/hivecommons/hive/issues/19997)), `hive-gh pr view`, `issue view` and `pr checks` on a Forgejo repository are answered by the hive's read relay with the same compact JSON key names as on GitHub (without `mergeStateStatus`, `reviewDecision`, the diff stats, `stateReason` or `milestone`), and the Forgejo-only kick tells agents to use them ([#20230](https://github.com/hivecommons/hive/issues/20230)), the same relay answers `hive-gh pr reviews` (reviewer, state, commit and inline comments), `pr comments` / `issue comments`, and `run view --log` / `--log-failed` / `run view --job --log` with the last 256 KiB of each job's log, at most 512 KiB a run; reading a job log needs a Forgejo token that may read the repository's Actions ([#20277](https://github.com/hivecommons/hive/issues/20277)), agent issue and pull request requests go through the forge ([#19681](https://github.com/hivecommons/hive/pull/19681)), the automerge and close-on-merge sweeps run on Forgejo repositories ([#19676](https://github.com/hivecommons/hive/pull/19676)), and contributor relays can take Forgejo issue tasks with a short-lived credential scoped to one repository and acting as a dedicated contributor user, never the hive's own ([#20413](https://github.com/hivecommons/hive/issues/20413), see [Contributor task credentials](https://github.com/hivecommons/hive/blob/v5/src/docs/forge-app-setup.md#contributor-task-credentials)). The gaps a live run against Forgejo 17 found are tracked in [#19909](https://github.com/hivecommons/hive/issues/19909). This page is updated as each piece merges. ## What Forgejo is diff --git a/docs/content/hive/integrations/spektacular.md b/docs/content/hive/integrations/spektacular.md index b696391b..d8a2e42f 100644 --- a/docs/content/hive/integrations/spektacular.md +++ b/docs/content/hive/integrations/spektacular.md @@ -10,7 +10,7 @@ Use this page to choose between operating the existing runner and implementing a Follow [Using Spektacular with Hive](https://docs.hivecommons.dev/docs/hive/spektacular-runs) for installation, project visibility, enablement, and a first run. Before enabling it, the Spektacular binary and the project/artifacts must be reachable **from the Hive process**, not just a contributor's clone. -The `runs:` and `governor:` settings belong to **Hive's configuration** (the file selected by `--config`/`HIVE_CONFIG`, normally `hive.yaml`), not Spektacular's project `config.yaml`. Use the deployment's supported settings path; see [configuration ownership](/docs/hive/agent-configuration#where-configuration-lives). The runner is installed **at boot**, so restart after enabling it and check for `[spektacular] stage runner installed`. Then verify a known artifact with `spektacular spec status ` in Hive's own working directory and environment. +The `runs:` and `governor:` settings belong to **Hive's configuration** (the file selected by `--config`/`HIVE_CONFIG`, normally `hive.yaml`), not Spektacular's project `config.yaml`. Use the deployment's supported settings path; see [configuration ownership](/docs/hive/agent-configuration#where-configuration-lives). The runner is installed **at boot**, so restart after enabling it and check for `[spektacular] stage runner installed`. Then verify a known artifact with `spektacular status --format json` in Hive's own working directory and environment. Operators do not need to implement the interface below. Keep the tool's version compatible with the commands and JSON fields Hive consumes. @@ -29,59 +29,52 @@ Spektacular owns artifact state; Hive owns the workflow lease. Hive polls Spekta Hive talks to a CLI executable, configured by `runs.spektacular.binary` with default `spektacular` (`src/pkg/config/runs_config.go:137`). The runner executes commands through `BinaryExec`, which runs the configured binary with arguments and captures stdout (`src/pkg/spektacular/runner.go:249`). -Required status command: +Hive is built against one spektacular release, `spektacular.PinnedVersion`, which both images install once (see [the spektacular pin](/docs/hive/operations/agent-and-governor-controls/cli-pins#the-spektacular-pin)). -```sh -spektacular status -``` - -The JSON response maps to `ArtifactStatus` (`src/pkg/spektacular/runner.go:127`): - -```json -{ - "error": false, - "kind": "spec", - "name": "000057_git-commit", - "artifact_id": "artifact-uuid-or-stable-key", - "document_status": "draft", - "current_step": "outline", - "completed_steps": ["intake"], - "created_at": "2026-10-02T00:00:00Z", - "updated_at": "2026-10-02T12:00:00Z", - "closed_at": "", - "spec": "000057_git-commit", - "plan": "000057_git-commit" -} -``` - -Hive decides progress from `document_status`, `current_step`, and `completed_steps`; `updated_at` is informational and never decides progress (`src/pkg/spektacular/runner.go:127`). `document_status: final` advances; `draft` waits; `stale` parks the run for human attention (`src/docs/spektacular.md:139`). - -Preferred final-plan export: +Required status command (`Runner.Status` in `src/pkg/spektacular/runner.go`): ```sh -spektacular plan export --format json +spektacular status --format json ``` -The response maps to `Plan`/`PlanTask` (`src/pkg/spektacular/runner.go:225`). This is a **fragment**, not a complete importable plan: `T0` must also exist in the full plan before `T1` can depend on it. +The runner reads the `specs[]` entry whose `name` is the bare name: its `document_status` and `current_step` for the spec stage, and those of its `plan` for the plan stage. A trimmed example of the report the pinned release prints (full recordings are in `src/pkg/spektacular/testdata/status-0.35.0/`): ```json { - "kind": "plan", - "name": "000057_git-commit", - "tasks": [ + "error": false, + "epic": null, + "requested": "20261201151748-306bfe37-demo", + "specs": [ { - "id": "T1", - "ref": "T1", - "repo": "hivecommons/hive", - "title": "Add encoding helpers", - "depends_on": ["T0"], - "execution": "agent_suitable" + "name": "20261201151748-306bfe37-demo", + "state": "in_progress", + "document_status": "final", + "current_step": "finished", + "plan": { + "name": "20261201151748-306bfe37-demo", + "document_status": "final", + "current_step": "finished", + "tasks": [ + { + "id": "7c1e4b0a-9d3f-4e2a-8b61-0f5d2c9a7e34", + "title": "Export the task list", + "milestone": 1, + "repo": {"name": "smoke", "location": ""}, + "depends_on": ["0b9f6d2e-5a41-4c7b-9e08-3d1f7a6c2b95"], + "execution": {"type": "agent", "reason": ""}, + "completed": false + } + ] + } } - ] + ], + "workflow": null } ``` -If export is unavailable, Hive falls back to `spektacular plan file read /tasks.json` and then `/plan.md` (`src/pkg/spektacular/runner.go:429`, `src/pkg/spektacular/runner.go:445`). +Hive decides progress from `document_status`, `current_step`, and the `workflow` block's `completed_steps`; `updated_at` is informational and never decides progress. `document_status: final` advances; `draft` (or empty) waits; `stale` parks the run for human attention. + +Final-plan task list: the same report's `plan.tasks`, mapped to `Plan`/`PlanTask` (`Runner.ExportPlan`). `execution.type` `agent` becomes `agent_suitable` and `human` becomes `human_required`; any other type is refused. A plan without task structure has no `tasks`, and Hive falls back to `spektacular plan file read plan` and its small markdown task-list convention (`Runner.ExportPlanFallback`). @@ -101,29 +94,29 @@ If export is unavailable, Hive falls back to `spektacular plan file read / ``` Put these in the Hive configuration described above. These fields are `SpektacularConfig` and default off (`src/pkg/config/runs_config.go:137`); restart Hive to install the runner. -2. Ensure the binary prints JSON for `spec status`, `plan status`, and preferably `plan export --format json`; Hive passes no `--json` flag. -3. Use the bare artifact name as the CLI address. Hive normalizes `.md` and `/plan.md` to `` with `ArtifactKey` (`src/pkg/spektacular/runner.go:65`). +2. Ensure the binary prints the `status --format json` report above and serves `plan file read plan`; the per-kind `spec status` / `plan status` verbs were removed upstream in 0.25.0. +3. Use the bare artifact name as the CLI address. Hive normalizes `.md` and `/plan.md` to `` with `ArtifactKey` (`src/pkg/spektacular/runner.go`). 4. Let Hive own stage leases. `RunStageLeaseAccessor` lists pending stages as work items when `run_stages: true` is enabled (`src/pkg/worksource/run_stage.go:37`). 5. Let Hive import final plan tasks. `ImportRunPlan` admits exported tasks as a draft Hive plan; implement work is listed only after approval (`src/pkg/dashboard/stage_leases.go:485`). ## Example flow 1. Run triage classifies an issue as `spec`; when Spektacular is enabled, Hive admits it as a `spec` run (see [Runs](https://github.com/hivecommons/hive/blob/v5/src/docs/runs.md)). -2. The runner polls `spektacular spec status ` until the spec is final (`src/pkg/spektacular/runner.go:359`). +2. The runner polls `spektacular status --format json` until the spec is final (`Runner.Status`). 3. Hive writes a stage receipt and advances the lease to `plan` (`src/pkg/spektacular/adapter.go:97`). -4. The runner polls `plan status`; on final it imports the structured plan (`src/pkg/spektacular/runner.go:403`). +4. The runner polls the same report for the plan; on final it imports the plan's tasks (`Runner.ExportPlanWithFallback`). 5. Hive exposes implement work as run-stage items after plan approval (`src/pkg/worksource/run_stage.go:62`). ## Testing -Use `pkg/spektacular/testdata/spektacular-fake/spektacular`, which implements the CLI scenarios documented by the runner page. Tests cover no direct file access, status parsing, stale/final transitions, retries/escalations, plan export fallback, and dashboard lease integration (`src/docs/spektacular.md:277`, `src/pkg/spektacular/adapter_test.go:142`, `src/pkg/dashboard/spektacular_runner_test.go:153`). +Use `pkg/spektacular/testdata/spektacular-fake/spektacular`, which implements the CLI scenarios documented by the runner page. Tests cover no direct file access, status parsing (including recorded output of the pinned release in `status_recorded_test.go`), stale/final transitions, retries/escalations, the plan document fallback, the single-install pin guard (`pin_test.go`), and dashboard lease integration (`src/pkg/spektacular/adapter_test.go`, `src/pkg/dashboard/spektacular_runner_test.go`). ## Operational notes - Auth and secrets: Hive invokes a local binary; any Spektacular backend credentials belong to that tool's own environment, not to Hive's dashboard token. - Rate limits: tune `poll_interval_s`; every active `spec` or `plan` stage is polled at that cadence (`src/pkg/config/runs_config.go:145`). -- Failure modes: missing artifacts become typed not-found errors; stale/replaced documents are refused rather than silently rebound; expired leases retry until `max_stage_retries` then escalate (`src/pkg/spektacular/runner.go:300`, `src/pkg/spektacular/runner.go:520`). -- What is exposable: status JSON, plan export JSON, run-stage work items and stage receipts. (The `/api/campaigns` projection was retired with inception campaigns.) +- Failure modes: missing artifacts become typed not-found errors; stale/replaced documents are refused rather than silently rebound; expired leases retry until `max_stage_retries` then escalate (`src/pkg/spektacular/runner.go`, `src/pkg/spektacular/poll.go`). +- What is exposable: the status report, run-stage work items and stage receipts. (The `/api/campaigns` projection was retired with inception campaigns.) - What is not exposable: Hive does not open Spektacular files directly, does not provide a generic planning-engine registry, and does not let a third-party engine mutate Hive's leases except through the configured runner boundary. ## Gaps diff --git a/docs/content/hive/native-merge-queue.md b/docs/content/hive/native-merge-queue.md index 7b971d2f..5d976463 100644 --- a/docs/content/hive/native-merge-queue.md +++ b/docs/content/hive/native-merge-queue.md @@ -273,12 +273,16 @@ metadata, not a fabricated last-member PR event. replay evidence), it executes only the trusted base's validator and waits up to 22.5 minutes for the five existing policy checks on that exact PR head. No candidate code is executed; tokens are read-only. - `verify PR contents` is accepted from either provider: the `pr-verifier.yml` - check run (events `pull_request`, `pull_request_target` or `workflow_dispatch`) - or a commit status of that context created by the App bot named in the - repository variable `HIVE_PR_GATE_CREATOR_LOGIN`. With the variable unset the - hive status provider is not configured and the legacy check run is the only - evidence; a status from any other creator is always ignored. + `verify PR contents` is accepted from either provider: a commit status of + that context created by the App bot named in the repository variable + `HIVE_PR_GATE_CREATOR_LOGIN`, or a check run of the retired `pr-verifier.yml` + (events `pull_request`, `pull_request_target` or `workflow_dispatch`) on a + head that already carries one. Since that workflow was retired + ([#19040](https://github.com/hivecommons/hive/issues/19040)) the hive's + status is the only evidence a new head gets, so the variable must be set: + with it unset the hive status provider is not configured and + `verify PR contents` stays missing. A status from any other creator is + always ignored. Label, edit, or unlabel events re-trigger this workflow and serialize behind any in-flight run (the concurrency group is per-PR and never cancels in-progress); the queued run re-reads mutable PR state after the prior run diff --git a/docs/content/hive/notifications.md b/docs/content/hive/notifications.md index f08e339a..92619c00 100644 --- a/docs/content/hive/notifications.md +++ b/docs/content/hive/notifications.md @@ -526,6 +526,7 @@ without a class. Review submissions and review requests are always counted as | `main.postReviewAcknowledgements` | `status` | | | `main.releaseGreenHold` | `status` | one note on the pass that removes a hold whose PR carries the opt-in release-when-green label (`escalation.release_when_green_label`) | | `main.reviewFeedbackSweep.acknowledgeRules` | `status` | | +| `main.reviewFeedbackSweep.answerCommandRequests` | `status` | one reply naming the exact workflow command when a plain-words `/hive` request for it is not run by the hive (#20978) | | `main.rfcNotifySource.Comment` | `status` | | | `main.unparkEscalatedPR` | `status` | | | `dashboard.(*ContributeWSHub).parkWrongBase` | `attention` | | @@ -557,6 +558,7 @@ without a class. Review submissions and review requests are always counted as | `main.maintainHeldPRMergeability` | `attention` | | | `main.rfcCoverageForge.CreateComment` | `attention` | | | `main.runEscalationSweep` | `attention` | | +| `main.workflowHandoffParker` | `attention` | one comment, with the `needs-human` label, when a workflow hand-off was not started `workflow.dispatch.handoff_retry.max_attempts` times ([#20877](https://github.com/hivecommons/hive/issues/20877)) | | `main.reviewFeedbackSweep.checkRuleReply` | `attention` | | | `main.reviewFeedbackSweep.postNeedsHuman` | `attention` | | | `main.reviewFeedbackSweep.proposeRuleHome` | `attention` | | diff --git a/docs/content/hive/operator-reference/sweeps-and-operations.md b/docs/content/hive/operator-reference/sweeps-and-operations.md index 15bce7fa..fd28f888 100644 --- a/docs/content/hive/operator-reference/sweeps-and-operations.md +++ b/docs/content/hive/operator-reference/sweeps-and-operations.md @@ -789,7 +789,7 @@ comment are not red. ## Image provenance and tags -Pre-built images are published by [`.github/workflows/docker.yml`](https://github.com/hivecommons/hive/blob/v5/.github/workflows/docker.yml) to `ghcr.io/hivecommons/hive` (plus `hive-contributor` and `hive-hub`) and mirrored **by digest** into the matching `ghcr.io/kubestellar/*` packages. Post-transfer, `hivecommons` is the native publishing org; the workflow retags the already-built digest into `hivecommons` so that spokes still pinned to the old org keep resolving, and both orgs serve digest-identical manifest lists for the same tag. (A missing cross-org credential is a hard failure in that direction precisely because a one-sided publish would leave `hivecommons` serving stale tags to live spokes.) +Pre-built images are published by [`.github/workflows/docker.yml`](https://github.com/hivecommons/hive/blob/v5/.github/workflows/docker.yml) to `ghcr.io/hivecommons/hive` (plus `hive-contributor` and `hive-hub`) and nowhere else. The old `ghcr.io/kubestellar/*` packages are no longer mirrored and stopped updating on 2026-12-01; a spoke still pinned to them must be repointed at `ghcr.io/hivecommons/*`. A build of a release line publishes, in one multi-architecture manifest operation: @@ -797,7 +797,7 @@ A build of a release line publishes, in one multi-architecture manifest operatio - `ghcr.io/hivecommons/hive:` — immutable per-commit tags; - that line's moving **release channel**, if it owns one — `v5` merge builds own `:candidate` (and `:latest`), `v6` merge builds own `:edge`; `v4` is a maintenance line and publishes **no** channel, only `v4-latest` and short-SHA tags ([#7721](https://github.com/hivecommons/hive/issues/7721) Phase 1). Channels are retags of the same digest; see [release-channels.md](/docs/hive/release-channels). -> **`:latest` follows `v5`.** Only `v5` builds move the global `:latest` tag (`INCLUDE_LATEST` is `false` in `docker.yml` on `v4` and `v6`), so it tracks the same digest as `candidate`. The cross-line ambiguity previously tracked in [#6711](https://github.com/hivecommons/hive/issues/6711) — where `:latest` alternated between lines depending on which run finished last — was resolved by the [#7721](https://github.com/hivecommons/hive/issues/7721) Phase 1 channel remap. For production, still prefer a named channel (`stable`) or a digest over `:latest`. +> **`:latest` follows `v5`.** Only `v5` builds move the global `:latest` tag (the include-latest argument to `publish-image-tags.sh` is `false` in `docker.yml` on `v4` and `v6`), so it tracks the same digest as `candidate`. The cross-line ambiguity previously tracked in [#6711](https://github.com/hivecommons/hive/issues/6711) — where `:latest` alternated between lines depending on which run finished last — was resolved by the [#7721](https://github.com/hivecommons/hive/issues/7721) Phase 1 channel remap. For production, still prefer a named channel (`stable`) or a digest over `:latest`. Channel ownership is deliberately **per-line**: without the split, every merge to one line would silently re-point another line's channel back onto its own build minutes after a deliberate promotion (`src/scripts/publish-image-tags.sh`). Two consequences follow that are easy to get backwards: diff --git a/docs/content/hive/release-channels.md b/docs/content/hive/release-channels.md index 9c65fba1..f9d680a9 100644 --- a/docs/content/hive/release-channels.md +++ b/docs/content/hive/release-channels.md @@ -235,14 +235,16 @@ call as its branch `-latest` and immutable short-SHA tags. Each tag points at an already-built multi-architecture digest (an exact image identifier). v5 builds publish `candidate`; stable promotion later retags the newest eligible build after its age and other gates pass. v6 builds publish `edge`. -All three images have their line's channels in both published orgs: +All three images have their line's channels in the `hivecommons` org: -- `ghcr.io/hivecommons/hive` and `ghcr.io/kubestellar/hive` -- `ghcr.io/hivecommons/hive-contributor` and `ghcr.io/kubestellar/hive-contributor` -- `ghcr.io/hivecommons/hive-hub` and `ghcr.io/kubestellar/hive-hub` +- `ghcr.io/hivecommons/hive` +- `ghcr.io/hivecommons/hive-contributor` +- `ghcr.io/hivecommons/hive-hub` -The `hivecommons` packages mirror the same manifest digests during the org -transfer; either registry can be used to verify or pin. Only release branches +`ghcr.io/kubestellar/hive`, `ghcr.io/kubestellar/hive-hub` and +`ghcr.io/kubestellar/hive-contributor` stopped updating on 2026-12-01. Anything +still pinned to them keeps pulling stale tags; switch to the +`ghcr.io/hivecommons/...` names above. Only release branches (`v5`, `v6`) publish channels, never feature branches. Publishing is monotonic by workflow run number. Each successful multi-arch diff --git a/docs/content/hive/review-evidence.md b/docs/content/hive/review-evidence.md index 5e477561..9e271b5e 100644 --- a/docs/content/hive/review-evidence.md +++ b/docs/content/hive/review-evidence.md @@ -268,6 +268,8 @@ Go users can call `evidence.Verify(&b, pub)` from `pkg/evidence`. The Python ske ## How to read the Evidence card +The card's own header (🔬 Evidence · window) carries the same **?** help mark as every dashboard section header: hover or focus it for a one-line summary, click it to open this section. + Every panel on the Throughput section's Evidence card shares one layout ([#13204](https://github.com/hivecommons/hive/issues/13204)): a header row — title · ⓘ · `n=…` · **letter grade** — then one plain-English sentence, then the chart and a compact legend. The letter grade and the sentence are computed on the server (`pkg/evidence/grade.go`) from the same `/api/evidence/summary` numbers the chart draws, and shipped as `cards[] = {grade: {letter, band, reason, enough_data, rubric}, plain_summary}`. Nothing inside a panel renders larger than the header row, and nothing in it is read by anything that decides a merge. The ⓘ button opens a popover over the chart (never inline) with the plain-language explainer — **What is measured**, **Why it matters**, **How it is measured**, **What good looks like**, **What ours shows**, **Details** (the denominators, policy and coverage text that used to sit under the chart), **What this does not show** — followed by the grade line: the letter, the one-line reason, and the rubric it was computed by. The "ours" and "details" sections are computed from the summary for the selected window, so they change with the 24h / 7d / 30d / custom pills. The button is keyboard reachable (`aria-expanded`, `aria-controls`); Esc closes an open explainer. diff --git a/docs/content/hive/running-at-level-6.md b/docs/content/hive/running-at-level-6.md index 096d6821..8a28994a 100644 --- a/docs/content/hive/running-at-level-6.md +++ b/docs/content/hive/running-at-level-6.md @@ -244,6 +244,9 @@ workflow. Default is `off`. **Verify:** the status appears on a new PR head and the log shows `pr-gate: comparison with the workflow result agrees`. See [the setup note](/docs/hive/integrating-with-hive/github-app-setup#pr-contents-gate-posted-by-the-hive). +Once `enforce` is verified, retire the verifier workflow +([how](/docs/hive/integrating-with-hive/github-app-setup#retire-the-verifier-workflow)); Hive's own +repository did so in [#19040](https://github.com/hivecommons/hive/issues/19040). **Limit:** needs the Hive App's Commit statuses read and write grant. A missing grant forces the gate off and raises a dashboard banner and a hub health cause diff --git a/docs/content/hive/spektacular.md b/docs/content/hive/spektacular.md index da85f28b..4476b7ac 100644 --- a/docs/content/hive/spektacular.md +++ b/docs/content/hive/spektacular.md @@ -261,17 +261,22 @@ lease that carries a stage. For each `spec` or `plan` stage whose poll interval has elapsed it runs ```text -spektacular status +spektacular status --format json ``` +(the per-kind `spektacular status ` the runner used before +was removed upstream in 0.25.0; see [the spektacular pin](/docs/hive/operations/agent-and-governor-controls/cli-pins#the-spektacular-pin)) where `` is the bare artifact name (`000057_git-commit`, never `000057_git-commit.md` or `000057_git-commit/plan.md`): the lease's canonical work-item key `!:` (see [work-sources.md](/docs/hive/work-sources)) with the repository prefix and stage suffix stripped, then reduced to the bare name (`spektacular.ArtifactKey`; the dashboard applies the same rule in -`runKeyOfLease`). The CLI has no `--json` flag (its only global flag is -`--fields`); every verb already prints JSON, and an unknown flag is a usage -error. Then: +`runKeyOfLease`). `status` prints a readable tree by default, so the runner +always passes `--format json`. The report lists the spec (or, for a spec in an +epic, every member spec), each with its `plan` (null until one is written) and +the workflow in progress; the runner reads the entry whose `name` is the bare +name: the spec's `document_status` / `current_step` for the spec stage, its +plan's for the plan stage. Then: - `document_status: draft` leaves the lease alone. - `document_status: final` writes a stage receipt @@ -286,18 +291,18 @@ error. Then: run with `waiting_on=human` and `waiting_reason=stale_plan`, and records a `blocked` timeline event. The lease is not retried; recovery is a fresh plan/re-approval. -- The status payload's `artifact_id`, when present, is the durable - Spek artifact join key Hive stores in receipts and stage attributes. - The bare `name` remains the CLI address and backward-compatible display - alias; older CLIs that lack `artifact_id` fall back to `name`. +- The bare `name` is the join key Hive stores in receipts and stage + attributes; the report carries no separate artifact id. +- An empty `document_status` (a document with no frontmatter yet) counts as + `draft`; any value other than `draft`, `final`, `stale` or empty is a + contract error and nothing advances. - Progress is decided by `document_status`, `current_step` and - `completed_steps` only. The status document's `updated_at` is never read - for a progress or staleness decision: it is workflow activity only while - Spek's in-progress state matches the artifact, and otherwise a file - mtime that a `git checkout`, a reformat or a `touch` moves without anything - having happened. Spek may also omit it entirely when no workflow - state matches, so the parser treats an absent, `null` or empty - `updated_at` (and an empty `created_at` / `closed_at`) as unknown. A stale + `completed_steps` only. `completed_steps` and `updated_at` come from the + report's `workflow` block, and only while that workflow is this kind working + on this name; the block is `null` when nothing is in progress. `updated_at` + is never read for a progress or staleness decision. The report carries no + per-document creation or close date, so a receipt starts and ends at the + advance instant. A stale stage is decided by Hive's own lease clock (the lease's expiry), never by the artifact's timestamps. `TestUpdatedAtNeverDecides` in `pkg/spektacular` keeps it that way. @@ -324,49 +329,27 @@ live lease. ### Plan import -When a `plan` reaches `final` the runner runs +When a `plan` reaches `final` the runner reads its task list from the same +`spektacular status --format json` report: a task-format plan carries +`specs[].plan.tasks`, each `{"id", "title", "milestone", "repo": {"name", +"location"}, "depends_on", "execution": {"type": "agent"|"human", "reason"}, +"completed"}` (Spek's `plantask.ExportTask`). The runner admits them through +`planning.DecomposeFromOutput` with `AutoApprove: false`, rendered verbatim +into the planner's task-list shape (`[] title [repo:] (depends: +) [agent_suitable|human_required]`); no model is asked to redecompose an +already-structured plan. An execution type other than `agent` or `human` is a +contract error, so a task meant for a person is never defaulted to an agent. -```text -spektacular plan export --format json -``` - -(requested upstream in -[spektacular#50](https://github.com/hivecommons/spektacular/issues/50)) and -admits the returned tasks through `planning.DecomposeFromOutput` with -`AutoApprove: false`. Spek's structure is rendered verbatim into the -planner's task-list shape (`[T1] title (depends: T2) [agent_suitable]`); no -model is asked to redecompose an already-structured plan. - -Until that export verb exists, Hive falls back only when export is unavailable -(for example `unknown_subcommand` for `plan export`). The fallback reads the -plan artifact through Spek's existing store boundary: +A plan without task structure (no `tasks` in the report) falls back to the +plan document, read through Spek's store boundary: ```text -spektacular plan file read /tasks.json -spektacular plan file read /plan.md -``` - -The preferred fallback file is `/tasks.json`, using the same shape Hive -asked upstream to standardize: - -```json -{ - "kind": "plan", - "name": "000057_git-commit", - "tasks": [ - { - "id": "T1", - "title": "Add encoding helpers", - "repo": "hivecommons/hive", - "depends_on": ["T0"], - "execution": "agent_suitable" - } - ] -} +spektacular plan file read plan ``` -If `tasks.json` is absent, Hive parses a deliberately small `plan.md` task-list -convention from the same plan directory: +(two arguments; the joined `/plan.md` is refused with +`unexpected_extension` since 0.25.0). Hive parses a deliberately small +task-list convention from it: ```markdown - [T1] Add encoding helpers (repo: hivecommons/hive) [agent_suitable] @@ -374,7 +357,7 @@ convention from the same plan directory: ``` `repo`, `depends`, and the trailing execution marker are optional; a missing -task id is assigned in order (`T1`, `T2`, ...). If neither fallback yields a +task id is assigned in order (`T1`, `T2`, ...). If the fallback yields no task list, the final plan stays parked and the runner logs the import error. The epic is found by its `run_key` metadata (or created with it, bound to the @@ -401,14 +384,13 @@ encodes the answers and still handles the alternatives it cannot rule out: plan and implement is the artifact name itself (`000057_git-commit`), shared by convention across the spek file, the plan directory and the changelog record, and recorded as the workflow's `data.name`. It is NOT the - `spec:` / `plan:` frontmatter cross-references the status response also - carries: those are almost never populated (0 of 57 speks, 3 of 55 plans in - the Spek repository itself), so the runner surfaces them as - `ArtifactStatus.Spec` / `.Plan` for diagnostics only and never joins on - them. Every spelling of an address (`.md`, `/plan.md`) reduces - to the bare name before it reaches the CLI. If a status answer ever - carries a different bare `name` than the one requested, the runner treats - it as a contract violation and does not advance. + `spec:` / `plan:` frontmatter cross-references: those are almost never + populated, and the runner never joins on them. Every spelling of an address + (`.md`, `/plan.md`) reduces to the bare name before it reaches + the CLI. If the status report lists no spec under the requested name (the + name resolved to an epic, or a plan whose frontmatter names another spec), + or the spec's plan carries a different name, the runner treats it as a + contract violation and does not advance. - **Invalidation after `final`.** If `document_status` goes from `final` back to `draft` under the same name, the runner treats the artifact as a stale plan: it refuses to advance, logs, and records `lease_stage_refused` with @@ -425,71 +407,43 @@ runner through the CLI boundary (`Runner.Exec`), which is also the seam tests replace. `TestNoDirectFileAccess` in `pkg/spektacular` scans the package for file access to keep it that way. -## Contract: what is confirmed, what changed, what is still open +## Contract and the fake CLI + +The contract is spektacular `PinnedVersion` (`pkg/spektacular/runner.go`, +documented once in [cli-pins.md](/docs/hive/operations/agent-and-governor-controls/cli-pins#the-spektacular-pin)). Real +output of that release is recorded under +`pkg/spektacular/testdata/status-0.35.0/` (a draft spec with its workflow in +progress, a draft, final and stale plan, a final plan without tasks and its +document, `artifact_not_found`, and the refusals of the removed per-kind +status verb and the joined plan address), and `status_recorded_test.go` +parses each one. + +History: the runner was first written against the per-kind +`spektacular status ` verb (jumppad-labs/spektacular#45) +and an assumed `plan export --format json`. Spek 0.25.0 replaced the +per-kind verb with the top-level `status` report, dropped `--format` from +`plan export` (the command is gone by 0.35.0) and moved plan documents to a +two-argument address. Hive kept pinning 0.22.0 for runs while Inbox -> RFC +needed `publish` from 0.30.0, and each image installed both versions to the +same path ([#20838](https://github.com/hivecommons/hive/issues/20838)); the +runner now speaks the pinned release's CLI and each image installs it once. + +What still holds from #45: a missing artifact exits non-zero and prints the +JSON error envelope `{"error": true, "code", "message", "resource", +"next_action"}` on stdout with code `artifact_not_found` (the `file` verbs use +`not_found`; both are typed as `NotFoundError`, and the parser still accepts a +string-valued `error` defensively); returning a `final` document to `draft` +flips `document_status` on the same document, so `stale_plan` is the normal +invalidation path and `replaced_document` the exception. `pkg/spektacular/testdata/spektacular-fake/spektacular` is a shell fake of the -CLI. It encodes the per-artifact status contract exactly as -jumppad-labs/spektacular#45 ships it, after the Spek maintainer's -review of 2026-09-23 answered the questions Hive had left open. The original -assumptions from the first cut of the runner (PR #8398) and their fate: - -Confirmed: - -1. `spektacular status ` prints one JSON object with - `kind`, `name`, `document_status` (`draft|final`), `current_step`, - `completed_steps[]`, `created_at`, `updated_at`, `closed_at` (#8301). The - response also carries `error: false` (every Spek result does) and - the `spec` / `plan` frontmatter cross-references. `created_at` and - `closed_at` are frontmatter dates emitted as RFC3339 midnight UTC. -2. A missing artifact exits non-zero and prints the JSON error envelope on - stdout. The code is `artifact_not_found` (the `file` verbs use - `not_found` for the same condition; both are typed as `NotFoundError`). -3. Returning a `final` artifact to `draft` flips `document_status` on the - same document and clears its close date; it does not create a new - document. This is stated in the #45 description from the metadata - lifecycle rules and was not contradicted in review, though the maintainer - did not address it explicitly. The `stale_plan` refusal is therefore the - normal invalidation path and `replaced_document` the exception. - -Changed: - -4. The join key is the bare artifact name, not the `spec:` / `plan:` - cross-references (see above). Hive now strips a document path and a - markdown extension from every address before it reaches the CLI. -5. The error envelope is `{"error": true, "code", "message", "resource", - "next_action"}`, not `{"error": "", "code"}`. The parser accepts - both (the string form stays as a defensive fallback). -6. `updated_at` is "last modified", not "last activity", and may be absent. - Hive no longer uses it anywhere: the receipt ends at `closed_at` (or the - advance instant) and its input hash excludes `updated_at` so two - observations of one final document hash the same. -7. `closed_at` is `""` while the document is open, not `null`; `created_at` - may be `""` when the frontmatter carries no date. Both decode as unknown. -8. There is no `--json` flag on any verb (`unknown flag: --json`); output is - already JSON. Hive passes none. `spec file list` / `plan file list` - likewise take no flag; Hive does not call them today, but Spek may - add a `ModTime` per list entry so one list call can replace N status - calls, which is the shape a future list-based poll would consume. -9. `plan status ` reports `plan.md` only (`PlanFilePath` hardcodes - it), so a plan's `document_status` is that of `plan.md`, not of the whole - plan document set. Hive advances on it as the plan's status; if a plan - ever grows documents whose completion matters, the verb has to widen - first. - -Still open: - -10. `spektacular plan export --format json` printing `{kind: "plan", - name, tasks: [{id, title, repo, depends_on, execution}]}` for a final plan - is still an upstream ask - ([spektacular#50](https://github.com/hivecommons/spektacular/issues/50)). - Until it lands, Hive advances final plans through the documented - `/tasks.json` or `/plan.md` fallback contract above. - -Scenarios: `draft-final` (draft, draft, final), `never-final`, -`final-then-draft`, `final-no-updated-at` (final with the `updated_at` -member absent), `missing`, selected through `SPEK_FAKE_SCENARIO`. The fake -answers `artifact_not_found` for a name spelled with an extension or a -document path, as the real store does, and a usage error for `--json`. +same report. Scenarios: `draft-final` (draft, draft, final), `never-final`, +`final-then-draft`, `final-no-updated-at` (final with a `null` workflow +block), `stale-plan`, `missing`, selected through `SPEK_FAKE_SCENARIO`; the +scripted `document_status` applies to the spec and its plan. The fake answers +`artifact_not_found` for a name spelled with an extension or a document path, +as the real resolver does, and `unknown_subcommand` for the removed +`spec status` / `plan status`. ## Related diff --git a/docs/content/hive/stable-soak-policy.md b/docs/content/hive/stable-soak-policy.md index aa560d87..4039619b 100644 --- a/docs/content/hive/stable-soak-policy.md +++ b/docs/content/hive/stable-soak-policy.md @@ -288,8 +288,8 @@ Digests for that row, as resolved from GHCR: | `hive-contributor` | `sha256:4258219243ef9f55ff51840ee161c6c5ee796dd186773611339641452fcc8f96` | `sha256:c8ab0a7ef4c70fccbbe5b516df3e392f50b9f0102d541e13583cc56754935f96` (v4 `c09a040`) | | `hive-hub` | `sha256:4d095bc56d8db4bb801c1e49f588635876e8410a215583809810556ab996b4bd` | `sha256:4c1741c154ad870970ebfdb4d75370efff70ede8f54533b5ea769e7393d716b3` (v4 `c09a040`) | -The `ghcr.io/kubestellar/*` mirrors carry the same three `stable` digests, so the -cross-org mirror step of that run landed. +`ghcr.io/kubestellar/*` is no longer updated (it stopped on 2026-12-01), so +digests are only resolved against `ghcr.io/hivecommons/*`. ### What the "before" column has to get right diff --git a/docs/content/hive/telemetry.md b/docs/content/hive/telemetry.md index 92e53137..76c60b15 100644 --- a/docs/content/hive/telemetry.md +++ b/docs/content/hive/telemetry.md @@ -21,6 +21,7 @@ Hive sends a small number of operational signals outside the running hive only t | Customers enrichment: crowd.dev lookup | A confirmed customer's public GitHub login, never an email, name or id, and the owner-supplied crowd.dev API token. | crowd.dev / LFX Insights API. | **Off by default** (`customers.enrichment.enabled` and `customers.enrichment.crowddev.enabled`) and inert without a token. Not active: LFX Insights has no usable public API (hivecommons/colony#5), so no request is made. | Results are kept in `/data/customers/enrichment.json` until the person is forgotten. | Leave either switch off, clear the token, or set `HIVE_CUSTOMERS_ENRICHMENT_CROWDDEV_ENABLED=false`. | [Customers enrichment](/docs/hive/customers-enrichment); `src/pkg/dashboard/api_customers_enrichment.go`. | | Hub affiliation: colony gitdm snapshot | Nothing about any person. The hub downloads the public cncf/gitdm affiliation files (the same files for every hub), with a generic User-Agent and no hub or user identity. Each user's public github.com login is matched against them on the hub; emails are never used for matching. | `raw.githubusercontent.com`, public `cncf/gitdm` repository. | **On by default** on the hub (`HIVE_HUB_AFFILIATION_COLONY_GITDM`), because no data about anyone leaves the hub. Revalidated every `HIVE_HUB_AFFILIATION_COLONY_GITDM_REFRESH` (default 24h) with ETags, so an unchanged file is not downloaded again. | The files are cached in `/data/saas/colony-cache`. A match is cached on the user record (`affiliation`, `affiliation_source: colony:gitdm`, `affiliation_confidence`) until the next daily refresh and is shown only in the hub admin Users table. | Set `HIVE_HUB_AFFILIATION_COLONY_GITDM=false` on the hub. | [Hub affiliation from colony](#hub-affiliation-from-colony); `src/pkg/hub/affiliation_colony.go`; `src/pkg/hub/top_repo.go` (`refreshUserTopRepo`); hivecommons/colony `gitdm`; [#19851](https://github.com/hivecommons/hive/issues/19851). | | Hub affiliation: colony devstats lookup | A hub user's public github.com login, never an email, name, hub id or GHE login, with a generic User-Agent and no hub identity. | CNCF DevStats (`devstats.cncf.io`). | **Off by default** on the hub (`HIVE_HUB_AFFILIATION_COLONY_DEVSTATS`). At most `HIVE_HUB_AFFILIATION_COLONY_DEVSTATS_HOURLY_LIMIT` lookups an hour across all users (default 30, at most 120), at most one per user per refresh, and none when the refresh's GitHub lookup failed. A user over the cap keeps their previous count until a later refresh. Sent as a POST to the public DevStats API by the hivecommons/colony client (generic User-Agent, no redirects, rate limited). | The CNCF-wide contribution count is cached on the user record (`cncf_contributions`) until the next refresh; with the switch off it is cleared at each user's next refresh. Shown only in the hub admin Users table. | Leave `HIVE_HUB_AFFILIATION_COLONY_DEVSTATS` unset or `false`. | [Hub affiliation from colony](#hub-affiliation-from-colony); `src/pkg/hub/affiliation_colony.go`; hivecommons/colony `devstats`. | +| Hub affiliation: LFX Insights lookup | Nothing about any person, and no fleet repo name. A request for the project listing (page size and cursor only), the effective LFX project slugs (derived on the hub from the joined hives' public repos, plus `HIVE_HUB_LFX_INSIGHTS_PROJECTS`, minus `HIVE_HUB_LFX_INSIGHTS_EXCLUDE`), the slug form of an organization name the refresh derived from public github.com data (never a GHE or IdP value, never a name set on the hub by the person or an admin), and the operator's LFX Insights API token as a bearer token. A user's login is matched against the returned `githubHandles` on the hub and is not sent (a future per-login route needs its own opt-in, `HIVE_HUB_LFX_INSIGHTS_PER_LOGIN`, off by default). Generic User-Agent, no hub identity, no redirects. | LFX Insights API (`api.insights.linuxfoundation.org`). | **Off by default** on the hub (`HIVE_HUB_LFX_INSIGHTS_ENABLED`), and inert without a token. At most `HIVE_HUB_LFX_INSIGHTS_HOURLY_LIMIT` requests an hour (default 200), each answer reused for `HIVE_HUB_LFX_INSIGHTS_CACHE_TTL` (default `24h`), a pause after a 429 (its `Retry-After`, at most 1h) and after a 401 or 403 (30m). | The user's contribution total and strongest role across the listed projects and their organization's LF membership level are cached on the user record (`lfx_contributions`, `lfx_role`, `lfx_org_membership`, local_only in colony) until the next refresh; with the switch off they are cleared at each user's next refresh. Shown only in the hub admin Users table, never sent to any hive. | Leave `HIVE_HUB_LFX_INSIGHTS_ENABLED` unset or `false`, or remove the token. | [LFX Insights](#lfx-insights-on-the-hub); `src/pkg/hub/affiliation_lfx.go`; `src/pkg/lfxinsights`. | | Customers hub import (optional) | From the hive: its hive ID and a bounded batch of salted HMAC-SHA-256 hashes of the GitHub logins of its **confirmed** customers (never a suggested person, never plaintext, never any other identifier or profile field). From the hub, back to the hive: for a person who consented for this hive, the real name they entered themselves on the hub and the fields they switched on; for a grant holder of this hive, a labeled public country and organization, and a labeled affiliation derived from public github.com data only (never the identity-provider or GHE-host fallback, never anything from an email), without a consent record (only when the hive sends the `X-Hive-Customer-Match-Labels: 1` header, which it always does); for a person previously delivered and since withdrawn, only the names of the fields to clear. | The configured hub, `POST /api/customers/match`, authenticated with the per-hive heartbeat bearer. The hub compares hashes only against consenting people and never stores or logs a non-matching hash; for a match it learns that this hive has that person as a customer. Values received are visible to the hive owner and anyone with Customers access on that hive, who can export them. | Off by default at every layer: the hub switch `HIVE_HUB_CUSTOMERS_SHARE_ENABLED`, the hub's trust-domain allowlist `HIVE_HUB_CUSTOMERS_TRUSTED_HIVES` (empty by default; a hive not on it gets an empty answer whatever its own switch says), the hive switch `customers.hub_import.enabled` / `HIVE_CUSTOMERS_HUB_IMPORT_ENABLED` (Settings, Features), and consent on the hub's Profile sharing page for the real name, per person, per hive, with nothing pre-checked. Country and organization are treated as public and need no per-person consent once both switches are on. With the hive switch off no request is made. | On the hive, a hub value not refreshed within 72 hours is cleared. On the hub, a consent record lives with the person (deleted with the hub user); a withdrawn record is kept at most 90 days while a clear may be owed. | Turn the hive switch off; the person withdraws on the hub (takes effect on the hive at its next hourly sync); or leave the hub switch off. | `src/pkg/customers/hub_import.go`; `src/cmd/hive/customers_hub_import.go`; `src/pkg/hub/customer_match.go`; `src/pkg/hub/customer_consent.go`; [design](https://github.com/hivecommons/hive/blob/v5/src/docs/design/customers-hub-consent.md). | | Task workflow notifications (optional) | Run and step state of one task workflow: event, delivery id, workflow name and revision, run id and status, trigger kind, step ids, statuses, attempt numbers, fixed failure codes and timestamps. No params, prompts, step results, agent output, logs or credentials. Signed with an HMAC-SHA256 secret per workflow. | The URL the workflow owner sets in `spec.notify.url`, over https (plain http only to loopback), through the hive's outbound proxy. Private, internal and metadata addresses are refused unless the operator allowlists the host (metadata and link-local never). | **Off by default**: sent only when `workflow.tasks.notify.enabled` / `HIVE_WORKFLOW_TASKS_NOTIFY_ENABLED` is on, the workflow sets `spec.notify.url`, and an owner created its signing secret. | Hive keeps each delivery's outcome on the run, which follows run retention (`workflow.tasks.retention_runs`, `retention_days`). What the receiver keeps is up to it. | Turn the switch off, remove `spec.notify`, or delete the workflow's signing secret. | [Task workflow notifications](/docs/hive/workflows/task-workflow-notifications); `src/pkg/taskworkflow/notify.go`; `src/cmd/hive/task_workflows.go`; `src/pkg/dashboard/api_task_workflow_notify.go`. | | Crash/error reporting | No Sentry/PostHog/Segment/Plausible crash reporter was found in `src` during the onboarding audit. Errors are logged locally; selected log-safe health/error strings can appear in hub heartbeats as described above. | Local logs and, for selected operational state, the configured hub. | No third-party crash reporting by default. | Local log/PVC retention is deployment-specific. | N/A for third-party crash reporting; disable hub link for heartbeat-carried operational errors. | Audit search: `telemetry|analytics|metrics push|phone.?home|posthog|segment|plausible|gtag|googletagmanager|sentry` over Go/HTML/JS/Markdown. | @@ -150,6 +151,143 @@ organization email domains (see [Customers hub import](#customers-hub-import)). All are read on each refresh, so a change needs no restart. +### LFX Insights on the hub + +A third source for the same refresh (`src/pkg/hub/affiliation_lfx.go`, +[#20878](https://github.com/hivecommons/hive/issues/20878)), off by default and +inert without a token. It uses the +[LFX Insights API](https://api.insights.linuxfoundation.org) with an +LFX-issued personal access token (`lfi_` prefix) sent as +`Authorization: Bearer `. + +LFX Insights has no route that takes a GitHub login yet +(linuxfoundation/insights#2573), so the hub uses what exists: + +- **People facts.** For each project in the effective project set (see + [Which projects are read](#which-lfx-projects-are-read)) the hub reads the project's contributor leaderboard, following + `nextCursor` for up to `HIVE_HUB_LFX_INSIGHTS_MAX_PAGES` pages of 200, and + matches the user's proven public github.com login against each entry's + verified `githubHandles`, on the hub. The login is never sent. It keeps the + user's contribution total across the listed projects and their strongest + role there (`maintainer`, then `contributor`). With an empty set there + are no people facts. +- **Organization facts.** When the refresh derived an Affiliation from + public github.com data (the person's profile company, an org membership, + a contributed-to org, colony gitdm or devstats), the hub reads the LFX + organization profile at that name's slug (`Red Hat` becomes `red-hat`) and, + when the profile's name matches the Affiliation, keeps its Linux Foundation + membership level. A GHE or IdP fallback is never looked up. + +The facts never change the Affiliation itself. They appear in the Affiliation +tooltip of the admin Users table, are stored local_only in colony with source +`colony:lfx_insights`, and are not part of the customer match any hive +receives. A failed request keeps the facts already stored, and so does a +setting that is on but unusable (an unreadable token file, a bad URL); the +organization level is kept only while the Affiliation is unchanged. One user's +LFX step is bounded at 3 minutes; past that the stored facts are kept. +Concurrent refreshes share one read of a leaderboard. Keep the listed projects +times `HIVE_HUB_LFX_INSIGHTS_MAX_PAGES` well under +`HIVE_HUB_LFX_INSIGHTS_HOURLY_LIMIT`, since a leaderboard is cached only once +all its pages are read. + +#### Which LFX projects are read + +The effective project set is derived from the hives that joined the hub +([#20968](https://github.com/hivecommons/hive/issues/20968), +`src/pkg/hub/affiliation_lfx_projects.go`): + + effective = derived + HIVE_HUB_LFX_INSIGHTS_PROJECTS - HIVE_HUB_LFX_INSIGHTS_EXCLUDE + +- **Derived.** The union of the repos the registered hives manage, kept to + public github.com repos. The hives are the hosted hive records plus hives + known only from their heartbeats (self-hosted spokes) that report + github.com and the `github` forge kind explicitly; a spoke that reports no + host or no kind is left out, as it may be on GitHub Enterprise or another + forge. A hive must be on public github.com with a real + org (the same hive rules as the DIBS repo feed), and each repo must be + verifiably public (the hub's cached GitHub repo visibility check, shared + with the DIBS feed). A + private repo, or one whose visibility is not known yet, is skipped, even on + a hive marked public. Each pass, before matching, the hub checks repos + with no visibility verdict yet itself, at most + `HIVE_HUB_LFX_INSIGHTS_VERIFY_PER_PASS` (default `50`), never-checked repos + first, stopping after 3 failures in a row (a rate limit or outage), so after a hub start the fleet is verified + within a pass or a few rather than waiting on lazy checks + ([#20989](https://github.com/hivecommons/hive/issues/20989)). LFX Insights has no route that maps a repo to its + project, and its listing filters only by project name, so the hub reads + the project listing (`GET /v1-alpha/projects`, each project with its + repository URLs) and matches repos on the hub. No fleet repo name is sent + to LFX. The listing is larger than one hour's request budget, so it is + walked in the background across refresh passes, one page of 100 after + another: the cursor and the partial map carry from pass to pass, and the + listing never spends more than half of + `HIVE_HUB_LFX_INSIGHTS_HOURLY_LIMIT` in any rolling hour (100 pages, so + 10,000 projects, an hour at the default limit). A walk is bounded by + `HIVE_HUB_LFX_INSIGHTS_LIST_MAX_PAGES` (default `1000` pages); one that + hits the bound is marked `truncated`, logged as a warning and shown as a + warning on the admin report. The new map replaces the last good one when + the walk ends, and a new walk starts every + `HIVE_HUB_LFX_INSIGHTS_PROJECT_MAP_TTL` (default `24h`). Matches found + part way through a walk count at once. Until the first walk after a start + ends, a user's refresh keeps their stored contribution total and role. A + repo that matches no project stays unmatched until the next walk (a cached + negative answer). A failed page keeps the walk's progress and the last + good map and derived set, and the walk resumes from the failed page after + 30 minutes. The hub re-matches the fleet against the kept map every 10 + minutes, so a new hive's repo is picked up without a new read. A derived + project drops off once no joined hive has managed a matching repo for one + map TTL. +- **Pinned.** `HIVE_HUB_LFX_INSIGHTS_PROJECTS` is now an always-include list. +- **Excluded.** `HIVE_HUB_LFX_INSIGHTS_EXCLUDE` is never read, even when + pinned. + +The set is capped at `HIVE_HUB_LFX_INSIGHTS_MAX_PROJECTS` (default 40): pins +first, then derived projects by their number of matching repos. A user's +refresh reads the set from memory and never the listing. +`HIVE_HUB_LFX_INSIGHTS_AUTO_PROJECTS=false` turns the derivation off, leaving +pins minus exclusions. + +Hub admins see the set at `GET /api/saas/admin/lfx-insights-projects`: the +`effective` slugs, and for each project its `sources` (`pinned`, `derived`), +the public fleet `repos` it was derived from, when it was last matched, and +why it was `dropped` (`excluded`, `over_cap`), plus when the listing was read, +when it is read next, the walk in progress, the last error, and +`fleet_skipped`: how many hives and repos the fleet scan left out, by reason +(`private_repos`, `unverified_repos`, `ghe_hives`, `unknown_host_hives`, +`other_forge_hives`, `placeholder_hives`, `no_repo_hives`), as counts only, +never names. `warnings` lists a truncated listing, a first walk still in +progress and repos still awaiting a visibility verdict. + +When LFX ships a per-login route (linuxfoundation/insights#2573), +`lfxinsights.Client.ContributorByGitHubLogin` is the one place that changes. +That route would send each user's login to LFX, so the hub asks it only with +its own opt-in, `HIVE_HUB_LFX_INSIGHTS_PER_LOGIN` (off by default); until +then the login is not sent. + +| Setting (hub environment) | Default | Meaning | +|---|---|---| +| `HIVE_HUB_LFX_INSIGHTS_ENABLED` | `false` | The LFX Insights source | +| `HIVE_HUB_LFX_INSIGHTS_TOKEN` | unset | The API token. Wins over the file. A secret | +| `HIVE_HUB_LFX_INSIGHTS_TOKEN_FILE` | unset | A file holding the token, such as a mounted Secret key. Read on each refresh, so a rotated Secret needs no restart | +| `HIVE_HUB_LFX_INSIGHTS_PROJECTS` | empty | LFX project slugs always read, on top of the derived ones, comma-separated (at most 20) | +| `HIVE_HUB_LFX_INSIGHTS_EXCLUDE` | empty | LFX project slugs never read, even when pinned or derived, comma-separated (at most 200) | +| `HIVE_HUB_LFX_INSIGHTS_AUTO_PROJECTS` | `true` | Derive projects from the joined hives' public repos while the source is on | +| `HIVE_HUB_LFX_INSIGHTS_PROJECT_MAP_TTL` | `24h` | How long the repo-to-project map, and a derived project no hive matches any more, is kept (Go duration, `1h` to `168h`) | +| `HIVE_HUB_LFX_INSIGHTS_LIST_MAX_PAGES` | `1000` | Bound on the pages (100 projects each) of one walk of the project listing (at most `5000`). Hitting it is a warning | +| `HIVE_HUB_LFX_INSIGHTS_VERIFY_PER_PASS` | `50` | GitHub visibility checks a pass makes for fleet repos with no verdict yet (at most `500`) | +| `HIVE_HUB_LFX_INSIGHTS_MAX_PROJECTS` | `40` | Cap on the effective project set (at most `200`) | +| `HIVE_HUB_LFX_INSIGHTS_API_URL` | `https://api.insights.linuxfoundation.org` | API base URL; must be https | +| `HIVE_HUB_LFX_INSIGHTS_HOURLY_LIMIT` | `200` | API requests in one hour (at most `3600`) | +| `HIVE_HUB_LFX_INSIGHTS_CACHE_TTL` | `24h` | How long an answer, or a not-found, is reused (Go duration, `5m` to `168h`) | +| `HIVE_HUB_LFX_INSIGHTS_TIMEOUT` | `20s` | Timeout for one request (Go duration, at most `2m`) | +| `HIVE_HUB_LFX_INSIGHTS_MAX_PAGES` | `10` | Leaderboard pages read per project (at most `50`) | +| `HIVE_HUB_LFX_INSIGHTS_PER_LOGIN` | `false` | Allow the per-login route once it exists. It sends each user's login to LFX | + +All are read on each refresh. Neither the token nor a user's login is ever +written to a log line or an error; a token file that cannot be read is +logged once, naming the variable only, and a token LFX refuses (expired or +revoked, HTTP 401 or 403) is logged once at warning level. + ## Customers hub import The Customers section is spoke-local: nothing in it is read from the hub or sent diff --git a/docs/content/hive/workflows/dag-workflows.md b/docs/content/hive/workflows/dag-workflows.md index 478b04ea..45de0bae 100644 --- a/docs/content/hive/workflows/dag-workflows.md +++ b/docs/content/hive/workflows/dag-workflows.md @@ -234,6 +234,8 @@ model's compiler diagnostics. Errors block enabling and starting. | `task-bad-notify` | error | The notify URL is not an absolute http(s) URL, carries credentials or is refused, or an event is not `run` or `step` | | `task-bad-field` | error | A bad param name, `on_failure` or `approval` value, or a dependency listed twice | | `task-limit` | error | A limit below is exceeded | +| `task-agent-has-cadence` | warning | An agent also has an active governor cadence, which can compete with workflow steps | +| `task-sandbox-agent` | warning | An agent runs sandboxed kicks and reports through the sandbox request spool | Limits: @@ -406,9 +408,9 @@ with `409`, and past `workflow.tasks.max_active_runs` with `429`. and can do nothing else. See [Trigger runs from an external scheduler](/docs/hive/workflows/task-workflows#trigger-runs-from-an-external-scheduler). - **Notifications.** With `spec.notify`, the hive switch `workflow.tasks.notify.enabled` and a - signing secret, hive sends a signed JSON `POST` when a run finishes, and when a step finishes - on an agent's report or an attempt failure. Steps that end any other way (cancelled, skipped, - failed by the run timeout or before a kick) appear only in the run event's step list. See + signing secret, hive emits a step event when each step reaches a terminal state, including + cancellation, skipping, timeouts and failures before a kick, and a run event when the run + finishes. Delivery is best effort, with bounded retries. See [Notify another system](/docs/hive/workflows/task-workflows#notify-another-system) and [Task workflow notifications](/docs/hive/workflows/task-workflow-notifications). diff --git a/docs/content/hive/workflows/techdocs-assessment.md b/docs/content/hive/workflows/techdocs-assessment.md index c6f33779..fcbc0706 100644 --- a/docs/content/hive/workflows/techdocs-assessment.md +++ b/docs/content/hive/workflows/techdocs-assessment.md @@ -398,6 +398,14 @@ new pass, posting its report as a PR comment, and the report never applies `veri verifier, which is how a reviewer records a deliberate skip (or applies the label by hand, with the reason in a comment). See [Label contract](#label-contract). +A request in plain words, such as `/hive would like you to run the verification again`, is read +as the command it asks for when the item's current state offers exactly one command that the +words name. From a commenter with write access, the profile reply (`/verify`) hands off exactly +as the literal command does. Anything else (a commenter without write access, a model reply +verb, or words that name more than one command) is answered once with the exact command to type, +and is not sent to the drafter as review feedback. Negated or long comments, and comments that name +no command, are ordinary feedback and still reach the drafter. + ### Which agent fills a profile The model's grant describes the profile's work (its tools and outputs). It does not give a @@ -538,18 +546,27 @@ hand-off is marked **not started**, with the reason, when: covering the issue (for the verifier: no new comment on the draft); - nothing is known about the turn (the hive restarted) and 2 hours have passed. -The hive then releases the claim that agent held and hands the item, once, to a different -agent that has the rights. If no other agent has them, or the second agent does not start -either, the item waits for an owner: use **Send to techdocs-drafter**. There is no further -automatic retry, so an agent that keeps declining cannot loop. +The hive then releases the claim that agent held and hands the item to a different agent +that has the rights. If no other agent has them (a hive where only `quality` may open pull +requests in `cncf/techdocs`), it hands the item back to the same agent after a wait: 30 +minutes after the first failure, doubling each time, at most 4 hours, and never while that +agent is paused or the issue carries a hold or `needs-human` label. After 3 hand-offs in all +that were not started, the hive stops: it labels the issue `needs-human` and posts one +comment with the number of hand-offs, the last reason, what the agent last showed, and how to +send it again (**Send to techdocs-drafter**, which starts the count over). An agent that keeps +declining cannot loop. The limits are `workflow.dispatch.handoff_retry` (`max_attempts`, +`cooldown_s`, `max_cooldown_s`), editable in the **Hand-off retries** row under the profiles on +Settings → Repos; see +[Hand-off retries](/docs/hive/design/workflow-models#hand-off-retries). A hand-off that was not started is visible while the item waits: - **Settings → Repos**: the profile's line says which item, why, and what happens next; - **Activity Monitor**: the row wears a `not started: ` badge whose hover gives the reason; -- the hive log: `workflow dispatch: hand-off not started`, with the agent, the reason and - the next step. +- the hive log: `workflow dispatch: hand-off not started`, with the agent, the reason, what + the agent last showed (`last_output`: the tail of its final screen or its stand-down line, + scrubbed of credentials and bounded) and the next step. **After an upgrade.** A hive that ran an earlier version may hold a record saying an Accepted request was already handed off, to an agent that could never open the pull request (an diff --git a/docs/content/hotshot/readme.md b/docs/content/hotshot/readme.md index b10e077c..c75933fe 100644 --- a/docs/content/hotshot/readme.md +++ b/docs/content/hotshot/readme.md @@ -80,7 +80,7 @@ Releases are tagged with `v`-prefixed semantic versions; see the [latest release ```bash git clone https://github.com/hivecommons/hotshot.git cd hotshot -git checkout v0.2.0 +git checkout v0.2.1 swift build -c release sudo cp .build/release/hotshot /usr/local/bin/ ``` diff --git a/docs/content/hotshot/roadmap.md b/docs/content/hotshot/roadmap.md index 103b48df..dd84eea2 100644 --- a/docs/content/hotshot/roadmap.md +++ b/docs/content/hotshot/roadmap.md @@ -14,7 +14,7 @@ the macOS app, Linux script, and Windows helper. - Clipboard enrichment with image data, file URLs, and shell-escaped text paths. - Isolated Linux and Windows tests (with external tools replaced by test doubles) plus extracted `HotshotCore` helpers for shared macOS decision logic. -- Tagged releases (v0.1.0, v0.2.0) and a Homebrew install path via the +- Tagged releases (v0.1.0, v0.2.0, v0.2.1) and a Homebrew install path via the `hivecommons/homebrew-hive` tap (`brew install hivecommons/hive/hotshot`). ## Near term diff --git a/scripts/sync-hive-docs.files.json b/scripts/sync-hive-docs.files.json index 584089e1..114c3cfb 100644 --- a/scripts/sync-hive-docs.files.json +++ b/scripts/sync-hive-docs.files.json @@ -655,5 +655,14 @@ }, { "source": "hive-status.md" + }, + { + "source": "ai-contribution-policy.md" + }, + { + "source": "data-janitor.md" + }, + { + "source": "hosted-hive-upgrade-gate.md" } ] diff --git a/src/app/docs/page-map.ts b/src/app/docs/page-map.ts index 1c1616a9..b9fbeafa 100644 --- a/src/app/docs/page-map.ts +++ b/src/app/docs/page-map.ts @@ -347,6 +347,9 @@ const NAV_STRUCTURE_HIVE: Array<{ title: string; items: NavItem[] }> = [ { 'Customers: signal audit and using customer data to shape managed repos': 'design/customers-signal-audit.md' }, { 'CLI reference': 'cli-reference.md' }, { 'hive-status: agent health for the supervisor': 'hive-status.md' }, + { 'AI contribution policy template': 'ai-contribution-policy.md' }, + { 'Data janitor': 'data-janitor.md' }, + { 'Opening a hive that is down or upgrading': 'hosted-hive-upgrade-gate.md' }, ] } ]