diff --git a/.github/scripts/check-static-model-freshness.py b/.github/scripts/check-static-model-freshness.py index a1e1553481..8a2299d56c 100755 --- a/.github/scripts/check-static-model-freshness.py +++ b/.github/scripts/check-static-model-freshness.py @@ -25,9 +25,13 @@ dashboard; their static lists are fallbacks and are checked only for shape (non-empty, no duplicates, Go/JS in sync) by the Go unit tests. """ +import argparse import json +import os import re +import subprocess import sys +import tempfile import urllib.request OPENROUTER_MODELS = "https://openrouter.ai/api/v1/models" @@ -109,6 +113,311 @@ def family(key): return (m.group(1), m.group(3) or ""), tuple(int(x) for x in m.group(2).split("-")) +def index_catalog(catalog): + """{vendor: {normalised key}} for every plain OpenRouter id.""" + by_vendor = {} + for m in catalog: + mid = m.get("id") or "" + if "/" not in mid or mid.startswith("~"): + continue + vendor, rest = mid.split("/", 1) + by_vendor.setdefault(vendor, set()).add(norm(rest)) + return by_vendor + + +def compare_list(ids, prefix, by_vendor): + """The comparison behind the report, for one static list. + + Returns (not_found, newer): the list's ids with no catalog counterpart, + and the (vendor, key) pairs the catalog has in the same family at a + higher version than the list's newest entry of that family. + """ + not_found, newer = [], set() + have = {norm(i) for i in ids} + fams = {} + for i in ids: + vendor = prefix or vendor_for(i) + if not vendor: + continue + key = norm(i) + if key not in by_vendor.get(vendor, set()): + not_found.append(i) + fam, ver = family(key) + if fam: + fams.setdefault((vendor, fam), max(fams.get((vendor, fam), ()), ver)) + for (vendor, fam), top in fams.items(): + for key in by_vendor.get(vendor, set()): + f2, v2 = family(key) + if f2 == fam and v2 > top and key not in have: + newer.add((vendor, key)) + return not_found, newer + + +# ---- --apply claude: add newer Claude models the pinned CLI accepts (#18754) ---- +# +# Run weekly by .github/workflows/claude-model-freshness.yml. The candidates +# are the same comparison the report makes (compare_list over +# claudePinnedCLIModels and claudeStaticModels against OpenRouter's anthropic/ +# ids), narrowed to the four Claude lines. Each candidate is then put to the +# Claude Code version pinned in src/Dockerfile, offline and without +# credentials: an unauthenticated `claude --model -p x` prints an +# `unrecognized_model` diagnostic for an id the CLI's built-in model table +# does not know, and nothing of the kind for one it does, before it stops at +# "Not logged in". The "version X or newer is required" refusal (#8417) comes +# from the API after login, so it cannot be probed without credentials. Two +# controls run first (a listed id must be recognised, a made-up id must not); +# if either fails, the CLI's output can no longer be read and every candidate +# goes under "needs a check" instead of being added. + +CLAUDE_LINES = ("fable", "opus", "sonnet", "haiku") +CLAUDE_KEY = re.compile(r"^claude-(" + "|".join(CLAUDE_LINES) + r")-(\d+(?:-\d+)*)$") +CLAUDE_GO_LISTS = ("claudePinnedCLIModels", "claudeStaticModels") +CLAUDE_JS_CONST = "CLAUDE_CLI_MODELS" +BACKENDS_JS = "src/pkg/dashboard/static-src/js/backends-tokens.js" +REQUIREMENTS = "src/scripts/cli-model-requirements.txt" +DOCKERFILE = "src/Dockerfile" +PROBE_NEGATIVE = "claude-hive-probe-0-0" +PROBE_TIMEOUT_S = 90 +UNRECOGNIZED_MARKERS = ("unrecognized_model", "doesn't recognize the model") +REFUSED = re.compile(r"version \S+ or newer is required", re.I) +GO_ID = re.compile(r'^\s*"([^"]+)",') +JS_ID = re.compile(r"^\s*\{\s*value:\s*'([^']+)'") + + +def claude_line(key): + """('fable', (5, 2)) for claude-fable-5-2; None for anything else.""" + m = CLAUDE_KEY.match(key) + if not m: + return None + return m.group(1), tuple(int(x) for x in m.group(2).split("-")) + + +def claude_label(line, version): + return f"{line.capitalize()} {'.'.join(str(v) for v in version)}" + + +def retired(model): + """OpenRouter sets expiration_date on a model it has scheduled for + withdrawal; one already retired or on its way out is never added.""" + return bool(model.get("expiration_date")) + + +def claude_candidates(cli_src, catalog): + """Claude ids on OpenRouter newer than the lists' newest of the same line. + + Mythos (limited access), retired ids, variants (":thinking") and router + aliases ("~anthropic/...") are never candidates. Each candidate carries + the Claude CLI's dashed spelling: anthropic/claude-fable-5.2 -> + claude-fable-5-2. + """ + listed = [] + for name in CLAUDE_GO_LISTS: + listed += [i for i in go_string_list(cli_src, name) if i not in ALIASES] + usable = [m for m in catalog + if (m.get("id") or "").startswith("anthropic/") + and ":" not in m["id"] + and "mythos" not in m["id"].lower() + and not retired(m)] + source = {norm(m["id"]): m["id"] for m in usable} + _, newer = compare_list(listed, "anthropic", index_catalog(usable)) + out = [] + for _, key in newer: + lv = claude_line(key) + if not lv: + continue + out.append({"source_id": source[key], "cli_id": key, "line": lv[0], + "version": lv[1], "label": claude_label(*lv)}) + return sorted(out, key=lambda c: (CLAUDE_LINES.index(c["line"]), c["version"])) + + +def probe_claude(claude_bin, model): + """Classify the pinned CLI's offline answer for one --model value.""" + with tempfile.TemporaryDirectory(prefix="claude-probe-") as home: + # Only PATH and an empty HOME: no API key, no OAuth token, no config. + env = {"PATH": os.environ.get("PATH", "/usr/bin:/bin"), "HOME": home, "LANG": "C.UTF-8"} + try: + proc = subprocess.run([claude_bin, "--model", model, "-p", "x"], cwd=home, env=env, + stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, text=True, timeout=PROBE_TIMEOUT_S) + except (OSError, subprocess.TimeoutExpired) as exc: + return "error", str(exc) + out = proc.stdout or "" + if any(marker in out for marker in UNRECOGNIZED_MARKERS): + return "unrecognized", out + if REFUSED.search(out): + return "refused", out + return "recognized", out + + +def claude_version(claude_bin): + """The binary's `--version` output, or the error running it.""" + try: + return subprocess.run([claude_bin, "--version"], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, text=True, timeout=PROBE_TIMEOUT_S).stdout.strip() + except (OSError, subprocess.TimeoutExpired) as exc: + return f"error: {exc}" + + +def gate_candidates(candidates, claude_bin, known_id, pin, probe=probe_claude): + """Split candidates into (accepted, needs_check, note).""" + if not candidates: + return [], [], "no candidates" + if not claude_bin: + note = "no pinned Claude Code binary was available to probe" + return [], [(c, note) for c in candidates], note + version = claude_version(claude_bin) + if not re.match(re.escape(pin) + r"\b", version): + note = f"the binary to probe reports `{version[:80]}`, not the pinned `{pin}`" + return [], [(c, note) for c in candidates], note + pos, _ = probe(claude_bin, known_id) + neg, _ = probe(claude_bin, PROBE_NEGATIVE) + if pos != "recognized" or neg != "unrecognized": + note = (f"probe controls failed (listed id `{known_id}` -> {pos}, made-up id `{PROBE_NEGATIVE}` -> {neg}), " + "so the pinned CLI's offline answer cannot be trusted this run") + return [], [(c, note) for c in candidates], note + accepted, needs = [], [] + for c in candidates: + verdict, out = probe(claude_bin, c["cli_id"]) + if verdict == "recognized": + accepted.append(c) + elif verdict == "unrecognized": + needs.append((c, "the pinned Claude Code does not recognise this id")) + elif verdict == "refused": + needs.append((c, "the pinned Claude Code refuses it: " + REFUSED.search(out).group(0))) + else: + needs.append((c, "probe error: " + out.strip()[:200])) + note = (f"each id probed with the pinned CLI, unauthenticated; controls passed (listed `{known_id}` recognised, " + f"made-up `{PROBE_NEGATIVE}` not)") + return accepted, needs, note + + +def insert_listed(lines, cli_id, render, id_re): + """Insert render(indent) into a list body for cli_id; None when present. + + Placement: before the first entry of the same Claude line with a lower + version, else after that line's last entry, else before the bare aliases + (and the comment above them), else at the end. Go and JS lists get the + same placement, so lists that matched before still match. + """ + ids = [(m.group(1) if (m := id_re.match(ln)) else None) for ln in lines] + if cli_id in ids: + return None + line, version = claude_line(cli_id) + same = [] + for i, x in enumerate(ids): + lv = claude_line(norm(x)) if x else None + if lv and lv[0] == line: + same.append((i, lv[1])) + at = next((i for i, v in same if v < version), None) + if at is None and same: + at = same[-1][0] + 1 + if at is None: + at = next((i for i, x in enumerate(ids) if x in ALIASES), len(lines)) + while 0 < at < len(lines) and lines[at - 1].strip().startswith("//"): + at -= 1 + sample = next((lines[i] for i, x in enumerate(ids) if x), "\t") + indent = re.match(r"\s*", sample).group(0) + return lines[:at] + [render(indent)] + lines[at:] + + +def edit_block(src, pattern, cli_id, render, id_re): + """Apply insert_listed to the list body the pattern's group 2 spans.""" + m = re.search(pattern, src, re.S) + if not m: + raise ValueError(f"list not found: {pattern}") + new = insert_listed(m.group(2).split("\n"), cli_id, render, id_re) + if new is None: + return src, False + return src[:m.start(2)] + "\n".join(new) + src[m.end(2):], True + + +def apply_claude(root, catalog, claude_bin, dry_run): + """Gate the candidates and make the list edits. Returns (report, accepted).""" + def path(rel): + return os.path.join(root, rel) + + def read(rel): + with open(path(rel), encoding="utf-8") as f: + return f.read() + + go_src, js_src, reqs = read(CLI_MODELS_GO), read(BACKENDS_JS), read(REQUIREMENTS) + pin_m = re.search(r"^ARG CLAUDE_CODE_VERSION=(\S+)", read(DOCKERFILE), re.M) + if not pin_m: + raise ValueError(f"no ARG CLAUDE_CODE_VERSION in {DOCKERFILE}") + pin = pin_m.group(1) + known = next(i for i in go_string_list(go_src, "claudePinnedCLIModels") if i not in ALIASES) + candidates = claude_candidates(go_src, catalog) + accepted, needs, note = gate_candidates(candidates, claude_bin, known, pin) + + added = [] + for c in accepted: + cid, edits = c["cli_id"], [] + for name in CLAUDE_GO_LISTS: + go_src, changed = edit_block(go_src, r"(var " + re.escape(name) + r" = \[\]string\{\n)(.*?)(\n\})", + cid, lambda ind, cid=cid: f'{ind}"{cid}",', GO_ID) + if changed: + edits.append(f"`{CLI_MODELS_GO}`: `{name}` gains `\"{cid}\"`") + js_line = f"{{ value: '{cid}', label: '{c['label']}' }}," + js_src, changed = edit_block(js_src, r"(const " + CLAUDE_JS_CONST + r" = \[\n)(.*?)(\n\s*\];)", + cid, lambda ind, t=js_line: ind + t, JS_ID) + if changed: + edits.append(f"`{BACKENDS_JS}`: `{CLAUDE_JS_CONST}` gains `{js_line}`") + edits.append("`src/pkg/dashboard/static/index.html`: rebuilt with `make dashboard-gen`") + if not any(ln.split()[:2] == ["claude", cid] for ln in reqs.splitlines()): + req_line = f"claude {cid} {pin}" + reqs = reqs + ("" if reqs.endswith("\n") else "\n") + req_line + "\n" + edits.append(f"`{REQUIREMENTS}`: `{req_line}`") + edits.append("`src/pkg/tokens/pricing.go`: `modelPrices` row from the OpenRouter quote, through " + "`pricetable --add` and its plausibility rules (see the price section)") + added.append((c, edits)) + + if accepted and not dry_run: + for rel, body in ((CLI_MODELS_GO, go_src), (BACKENDS_JS, js_src), (REQUIREMENTS, reqs)): + with open(path(rel), "w", encoding="utf-8") as f: + f.write(body) + + lines = ["## Claude model freshness", "", + f"Pinned Claude Code: `{pin}` (`{DOCKERFILE}`). Gate: {note}.", ""] + if dry_run: + lines += ["**Dry run:** nothing was written.", ""] + lines += [f"### Added ({len(added)})", ""] + if not added: + lines += ["No model added.", ""] + for c, edits in added: + lines += [f"#### {c['label']} (`{c['cli_id']}`, from `{c['source_id']}`)", ""] + lines += [f"- {e}" for e in edits] + [""] + if needs: + lines += [f"### Needs a check against the Claude Code changelog ({len(needs)})", "", + "Newer than the lists on OpenRouter, but not shown to be accepted by the pinned Claude Code, so not added:", ""] + lines += [f"- {c['label']} (`{c['cli_id']}`, from `{c['source_id']}`): {why}" for c, why in needs] + [""] + return "\n".join(lines), [c["cli_id"] for c in accepted] + + +def main_apply(args): + if args.catalog: + with open(args.catalog, encoding="utf-8") as f: + catalog = json.load(f).get("data", []) + else: + catalog = fetch_json(OPENROUTER_MODELS).get("data", []) + report, accepted = apply_claude(args.root, catalog, args.claude_bin, args.dry_run) + print(report) + if args.accepted_out: + with open(args.accepted_out, "w", encoding="utf-8") as f: + f.write("".join(i + "\n" for i in accepted)) + return 0 + + +def parse_args(argv): + ap = argparse.ArgumentParser(description=__doc__.split("\n", 1)[0]) + ap.add_argument("--apply", choices=["claude"], help="edit the Claude lists for newer models the pinned CLI accepts") + ap.add_argument("--catalog", help="OpenRouter /api/v1/models JSON file instead of fetching it") + ap.add_argument("--claude-bin", help="the pinned Claude Code binary to probe (without it nothing is added)") + ap.add_argument("--root", default=".", help="repository root (default: .)") + ap.add_argument("--dry-run", action="store_true", help="print the edits; write nothing") + ap.add_argument("--accepted-out", help="write the added CLI ids here, one per line") + return ap.parse_args(argv) + + def main(): with open(CLI_MODELS_GO, encoding="utf-8") as f: cli_src = f.read() @@ -123,12 +432,7 @@ def main(): catalog = [] sections.append(f"### OpenRouter catalog unavailable\n\n`{OPENROUTER_MODELS}` failed: `{exc}`. Nothing was compared against it this week.") live_ids = {m.get("id", "") for m in catalog if m.get("id")} - by_vendor = {} - for mid in live_ids: - if "/" not in mid or mid.startswith("~"): - continue - vendor, rest = mid.split("/", 1) - by_vendor.setdefault(vendor, set()).add(norm(rest)) + by_vendor = index_catalog(catalog) if live_ids: ids, default = openrouter_suggestions(or_src) @@ -144,24 +448,8 @@ def main(): if not ids: sections.append(f"### `{name}` could not be parsed\n\nThe checker found no ids; update the parser or the list.") continue - not_found, newer = [], set() - have = {norm(i) for i in ids} - fams = {} - for i in ids: - vendor = prefix or vendor_for(i) - if not vendor: - continue - key = norm(i) - if key not in by_vendor.get(vendor, set()): - not_found.append(i) - fam, ver = family(key) - if fam: - fams.setdefault((vendor, fam), max(fams.get((vendor, fam), ()), ver)) - for (vendor, fam), top in fams.items(): - for key in by_vendor.get(vendor, set()): - f2, v2 = family(key) - if f2 == fam and v2 > top and key not in have: - newer.add(f"{vendor}/{key}") + not_found, newer_keys = compare_list(ids, prefix, by_vendor) + newer = {f"{vendor}/{key}" for vendor, key in newer_keys} lines = [] if newer: lines.append("Newer models of the same family on OpenRouter that the list lacks:\n\n" + "\n".join(f"- `{n}`" for n in sorted(newer))) @@ -193,4 +481,5 @@ def main(): if __name__ == "__main__": - sys.exit(main()) + _args = parse_args(sys.argv[1:]) + sys.exit(main_apply(_args) if _args.apply else main()) diff --git a/.github/scripts/claude-model-freshness.sh b/.github/scripts/claude-model-freshness.sh new file mode 100755 index 0000000000..c6275881f0 --- /dev/null +++ b/.github/scripts/claude-model-freshness.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# Builds the weekly Claude model freshness change in the working tree (#18754). +# Run by .github/workflows/claude-model-freshness.yml; see its header. +# +# 1. fetches OpenRouter's public model catalogue once (both steps below read +# the same snapshot); +# 2. installs the Claude Code version pinned in src/Dockerfile exactly the +# way the image does (npm --ignore-scripts, then the vendor's install.cjs) +# so the candidates can be probed against it, unauthenticated; +# 3. check-static-model-freshness.py --apply claude: candidates, the probe +# gate, and the edits to claudePinnedCLIModels, claudeStaticModels, +# CLAUDE_CLI_MODELS and cli-model-requirements.txt; +# 4. for the accepted ids: `pricetable --add` (new modelPrices rows, only +# through its plausibility rules) and `make dashboard-gen`. +# +# Usage: claude-model-freshness.sh +# Env: DRY_RUN=1 prints every edit and writes nothing. +# SOURCE_URL overrides the catalogue URL. +# Out: /report.md (the PR body), /accepted.txt (one id per line; +# empty when nothing is added), /pin.txt. +set -euo pipefail + +out="${1:?usage: claude-model-freshness.sh }" +mkdir -p "$out" +out="$(cd "$out" && pwd)" +cd "$(git rev-parse --show-toplevel)" + +source_url="${SOURCE_URL:-https://openrouter.ai/api/v1/models}" +catalog="$out/openrouter.json" +curl -fsSL --retry 3 --max-time 60 -H 'Accept: application/json' -A hive-claude-model-freshness \ + "$source_url" -o "$catalog" + +pin="$(sed -n 's/^ARG CLAUDE_CODE_VERSION=\([^ ]*\).*/\1/p' src/Dockerfile | head -1)" +[ -n "$pin" ] || { echo "no ARG CLAUDE_CODE_VERSION in src/Dockerfile" >&2; exit 1; } +printf '%s\n' "$pin" > "$out/pin.txt" + +# Without the binary nothing is added: every candidate is reported under +# "needs a check" instead (check-static-model-freshness.py gate_candidates). +claude_bin="" +prefix="$out/claude-code" +if npm install --prefix "$prefix" --ignore-scripts --no-fund --no-audit \ + "@anthropic-ai/claude-code@${pin}" >&2 \ + && node "$prefix/node_modules/@anthropic-ai/claude-code/install.cjs" >&2 \ + && "$prefix/node_modules/.bin/claude" --version >&2; then + claude_bin="$prefix/node_modules/.bin/claude" +else + echo "::warning::Could not install Claude Code ${pin} to probe; no model will be added this run." +fi + +dry=() +[ "${DRY_RUN:-}" = "1" ] && dry=(--dry-run) +probe=() +[ -n "$claude_bin" ] && probe=(--claude-bin "$claude_bin") + +python3 -I .github/scripts/check-static-model-freshness.py --apply claude \ + --catalog "$catalog" --accepted-out "$out/accepted.txt" "${probe[@]}" "${dry[@]}" > "$out/lists.md" +cp "$out/lists.md" "$out/report.md" + +if [ ! -s "$out/accepted.txt" ]; then + echo "no Claude model to add" + exit 0 +fi + +ids="$(paste -sd, "$out/accepted.txt")" +(cd src && go run ./internal/tools/pricetable --source "$catalog" --add "$ids" \ + --report "$out/prices.md" "${dry[@]}") +{ echo; cat "$out/prices.md"; } >> "$out/report.md" + +if [ "${DRY_RUN:-}" != "1" ]; then + make dashboard-gen + make dashboard-gen-check + test -z "$(gofmt -l src/pkg/tokens/pricing.go src/pkg/dashboard/cli_models.go)" \ + || { echo "::error::generated Go files are not gofmt-clean" >&2; exit 1; } + { + echo + echo "### Model lists against the CLI pins" + echo + echo '```' + HIVE_MODEL_CHECK_STRICT=0 bash src/scripts/check-cli-model-lists.sh 2>&1 || true + echo '```' + } >> "$out/report.md" +fi +echo "Claude models to add: $ids" diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 3c99da3920..2ea97f6fe4 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = 'bf12ae550a3a4d306821d0ae56cc22850f035e3c'; +const TRUSTED_SCRIPTS_TREE = '337c51a3c0d26870b823801711580d5445982171'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/.github/scripts/native-queue-tracker.test.cjs b/.github/scripts/native-queue-tracker.test.cjs index 61b9690812..8a4d95eb45 100644 --- a/.github/scripts/native-queue-tracker.test.cjs +++ b/.github/scripts/native-queue-tracker.test.cjs @@ -27,10 +27,14 @@ test('real queue position, state and provider age never invent pipeline progress const before = JSON.stringify([q, row]); const html = render(q); assert.match(html, /value="3"/); - assert.match(html, /AWAITING_CHECKS/); - assert.match(html, /queued 10m/); + // GitHub's own state, in words; the wait is the entry's enqueue age. + assert.match(html, /front #7 awaiting checks, in queue 10m/); assert.match(html, /on this page/); - assert.match(html, /Enqueue is not testing or merge completion/); + assert.match(html, /checked 1m ago/); + // Queued is not testing and not merged: nothing on the line says so (the + // help mark may mention the words only to say what they are not). + const line = html.match(/(.*?)<\/span>/)[1]; + assert.doesNotMatch(line, /testing:|merged|data-ham-key|[0-9]+%|ETA [0-9]/); assert.doesNotMatch(html, /data-ham-key|[0-9]+%|ETA [0-9]/); assert.equal(JSON.stringify([q, row]), before); }); @@ -42,10 +46,19 @@ test('unknown, stale, unavailable and partial snapshots cannot claim empty curre q.stale = true; q.state = 'unavailable'; const html = render(q); - assert.match(html, /STALE/); - assert.match(html, /coverage incomplete/); - assert.match(html, /does not prove an empty queue/); - assert.match(render({ ...queue(), observed_at: '2026-10-30T10:00:00Z' }), /STALE/); + // A failed refresh stands out and never reads as an empty queue. + assert.match(html, /ham-native-badge-problem">refresh failed/); + assert.match(html, /queue unknown; last refresh failed/); + assert.doesNotMatch(html, /nothing queued/); + // The caveat lives once, in the help mark. + assert.equal((html.match(/does not prove the queue is empty now/g) || []).length, 2, 'aria-label and tooltip text only'); + // Evidence far older than the rotation explains is a problem; a normal + // rotation delay is an age, not an alarm. + assert.match(render({ ...queue(), observed_at: '2026-10-30T10:00:00Z' }), /ham-native-badge-problem">not checked for 130m/); + const delayed = render({ ...queue(), entries: [], observed_at: '2026-10-30T12:01:00Z', stale: true }); + assert.match(delayed, /nothing queued at last check/); + assert.match(delayed, /checked 9m ago/); + assert.doesNotMatch(delayed, /STALE|ham-native-badge-problem/); }); test('unknown member mapping never trusts a FIFO member list or PR-head green', () => { @@ -53,10 +66,16 @@ test('unknown member mapping never trusts a FIFO member list or PR-head green', q.entries = []; q.candidates = [{ sha: 'synthetic-only', membership: 'unknown', members: [{ pr: 999, head: 'unproved' }], ci: 'unknown', checks: [] }]; const html = render(q); - assert.match(html, /Member mapping unknown/); + assert.match(html, /members not proven/); assert.match(html, /synthetic-only/); assert.doesNotMatch(html, /#999|unproved/); - assert.match(html, /never copied from PR heads/); + assert.match(html, /required checks unknown \(policy unreadable\)/); + assert.doesNotMatch(html, /checks passed/); + assert.match(html, /never the PR.s; missing, pending, skipped or unreadable checks are never shown as passing/); + // A group whose synthetic ref is gone is history, not a live candidate. + const finished = render({ ...queue(), entries: [], candidates: [{ ...q.candidates[0], expired: true, reason: 'Synthetic ref unavailable or changed; lifecycle outcome unknown.' }] }); + assert.match(finished, /1 finished group \(outcome not observed\)/); + assert.doesNotMatch(finished, /Test group|synthetic-only|testing:/); }); test('parallel candidate cards retain exact members and exact candidate CI drilldown', () => { @@ -67,12 +86,15 @@ test('parallel candidate cards retain exact members and exact candidate CI drill checks: [{ name: 'test-' + i, status: i ? 'completed' : 'in_progress', conclusion: i ? 'failure' : '', url: 'https://github.com/o/r/actions/runs/' + i }], })); const html = render(q, [row], []); - assert.equal((html.match(/
/g) || []).length, 2); - assert.match(html, /Candidate required CI: pending/); - assert.match(html, /Candidate required CI: failed/); - assert.match(html, /outside current page\/filters/); + assert.equal((html.match(/
/g) || []).length, 2); + assert.match(html, /2 groups testing: checks running, checks failed/); + assert.match(html, /ham-native-badge-problem">checks failed/); + // The SHA is shortened to 12 characters; the full value stays in the title. + assert.match(html, /Test group candidate-on<\/code> · checks running/); + assert.match(html, /Test group candidate-tw<\/code> · checks failed/); + assert.match(html, /on another page/); assert.match(html, /https:\/\/github.com\/o\/r\/actions\/runs\/1/); - assert.match(render(q, [{ ...row, head: 'new-head' }]), /outside tracker snapshot or head changed/); + assert.match(render(q, [{ ...row, head: 'new-head' }]), /outside snapshot or head changed/); }); test('repo filters, unknown age, bounded outcomes and safe links remain explicit', () => { @@ -86,8 +108,9 @@ test('repo filters, unknown age, bounded outcomes and safe links remain explicit const html = render(q); assert.match(html, /entry-removed/); assert.match(html, /actual-merge/); - assert.match(html, /Removal\/destroyed is not proof/); - assert.match(html, /gaps after restart/); + assert.match(html, /2 receipts/); + // Receipts are behind the click; only a merged receipt means merged. + assert.match(html, /only a merged receipt means merged/); assert.equal(context.stageTrackerNativeLink('javascript:invalid', 'check'), 'check'); }); diff --git a/.github/scripts/test-claude-model-freshness.py b/.github/scripts/test-claude-model-freshness.py new file mode 100755 index 0000000000..bed60a6847 --- /dev/null +++ b/.github/scripts/test-claude-model-freshness.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +"""Hermetic tests for check-static-model-freshness.py --apply claude (#18754). + +No network and no real Claude Code: the catalog is a fixture and the pinned +CLI is a fake script that answers --version and the unauthenticated probe. + + python3 .github/scripts/test-claude-model-freshness.py +""" + +import importlib.util +import os +import re +import shutil +import stat +import subprocess +import sys +import tempfile +import unittest + +HERE = os.path.dirname(os.path.abspath(__file__)) +SCRIPT = os.path.join(HERE, "check-static-model-freshness.py") +FIXTURES = os.path.join(HERE, "testdata", "claude-model-freshness") + +spec = importlib.util.spec_from_file_location("freshness", SCRIPT) +freshness = importlib.util.module_from_spec(spec) +spec.loader.exec_module(freshness) + +LAYOUT = { + "cli_models.go.txt": freshness.CLI_MODELS_GO, + "backends-tokens.js.txt": freshness.BACKENDS_JS, + "cli-model-requirements.txt": freshness.REQUIREMENTS, + "Dockerfile.txt": freshness.DOCKERFILE, +} + +FAKE_CLAUDE = """#!/usr/bin/env python3 +import sys +args = sys.argv[1:] +if args == ["--version"]: + print({version!r} + " (Claude Code)") + sys.exit(0) +model = args[args.index("--model") + 1] +if {mark!r} and (model in {unknown!r} or model.startswith("claude-hive-probe")): + print('[claude-code:unrecognized_model] {{"model":"' + model + '","query_source":"sdk"}}') +print("Not logged in \\u00b7 Please run /login") +sys.exit(1) +""" + + +def read(path): + with open(path, encoding="utf-8") as fh: + return fh.read() + + +def load_catalog(name): + import json + with open(os.path.join(FIXTURES, name), encoding="utf-8") as fh: + return json.load(fh)["data"] + + +def go_list(src, name): + return freshness.go_string_list(src, name) + + +def js_values(src): + m = re.search(r"const CLAUDE_CLI_MODELS = \[\n(.*?)\n\s*\];", src, re.S) + return re.findall(r"value: '([^']+)'", m.group(1)) + + +class Base(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.mkdtemp(prefix="claude-freshness-test-") + self.root = os.path.join(self.tmp, "repo") + for fixture, rel in LAYOUT.items(): + dst = os.path.join(self.root, rel) + os.makedirs(os.path.dirname(dst), exist_ok=True) + shutil.copyfile(os.path.join(FIXTURES, fixture), dst) + + def tearDown(self): + shutil.rmtree(self.tmp, ignore_errors=True) + + def fake_claude(self, unknown=(), version="2.1.326", mark=True): + path = os.path.join(self.tmp, "claude") + with open(path, "w", encoding="utf-8") as fh: + fh.write(FAKE_CLAUDE.format(version=version, unknown=list(unknown), mark=mark)) + os.chmod(path, os.stat(path).st_mode | stat.S_IXUSR) + return path + + def snapshot(self): + return {rel: read(os.path.join(self.root, rel)) for rel in LAYOUT.values()} + + def run_cli(self, *extra, catalog="openrouter.json"): + accepted = os.path.join(self.tmp, "accepted.txt") + proc = subprocess.run([sys.executable, "-I", SCRIPT, "--apply", "claude", "--root", self.root, + "--catalog", os.path.join(FIXTURES, catalog), "--accepted-out", accepted, *extra], + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=120) + self.assertEqual(proc.returncode, 0, proc.stdout) + return proc.stdout, read(accepted).split() + + +class Candidates(Base): + def test_same_line_newer_only_dashed_and_labelled(self): + src = read(os.path.join(self.root, freshness.CLI_MODELS_GO)) + got = freshness.claude_candidates(src, load_catalog("openrouter.json")) + self.assertEqual([(c["cli_id"], c["source_id"], c["label"]) for c in got], [ + ("claude-fable-5-1", "anthropic/claude-fable-5.1", "Fable 5.1"), + ("claude-fable-5-2", "anthropic/claude-fable-5.2", "Fable 5.2"), + ("claude-haiku-5-5", "anthropic/claude-haiku-5.5", "Haiku 5.5"), + ]) + + def test_excluded(self): + src = read(os.path.join(self.root, freshness.CLI_MODELS_GO)) + ids = {c["cli_id"] for c in freshness.claude_candidates(src, load_catalog("openrouter.json"))} + for never in ("claude-mythos-5", "claude-mythos-5-5-preview", # limited access + "claude-sonnet-6", # expiration_date set + "claude-opus-4-1", # older than the list + "claude-opus-5-5", # already listed + "claude-opus-6-fast", "claude-3-7-sonnet"): # not a plain line id + self.assertNotIn(never, ids) + + def test_dotted_to_dashed(self): + self.assertEqual(freshness.norm("anthropic/claude-fable-5.2"), "claude-fable-5-2") + self.assertEqual(freshness.claude_line("claude-fable-5-2"), ("fable", (5, 2))) + self.assertIsNone(freshness.claude_line("claude-mythos-5")) + self.assertEqual(freshness.claude_label("haiku", (5, 5)), "Haiku 5.5") + + +class Apply(Base): + def test_dry_run_prints_every_edit_and_writes_nothing(self): + before = self.snapshot() + out, accepted = self.run_cli("--dry-run", "--claude-bin", self.fake_claude(unknown=["claude-fable-5-2"])) + self.assertEqual(accepted, ["claude-fable-5-1", "claude-haiku-5-5"]) + self.assertEqual(self.snapshot(), before, "a dry run must not write") + self.assertIn("**Dry run:** nothing was written.", out) + for cid, label in (("claude-fable-5-1", "Fable 5.1"), ("claude-haiku-5-5", "Haiku 5.5")): + section = out.split(f"#### {label} (`{cid}`")[1].split("####")[0].split("###")[0] + for want in (f"`claudePinnedCLIModels` gains `\"{cid}\"`", + f"`claudeStaticModels` gains `\"{cid}\"`", + f"`CLAUDE_CLI_MODELS` gains `{{ value: '{cid}', label: '{label}' }},`", + "`src/pkg/dashboard/static/index.html`: rebuilt with `make dashboard-gen`", + f"`claude {cid} 2.1.326`", + "`modelPrices` row from the OpenRouter quote, through `pricetable --add`"): + self.assertIn(want, section, f"{cid}: missing edit {want!r}\n{out}") + needs = out.split("### Needs a check against the Claude Code changelog (1)")[1] + self.assertIn("Fable 5.2 (`claude-fable-5-2`, from `anthropic/claude-fable-5.2`): the pinned Claude Code does not recognise this id", needs) + self.assertNotIn("#### Fable 5.2", out, "an id the pinned CLI does not recognise is never added") + + def test_apply_edits_in_sync_and_idempotent(self): + claude = self.fake_claude(unknown=["claude-fable-5-2"]) + _, accepted = self.run_cli("--claude-bin", claude) + self.assertEqual(accepted, ["claude-fable-5-1", "claude-haiku-5-5"]) + go = read(os.path.join(self.root, freshness.CLI_MODELS_GO)) + js = read(os.path.join(self.root, freshness.BACKENDS_JS)) + reqs = read(os.path.join(self.root, freshness.REQUIREMENTS)) + want = ["claude-opus-5-5", "claude-sonnet-5-5", "claude-fable-5-1", "claude-fable-5", + "claude-haiku-5-5", "claude-haiku-4-5-20251001", "opus", "sonnet", "haiku"] + self.assertEqual(go_list(go, "claudeStaticModels"), want) + self.assertEqual(go_list(go, "claudePinnedCLIModels"), want) + self.assertEqual(js_values(js), want, "JS list must stay an exact copy of claudeStaticModels") + self.assertEqual(go_list(go, "geminiStaticModels"), ["gemini-2.5-pro"], "other lists untouched") + self.assertIn(" { value: 'claude-fable-5-1', label: 'Fable 5.1' },\n", js) + self.assertIn('\t"claude-haiku-5-5",\n', go) + self.assertTrue(reqs.endswith("claude claude-fable-5-1 2.1.326\nclaude claude-haiku-5-5 2.1.326\n"), reqs) + + after = self.snapshot() + out, again = self.run_cli("--claude-bin", claude) + self.assertEqual(again, []) + self.assertEqual(self.snapshot(), after, "a second run with the same candidates changes nothing") + self.assertIn("### Added (0)", out) + + def test_insert_before_aliases_when_line_is_new_to_the_list(self): + lines = ['\t"claude-opus-5-5",', "\t// aliases", '\t"opus",'] + got = freshness.insert_listed(lines, "claude-haiku-5-5", lambda ind: f'{ind}"claude-haiku-5-5",', freshness.GO_ID) + self.assertEqual(got, ['\t"claude-opus-5-5",', '\t"claude-haiku-5-5",', "\t// aliases", '\t"opus",']) + self.assertIsNone(freshness.insert_listed(got, "claude-haiku-5-5", lambda ind: "", freshness.GO_ID)) + + def test_unreliable_probe_adds_nothing(self): + before = self.snapshot() + out, accepted = self.run_cli("--claude-bin", self.fake_claude(mark=False)) + self.assertEqual(accepted, []) + self.assertEqual(self.snapshot(), before) + self.assertIn("probe controls failed", out) + self.assertIn("### Needs a check against the Claude Code changelog (3)", out) + + def test_wrong_version_adds_nothing(self): + before = self.snapshot() + out, accepted = self.run_cli("--claude-bin", self.fake_claude(version="2.1.311")) + self.assertEqual(accepted, []) + self.assertEqual(self.snapshot(), before) + self.assertIn("not the pinned `2.1.326`", out) + + def test_no_binary_adds_nothing(self): + before = self.snapshot() + out, accepted = self.run_cli() + self.assertEqual(accepted, []) + self.assertEqual(self.snapshot(), before) + self.assertIn("no pinned Claude Code binary", out) + + def test_no_candidates_no_edits(self): + before = self.snapshot() + out, accepted = self.run_cli("--claude-bin", self.fake_claude(), catalog="openrouter-current.json") + self.assertEqual(accepted, []) + self.assertEqual(self.snapshot(), before) + self.assertIn("Gate: no candidates.", out) + self.assertNotIn("Needs a check", out) + + +class Report(unittest.TestCase): + def test_compare_list_shared_with_report(self): + by_vendor = freshness.index_catalog(load_catalog("openrouter.json")) + not_found, newer = freshness.compare_list(["claude-fable-5", "claude-opus-9"], "anthropic", by_vendor) + self.assertEqual(not_found, ["claude-opus-9"]) + self.assertIn(("anthropic", "claude-fable-5-2"), newer) + self.assertIn(("anthropic", "claude-fable-5-1"), newer) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/.github/scripts/testdata/claude-model-freshness/Dockerfile.txt b/.github/scripts/testdata/claude-model-freshness/Dockerfile.txt new file mode 100644 index 0000000000..b80276b9c0 --- /dev/null +++ b/.github/scripts/testdata/claude-model-freshness/Dockerfile.txt @@ -0,0 +1,3 @@ +FROM scratch +ARG CODEX_VERSION=0.169.0 +ARG CLAUDE_CODE_VERSION=2.1.326 diff --git a/.github/scripts/testdata/claude-model-freshness/backends-tokens.js.txt b/.github/scripts/testdata/claude-model-freshness/backends-tokens.js.txt new file mode 100644 index 0000000000..4338a9e297 --- /dev/null +++ b/.github/scripts/testdata/claude-model-freshness/backends-tokens.js.txt @@ -0,0 +1,13 @@ + // Miniature of backends-tokens.js for test-claude-model-freshness.py. + const CLAUDE_CLI_MODELS = [ + { value: 'claude-opus-5-5', label: 'Opus 5.5' }, + { value: 'claude-sonnet-5-5', label: 'Sonnet 5.5' }, + { value: 'claude-fable-5', label: 'Fable 5' }, + { value: 'claude-haiku-4-5-20251001', label: 'Haiku 4.5' }, + { value: 'opus', label: 'Opus (alias)' }, + { value: 'sonnet', label: 'Sonnet (alias)' }, + { value: 'haiku', label: 'Haiku (alias)' }, + ]; + const GEMINI_CLI_MODELS = [ + { value: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro' }, + ]; diff --git a/.github/scripts/testdata/claude-model-freshness/cli-model-requirements.txt b/.github/scripts/testdata/claude-model-freshness/cli-model-requirements.txt new file mode 100644 index 0000000000..2a2675d972 --- /dev/null +++ b/.github/scripts/testdata/claude-model-freshness/cli-model-requirements.txt @@ -0,0 +1,2 @@ +# +claude claude-sonnet-5-5 2.1.284 diff --git a/.github/scripts/testdata/claude-model-freshness/cli_models.go.txt b/.github/scripts/testdata/claude-model-freshness/cli_models.go.txt new file mode 100644 index 0000000000..e1a2937d69 --- /dev/null +++ b/.github/scripts/testdata/claude-model-freshness/cli_models.go.txt @@ -0,0 +1,31 @@ +package dashboard + +// Miniature of src/pkg/dashboard/cli_models.go for +// test-claude-model-freshness.py: the two Claude lists --apply claude edits. + +var claudeStaticModels = []string{ + "claude-opus-5-5", + "claude-sonnet-5-5", + "claude-fable-5", + "claude-haiku-4-5-20251001", + // Bare aliases the Claude CLI also accepts (see claudeAlwaysIncludeModels). + "opus", + "sonnet", + "haiku", +} + +var geminiStaticModels = []string{ + "gemini-2.5-pro", +} + +// claudePinnedCLIModels is the closed model set accepted by the Claude Code +// version pinned in src/Dockerfile. +var claudePinnedCLIModels = []string{ + "claude-opus-5-5", + "claude-sonnet-5-5", + "claude-fable-5", + "claude-haiku-4-5-20251001", + "opus", + "sonnet", + "haiku", +} diff --git a/.github/scripts/testdata/claude-model-freshness/openrouter-current.json b/.github/scripts/testdata/claude-model-freshness/openrouter-current.json new file mode 100644 index 0000000000..c0eb7f9fc6 --- /dev/null +++ b/.github/scripts/testdata/claude-model-freshness/openrouter-current.json @@ -0,0 +1,8 @@ +{ + "data": [ + {"id": "anthropic/claude-opus-5.5"}, + {"id": "anthropic/claude-fable-5"}, + {"id": "anthropic/claude-haiku-4.5"}, + {"id": "anthropic/claude-mythos-6"} + ] +} diff --git a/.github/scripts/testdata/claude-model-freshness/openrouter.json b/.github/scripts/testdata/claude-model-freshness/openrouter.json new file mode 100644 index 0000000000..811ffa5b0e --- /dev/null +++ b/.github/scripts/testdata/claude-model-freshness/openrouter.json @@ -0,0 +1,19 @@ +{ + "data": [ + {"id": "anthropic/claude-opus-5.5"}, + {"id": "anthropic/claude-opus-4.1"}, + {"id": "anthropic/claude-fable-5"}, + {"id": "anthropic/claude-fable-5.1"}, + {"id": "anthropic/claude-fable-5.2"}, + {"id": "anthropic/claude-fable-5.2:batch"}, + {"id": "anthropic/claude-haiku-5.5"}, + {"id": "anthropic/claude-mythos-5"}, + {"id": "anthropic/claude-mythos-5.5-preview"}, + {"id": "anthropic/claude-sonnet-6", "expiration_date": "2026-12-01"}, + {"id": "anthropic/claude-opus-6-fast"}, + {"id": "anthropic/claude-3.7-sonnet"}, + {"id": "~anthropic/claude-opus-latest"}, + {"id": "google/gemini-9-pro"}, + {"id": null} + ] +} diff --git a/.github/workflows/claude-model-freshness.yml b/.github/workflows/claude-model-freshness.yml new file mode 100644 index 0000000000..8617fe6fbf --- /dev/null +++ b/.github/workflows/claude-model-freshness.yml @@ -0,0 +1,255 @@ +name: Claude model freshness + +# Weekly PR that adds new Claude models to the dashboard's lists and price +# table once the Claude Code version pinned in src/Dockerfile accepts them +# (#18754). Adding a model used to take five hand edits nobody was told to +# make, so the lists fell behind (Fable 5.1/5.2 and Haiku 5.5, #18753). +# +# .github/scripts/claude-model-freshness.sh does the work: +# - candidates: Claude ids on OpenRouter's public catalogue +# (https://openrouter.ai/api/v1/models, no key) newer than the lists' +# newest of the same line (Fable, Opus, Sonnet, Haiku) — the comparison +# static-model-freshness.yml reports, via the same script. Mythos and ids +# OpenRouter has scheduled for withdrawal are never candidates; +# - gate: each candidate is put to the PINNED Claude Code, installed the way +# the image installs it and run unauthenticated (empty HOME, no key). The +# CLI prints an `unrecognized_model` diagnostic for an id its built-in +# model table does not know, before it stops at "Not logged in"; two +# controls (a listed id, a made-up id) must behave as expected or nothing +# is added. The "version X or newer is required" refusal (#8417) comes +# from the API after login, so it cannot be probed without credentials. +# A candidate not shown to be accepted is listed under "needs a check" +# and never added; +# - edits per accepted model: claudePinnedCLIModels (the closed allowlist, +# #8418), claudeStaticModels, CLAUDE_CLI_MODELS with a label, +# static/index.html via `make dashboard-gen`, a cli-model-requirements.txt +# line at the pin (#9805), and a modelPrices row from `pricetable --add`, +# which applies the price refresh's plausibility rules and leaves out (and +# reports) a quote that fails them. +# +# Its own workflow rather than a job in static-model-freshness.yml (which only +# needs issues: write) or price-table-refresh.yml (which reprices existing +# rows on its own branch): the write permissions stay on the job that opens +# this PR, and a model addition and a repricing are reviewed separately. +# +# One PR on bot/claude-model-freshness, force-pushed and edited in place by +# later runs until merged; no candidates accepted means no branch and no PR. +# Never auto-merged: model and price changes reach every hive, so it carries +# needs-human. Credentials as in price-table-refresh.yml: TOPUP_PUSH_TOKEN +# when set (so the PR gets normal pull_request CI runs), else GITHUB_TOKEN. +# +# On a pull_request touching this machinery the selftest job runs the +# hermetic tests and a DRY RUN of the whole pipeline against the live +# catalogue and the real pin; it has read-only permissions and opens nothing. + +on: + schedule: + - cron: '47 7 * * 1' + workflow_dispatch: + inputs: + base: + description: 'Branch whose lists to update and to open the PR against' + type: string + default: v5 + dry_run: + description: 'Print every edit; do not push a branch or open a PR' + type: boolean + default: false + pull_request: + paths: + - '.github/workflows/claude-model-freshness.yml' + - '.github/scripts/claude-model-freshness.sh' + - '.github/scripts/check-static-model-freshness.py' + - '.github/scripts/test-claude-model-freshness.py' + - '.github/scripts/testdata/claude-model-freshness/**' + - 'src/internal/tools/pricetable/**' + +permissions: + contents: read + +concurrency: + group: claude-model-freshness-${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.base || 'v5' }} + cancel-in-progress: false + +env: + BASE_BRANCH: ${{ inputs.base || 'v5' }} + HEAD_BRANCH: bot/claude-model-freshness + +jobs: + selftest: + name: self-test and dry run + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Hermetic tests (no network) + run: | + set -euo pipefail + bash -n .github/scripts/claude-model-freshness.sh + python3 .github/scripts/test-claude-model-freshness.py + + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version-file: src/go.mod + cache-dependency-path: | + src/go.sum + src/crux/go.sum + + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '22' + + - name: Dry run against the live catalogue and the pinned CLI + env: + DRY_RUN: '1' + run: | + set -euo pipefail + bash .github/scripts/claude-model-freshness.sh "$RUNNER_TEMP/cmf" + cat "$RUNNER_TEMP/cmf/report.md" >> "$GITHUB_STEP_SUMMARY" + cat "$RUNNER_TEMP/cmf/report.md" + test -z "$(git status --porcelain)" || { echo "::error::the dry run changed the working tree"; git status --short; exit 1; } + + refresh: + name: add new Claude models + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ env.BASE_BRANCH }} + fetch-depth: 0 + token: ${{ secrets.TOPUP_PUSH_TOKEN != '' && secrets.TOPUP_PUSH_TOKEN || github.token }} + + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version-file: src/go.mod + cache-dependency-path: | + src/go.sum + src/crux/go.sum + + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '22' + + - name: Find, gate and apply new Claude models + id: apply + env: + DRY_RUN: ${{ inputs.dry_run == true && '1' || '' }} + run: | + set -euo pipefail + bash .github/scripts/claude-model-freshness.sh "$RUNNER_TEMP/cmf" + cat "$RUNNER_TEMP/cmf/report.md" >> "$GITHUB_STEP_SUMMARY" + if [ -s "$RUNNER_TEMP/cmf/accepted.txt" ] && [ -n "$(git status --porcelain)" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + fi + echo "pin=$(cat "$RUNNER_TEMP/cmf/pin.txt")" >> "$GITHUB_OUTPUT" + echo "ids=$(paste -sd, "$RUNNER_TEMP/cmf/accepted.txt")" >> "$GITHUB_OUTPUT" + + - name: Nothing to do + if: steps.apply.outputs.changed != 'true' + env: + DRY_RUN: ${{ inputs.dry_run == true && '1' || '' }} + run: | + if [ "$DRY_RUN" = "1" ]; then + echo "Dry run: the edits above were printed; no branch or PR is created." + else + echo "No Claude model to add; no branch, no PR." + fi + cat "$RUNNER_TEMP/cmf/report.md" + + - name: Find the open PR + if: steps.apply.outputs.changed == 'true' + id: existing + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + number="$(gh pr list --repo "$GITHUB_REPOSITORY" --base "$BASE_BRANCH" --head "$HEAD_BRANCH" \ + --state open --json number --jq '.[0].number // empty')" + echo "number=${number}" >> "$GITHUB_OUTPUT" + [ -z "$number" ] || echo "will refresh open PR #${number}" + + - name: Commit the additions + if: steps.apply.outputs.changed == 'true' + env: + IDS: ${{ steps.apply.outputs.ids }} + PIN: ${{ steps.apply.outputs.pin }} + PR_TOKEN: ${{ secrets.TOPUP_PUSH_TOKEN }} + run: | + set -euo pipefail + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -B "$HEAD_BRANCH" + # One fragment per run; drop any earlier unmerged one on this branch. + while IFS= read -r -d '' fragment; do + if ! git cat-file -e "origin/${BASE_BRANCH}:${fragment}" 2>/dev/null; then + git rm -q -- "$fragment" + fi + done < <(git ls-files -z -- 'changelog.d/added-claude-models-*.md') + date="$(date -u +%Y-%m-%d)" + printf -- '- The Claude model dropdowns and price table now include %s, which the pinned Claude Code %s accepts.\n' \ + "$(printf '%s' "$IDS" | sed 's/,/, /g')" "$PIN" > "changelog.d/added-claude-models-${date}.md" + git add src/pkg/dashboard/cli_models.go src/pkg/dashboard/static-src/js/backends-tokens.js \ + src/pkg/dashboard/static/index.html src/scripts/cli-model-requirements.txt \ + src/pkg/tokens/pricing.go changelog.d + { + echo "✨ dashboard: add Claude models ${IDS}" + echo + echo "Automated by claude-model-freshness.yml: each id is newer than the" + echo "Claude lists on OpenRouter and recognised by the pinned Claude Code" + echo "${PIN}; see the PR body for the gate and the price quotes." + } > "$RUNNER_TEMP/commit-msg.txt" + git commit -s -F "$RUNNER_TEMP/commit-msg.txt" + # Same reasoning as price-table-refresh.yml and #11412 in + # cli-pin-bump.yml: a PAT-opened PR squashes under the PAT owner, + # so add their sign-off too. + if [ -n "$PR_TOKEN" ]; then + owner="$(GH_TOKEN="$PR_TOKEN" gh api user --jq '"\(.login) \(.id)"')" + login="${owner% *}" + id="${owner##* }" + if [ -z "$login" ] || [ -z "$id" ] || [ "$login" = "$id" ]; then + echo "::error::Could not resolve the TOPUP_PUSH_TOKEN owner; a PR it opens would squash to a mismatched sign-off." + exit 1 + fi + git commit --amend --no-edit \ + --trailer "Signed-off-by: ${login} <${id}+${login}@users.noreply.github.com>" + fi + git push --force origin "$HEAD_BRANCH" + + - name: Open or refresh the PR + if: steps.apply.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.TOPUP_PUSH_TOKEN != '' && secrets.TOPUP_PUSH_TOKEN || github.token }} + IDS: ${{ steps.apply.outputs.ids }} + EXISTING: ${{ steps.existing.outputs.number }} + run: | + set -euo pipefail + title="✨ dashboard: add Claude models ${IDS}" + { + cat "$RUNNER_TEMP/cmf/report.md" + echo + echo "### Review" + echo + echo "- [ ] Each added id is in the Claude Code changelog for the pinned version or earlier" + echo "- [ ] Each new price row matches Anthropic's price page (OpenRouter mirrors list price but can lag or round)" + echo "- [ ] Anything under *Needs a check* or *Held for review* is followed up by hand" + echo + echo "Generated by [claude-model-freshness](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) with \`.github/scripts/claude-model-freshness.sh\`; the branch is force-pushed by later runs until merged. Not auto-merged: a human reviews model and price changes." + } > "$RUNNER_TEMP/pr-body.md" + if [ -n "$EXISTING" ]; then + gh pr edit "$EXISTING" --repo "$GITHUB_REPOSITORY" --title "$title" --body-file "$RUNNER_TEMP/pr-body.md" --add-label needs-human + echo "refreshed PR #${EXISTING}" + else + gh pr create --repo "$GITHUB_REPOSITORY" --base "$BASE_BRANCH" --head "$HEAD_BRANCH" \ + --title "$title" --body-file "$RUNNER_TEMP/pr-body.md" --label needs-human + fi diff --git a/.github/workflows/cli-pin-bump.yml b/.github/workflows/cli-pin-bump.yml index ccd98e1053..b445e0509f 100644 --- a/.github/workflows/cli-pin-bump.yml +++ b/.github/workflows/cli-pin-bump.yml @@ -64,6 +64,8 @@ on: - '.github/workflows/cli-pin-bump.yml' - 'src/scripts/cli-pin-bump.sh' - 'src/scripts/test-cli-pin-bump.sh' + - 'src/scripts/cli-pin-signoff.sh' + - 'src/scripts/test-cli-pin-signoff.sh' - 'src/scripts/check-cli-model-lists.sh' - 'src/scripts/test-check-cli-model-lists.sh' - 'src/scripts/cli-model-requirements.txt' @@ -95,6 +97,9 @@ jobs: bash -n src/scripts/test-cli-pin-bump.sh bash -n .github/scripts/check-bob-launch-flags.sh bash src/scripts/test-cli-pin-bump.sh + bash -n src/scripts/cli-pin-signoff.sh + bash -n src/scripts/test-cli-pin-signoff.sh + bash src/scripts/test-cli-pin-signoff.sh bash -n src/scripts/check-cli-model-lists.sh bash -n src/scripts/test-check-cli-model-lists.sh bash src/scripts/test-check-cli-model-lists.sh @@ -279,8 +284,22 @@ jobs: echo "::error::Could not resolve the TOPUP_PUSH_TOKEN owner; a PR it opens would squash to a mismatched-signoff (#11412)." exit 1 fi - git commit --amend --no-edit \ - --trailer "Signed-off-by: ${login} <${id}+${login}@users.noreply.github.com>" + # The squash is authored under the owner's PRIMARY email, which is + # not the noreply one, so the DCO app flagged every bump on the + # v5 -> v6 top-up (#18697). Sign off for each address GitHub may + # attribute (public profile email, then the primary from + # user/emails when the token may read it; best-effort). + emails=() + pub="$(GH_TOKEN="$PR_TOKEN" gh api user --jq '.email // empty' 2>/dev/null || true)" + [ -z "$pub" ] || emails+=("$pub") + while IFS= read -r em; do + [ -z "$em" ] || emails+=("$em") + done < <(GH_TOKEN="$PR_TOKEN" gh api user/emails --jq '.[] | select(.primary) | .email' 2>/dev/null || true) + args=() + while IFS= read -r t; do + [ -z "$t" ] || args+=(--trailer "$t") + done < <(bash src/scripts/cli-pin-signoff.sh "$login" "$id" "${emails[@]}") + git commit --amend --no-edit "${args[@]}" fi git push --force-with-lease origin "$HEAD_BRANCH" diff --git a/CHANGELOG.md b/CHANGELOG.md index c9748f52ba..92becf6a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,265 @@ Hive did not historically maintain a complete changelog. This file starts a prag - The contributor lane stops posting `/ok-to-test` on a fork PR once the merge bot refuses the App, in cncf/prow-github-actions' wording too. Only upstream Prow's "Cannot trigger testing until a trusted user" was recognised, so repositories that run Prow commands through cncf/prow-github-actions ("Cannot /ok-to-test because Error: is not a reviewer or approver …") got the command again on every new head, refused every time, and never got the needs-human note asking a person to post it. A command for an earlier head that left no `ok-to-test` label and no presubmit after 10 minutes now also counts as refused, whatever the bot said. The same-repo held-runs path reads the same refusal forms. - **An unverified "already done" verdict no longer leaves `hive/already-done` on the issue.** The contributor relay applied the label on reason text alone ("already resolved"), and seconds later the hub commented that the issue "is not labelled `hive/already-done`" because nothing could be verified, leaving the label on, so the issue dropped out of the offer queue with no maintainer check (projectbluefin/utah-packages#1175). The relay now labels only when the reason cites a PR, a PR URL or a commit, and when the citation does not verify the hub removes a label the hive added since the task was dispatched; a label a person added stays. +## 2026-11-18 (v5.318.0) + +### Added + +- Added `GET /api/hub/v1`, the discovery document of the hub registration protocol v1 (rollout step 1 of [#18642](https://github.com/hivecommons/hive/issues/18642)): it lists the operations, limits (`max_repos`, `max_per_user`, `expiry`, `key_rotation_overlap`) and the ownership proof method (`hub-session-token`), and answers `404` while `HIVE_HUB_SELFSERVICE_REGISTRATION` is off. The per-registration repo cap is now configurable with `HIVE_HUB_SELFSERVICE_MAX_REPOS` (default `20`, clamped to `500`); the legacy `/api/hub/selfservice/*` responses are unchanged. + +### Fixed + +- Remember per repository that Prow refuses the App's `/ok-to-test`, so a new fork PR there gets the needs-human note instead of a first command Prow rejects; the memory is re-derived from the repository's comments after a restart and clears when the `hive-ok-to-test` workflow is installed (#18608). +- Give the proxy's `agent could not be identified` blocked-write WARN its own `proxy_writer_unidentified` operator-action class (no longer a generic `unclassified_error_repeated` fleet bug) and log why attribution failed (`reason`: `no_uid_map`, `shared_uid_mode`, `no_peer_port`, `port_not_in_socket_table`, `uid_not_in_map`); unidentified writers are still blocked as ADVISORY. +- Report transient proxy upstream dial failures to GitHub hosts only when they persist over an hour, under the operator-action class `proxy_upstream_degraded`, and log an `error_class` (`timeout`, `refused`, `dns`, `unreachable`, `reset`, `tls`) with the failing host. +- A contributor PR the hive is going to adopt anyway (author relay offline or unregistered, adoption enabled and unblocked) no longer gets a "back in your court" nudge followed by an adoption note 16-39 minutes later: the nudge is recorded (the adoption clock still runs, the relay still gets its task) but its GitHub comment is withheld, so the author gets one notification, and it is posted if the adoption stops being certain; an online author keeps the nudge and the full grace, and the ladder's immediate-supersede rung fires only for an unreachable author, the same condition. (#18872). +- Publish benchmark records in byte-bounded batches (about 384 KB) with a watermark advanced per accepted batch, halve and retry a batch the hub answers with 413 (skipping a single record that still gets 413 once another batch has landed), and include the truncated hub response body in `benchmarks.last_error` so a proxy 413 is distinguishable from the hub handler. +- Customers tag chips now render as pills; they were bare unstyled text because the class they used had no CSS (#18882). + +## 2026-11-18 (v5.317.1) + +### Fixed + +- The CLI pin-bump workflow now signs its commit off for every email GitHub may attribute the squash to (the `TOPUP_PUSH_TOKEN` owner's public and primary addresses, not only the noreply one), so the DCO app no longer flags image-bump commits and blocks v5 -> v6 top-ups (#18697). +- Never auto-close a decomposed parent that a person reopened after a hive auto-close or that is labelled epic/hold, and add the per-repo `repos..parent_autoclose` (`true`/`epics_too`/`false`) switch (#18869). + +## 2026-11-18 (v5.317.0) + +### Added + +- Hold unacknowledged agent strategist and outreach proposals before admission, with configurable lanes and an explicit opt-out. + +## 2026-11-18 (v5.316.0) + +### Added + +- Support Kubernetes node affinity for sandbox Jobs, allowing operators to select eligible nodes and exclude unhealthy hosts. + +## 2026-11-18 (v5.315.0) + +### Added + +- **Governor PRs by model: what each model's PRs cost the hive to review (#18717).** Each model bucket in `GET /api/governor/pr-models` now carries `hive_cost` (`usd`, `launches`, `prs_with_cost`, `usd_per_merged_pr`): the hive's own estimated spend on reviewing, adjudicating and fixing that model's PRs, summed from the PR refs' `share_usd` in the cached launch-cost snapshot (#12128). `usd` is `null`, not `0`, when none of the model's PRs had attributed usage, and `hive_cost` is omitted while the snapshot is not ready. A top-level `hive_cost_coverage` reports the launch-cost window, the unattributed and backend-unsupported spend, and the estimate disclaimer. The card shows the figure in each row's tooltip with a coverage note under the header. It reads only the cached snapshot: no new token scanning or GitHub calls, and existing fields are unchanged. + +## 2026-11-18 (v5.314.0) + +### Added + +- **Governor PRs by model says why unmerged PRs were closed (#18719).** Each `/api/governor/pr-models` bucket gains `closed_unmerged_reasons` (`superseded`, `duplicate`, `other`), which always sum to `closed_unmerged`. A PR counts as superseded when it carries `hive/superseded` or another PR in the same repository says `Supersedes #N` for it; duplicate when it has a `duplicate` label; anything else is other. Hover a row to see the split after the closed-unmerged count. Closed attributed PR records now keep their `Supersedes #N` number too, read from the body the scan already fetches, so no new GitHub calls. Existing fields, the bar, merge rate and rank are unchanged. +- A weekly workflow (`claude-model-freshness.yml`) now opens one `needs-human` PR adding new Claude models to the dashboard's model lists, `cli-model-requirements.txt` and the price table, once the Claude Code version pinned in the image accepts them; models the pinned CLI does not recognise are listed for a manual check instead of added, and price rows come only through the price refresh's plausibility rules (`pricetable --add`) (#18754). + +### Fixed + +- Kubernetes: a reload that starts from the ConfigMap seed (a first boot or reprovision on a read-only ConfigMap mount, `hive config-check`, a watcher reload of the seed path) dropped the dashboard-saved `review` block (`combined_perspectives`, `require_labels`, `perspectives_source`) and `agent_sandbox` block (`image`, `job.*`), the same shape as the cadence and work-source losses. The dashboard overlay now wins for both blocks when it carries them, and a silent overlay leaves the seed's untouched. `variables.security` stays seed-only (#18804). +- Kubernetes: a `paused: true` or `sandbox:` block an operator put in `/data/agent-configs/.yaml` was replaced by the dashboard overlay's older copy of the same agent on every load that applies the overlay, so it never took effect. Those two fields are now carried forward from the agent file (#18804). + +## 2026-11-18 (v5.313.0) + +### Added + +- The Activity monitor's merge banner now shows the date and time it merged ("11/17 4:12 PM EST") on its head line, in the Display timezone. The time used to sit at the end of the title line, where a long title's ellipsis hid it, and it was the moment the tab noticed the merge rather than the ledger's `merged_at`. Settings → Appearance gains a **Time format** choice (browser locale, 12-hour or 24-hour) that applies to every dashboard time. + +### Fixed + +- **Sessions: a Codex or OpenCode login refreshed inside a session is adopted back into the shared login, so the agents are no longer left on a dead one** ([#18740](https://github.com/hivecommons/hive/issues/18740)). A session gets a full copy of `.codex/auth.json` and `.local/share/opencode/auth.json`. Codex's ChatGPT login and an OpenCode OAuth provider entry rotate their refresh token on refresh, so a session that refreshed its copy held the only valid login: the agents, which link to the shared file, failed their next refresh and fell to a login prompt, and deleting the session deleted the login. The hive now adopts a strictly newer login from a session HOME into the shared file, the same safety net #18728 added for Claude: at boot, on every credential-bridge poll, at a session's start or resume, and before a session is deleted (a newer login that cannot be adopted keeps the session). Newer means the session's file was written after the shared one and, for Codex, records a later `last_refresh` with a different refresh token; for OpenCode, per provider entry, a later `expires` with a different refresh token. Only the refreshed OpenCode entries are replaced; other entries, API-key logins and providers the shared file does not hold are left alone. The replaced file is kept as `auth.json.stale-`, and `user_session_login_adopted` records the session, trigger, vendor and file, never token material. A session still holds a copy that can refresh (whether each CLI accepts a login without its refresh token is unverified), so a session and an agent refreshing in the same few seconds converge on the newer login at the next poll rather than being prevented. + +## 2026-11-17 (v5.312.0) + +### Added + +- **Evidence: change failures per model (#18720).** `GET /api/evidence/summary` adds `outcomes_by_author_model`, the same outcome and change-failure counts as `outcomes_by_author_kind` keyed by the PR author's canonical model (the ids the PRs-by-model card uses; `human` for a person's PR, `unknown` for an agent PR with no recorded model). The Evidence card's **Outcome by author kind** panel shows it as a table: model, `n`, merged, reverted and re-opened within 14 days, and the change-failure rate, so a model whose merged work keeps getting undone stands out from one in the same family whose work sticks. It reuses the existing revert and re-open detection; existing fields are unchanged. + +### Fixed + +- Dashboard Restart on a sandboxed (`runtime: job`) agent no longer launches an interactive tmux session on the hive pod; it refuses and the next kick starts a Job (#18826). + +## 2026-11-17 (v5.311.0) + +### Added + +- Spend by model and contributor run stats by model now carry `canonical_model`, the same folded model id the Governor's PRs-by-model card uses, so `claude-opus-5-5`, `anthropic/claude-opus-5-5` and `claude-opus-5.5` can be lined up across all three views. `/api/cost` `estimated.by_model[]` and every `/api/contribute/run-stats` and `/api/contribute/run-stats/models` row gain the field; spend stays one row per raw model, since prices are per raw model. Both run-stats endpoints accept an optional `group=canonical` that merges spellings into one row (runs summed, rates recomputed from the summed counts) with `raw_models[]` keeping each spelling's run count; without it the rows are unchanged. The Cost card's by-model list and the contributor wall's model evidence show the canonical id, with the reported spelling in a tooltip (#18718). + +## 2026-11-17 (v5.310.0) + +### Added + +- Governor PRs by model now shows, in each model's tooltip, a per-repository breakdown and a weekly trend (30d and all-time views), so a model's rework can be traced to one hard repository and its improvement over time is visible without diffing windows. `GET /api/governor/pr-models` adds `repos[]` and `weeks[]` to each bucket; existing fields are unchanged (#18716). +- Governor **PRs by model** can list one model's pull requests: a **▸ PRs** button on each model row opens that model's PRs in the window (outcome, review rounds, fix attempts, first pass, author agent and backend, each linking to GitHub), loaded on demand from the new optional `model=` parameter on `GET /api/governor/pr-models`. The parameter accepts any raw spelling of the model, returns up to 200 PRs most reworked first with `prs_truncated` past that, and leaves the response unchanged when omitted (#18722). + +### Fixed + +- **The required `PR Type` and `PR Issue` checks always conclude, and the PR Verifier goes red when it cannot record them** (#18764). The pinned verifier image created each check `in_progress` and then updated it with the verdict; when GitHub answered that update with 404 (#18667), the required checks stayed `in_progress` for ever, Tide reported "Jobs PR Issue, PR Type have not succeeded", and the `verify PR contents` job still went green because the image step was `continue-on-error`. The workflow now computes both verdicts in-repo (`.github/scripts/pr-verifier.cjs`, reusing the existing port of the upstream v0.4.3 title rules, with the same check names, output titles and summaries) and records each check with one create call that is already completed — nothing is ever left in progress. A title the rules reject is still a failed `PR Type`/`PR Issue` check with a green wrapper job; a result that cannot be recorded now fails `verify PR contents` with the reason, after posting a completed `failure` check that says so. No image is pulled any more, so the job runs on the ordinary runner pool instead of a native ARM64 runner. To recover a PR whose checks are already stuck, add or remove any label on it, or for a same-repo PR dispatch `pr-verifier.yml` on its branch with its `pr_number`, so a fresh completed pair lands on its head (re-running an old run re-runs the old workflow). +- A slow GHCR token endpoint (request timeout) no longer files a fleet self-report issue; the "GHCR token request failed" WARN stays in local logs and resolvers keep serving their previous answer. Other GHCR failures (DNS, auth, bad responses) remain reportable (#18824). + +## 2026-11-17 (v5.309.0) + +### Added + +- Governor PRs by model now shows rework per backend and a per-effort split in each row's tooltip: every raw `sources[]` entry gains open/closed-unmerged counts, first-pass merged and rate, and average review rounds and fix attempts, each bucket gains an `efforts[]` breakdown read from the attribution trailer's `effort=` value, and the PR snapshot records it as `hive_effort` (#18715). + +### Fixed + +- Fleet-report "also seen" sightings no longer add a new comment to the issue on every join. Each poster (the hub relay, or a spoke filing directly) now keeps one `` comment per issue, with one section per hive, newest first, and edits it in place. Edits do not notify watchers, and the issue body's Affected hives block still counts every sighting. Part of the spam reduction work in #18450 (#18608). +- **The claude model dropdown now offers Fable 5.2, Fable 5.1, Haiku 5.5 and the `fable` alias, and their spend is priced exactly** ([#18753](https://github.com/hivecommons/hive/issues/18753)). The pinned Claude Code 2.1.326 accepts all four, but the dashboard's allowlist, its static fallback and the browser's first-paint list stopped at Fable 5 and Haiku 4.5, so a live Anthropic catalog that listed the newer models was cut back to the old ones. The price table gains Fable 5.2 ($8 in / $40 out, $0.20 cache read, $10 cache write) and Haiku 5.5 ($0.10 / $0.50, $0.01, $0.125) from Anthropic's pricing page, so their spend is no longer a tier guess. Haiku 5.5 is priced at its base rate for prompts up to 100,000 tokens; longer prompts bill higher and are undercounted. +- The Customers section is laid out like the Inbox and Calendar: each person is a card with an initial or source icon, the name as the title, a muted line, tags as chips and grouped actions that wrap under the content on narrow screens, with no sideways scrolling and long keys cut with a tooltip. "me" is a badge, "0 goals" is no longer printed on every row, and the evidence behind a suggestion sits under "Why is this suggested?" as readable links (at most five). Suggested people are grouped by source with "Show N more", and accepting, dismissing or answering a "Same person?" question keeps the group open, its expansion and the scroll position, and moves the focus to the next suggestion. A suggestion can now be added to an existing customer ("Add to existing..." on a suggestion, "Add a suggested person here" on a profile); it reuses the merge, so Undo merge takes it back (#18816). +- Customers discovery no longer suggests people who are already customers or who are not people. A hive user whose access-list name is a bare GitHub login (what a device-flow sign-in produces) is now linked to that GitHub login, so they are not suggested again, and a suggestion that points at an identity a customer owns expires. Calendar group and room addresses, mailing-list addresses, no-reply and service mailboxes and the hive's own `hive@` address are never suggested, and those already stored expire on the next sweep (#18816). + +## 2026-11-17 (v5.308.0) + +### Added + +- **Contributor run stats by model now say why runs failed.** Each model row of `GET /api/contribute/run-stats/models` (and the `models` array of `GET /api/contribute/run-stats`) gains `abandoned`, `scenarios` (the same scenario counts run-stats already gives per backend, summing to `runs`) and `failure_kinds` (`environment`, `task`, `unspecified`, summing to the failed runs). A high failure rate can now be read as "mostly the contributors' environments" or "mostly the work". `failure_rate` and the other existing fields are unchanged. On the contributor wall, hovering a post's "failed" model-evidence figure shows the split, with the labels the run history uses. (#18721) + +## 2026-11-17 (v5.307.1) + +### Fixed + +- A paused agent no longer shows an empty slot where its resume button belongs: the focused agent panel kept the toggle it first rendered (its fast path never added one, and the panel ignored the role), so a panel opened before the viewer's role settled stayed without resume until reload. Agent cards, the detail panel and the cadence table now repaint when the role settles, and a viewer below owner (or one still being checked) sees the pause/resume control disabled with "Needs the owner role" or "Checking your access..." instead of nothing. A paused sandboxed agent offers plain resume rather than "start & resume" (it has no session to start), and the cadence table shows one `paused` chip with its reason on hover instead of repeating it in every mode column (#18813). +- Sandbox Jobs no longer lose their service account's `imagePullSecrets`: the Job pod now carries the deduplicated union of hive's own pod secrets, the Job service account's secrets (read through the API when the launcher's Role grants `get serviceaccounts`, skipped with a warning otherwise) and the new `sandbox.job.image_pull_secrets` list of Secret names, so private-registry project images pull instead of failing ImagePullBackOff. A boot and reload warning fires when `service_account` is set without `image_pull_secrets` (#18819). + +## 2026-11-17 (v5.307.0) + +### Added + +- **Dashboard and API: link review perspectives to a repo file and set up an agent sandbox without editing config files (#18797).** Review Gate has owner, repo, path and ref fields with the resolver status and an Unlink button; `PUT /api/config/review` accepts `perspectives_source` (set, and `null` to clear), gated like `definition_source` by `GitHubPromptAllowed` with an error that points to Settings, Security, Prompt sources, and re-resolves the set in the same request, so no restart is needed. The 409 for inline perspective edits now names Unlink. An agent's General tab gains editable sandbox image, runtime and Job fields and a "Copy sandbox settings from..." action (Secret names only, never values); `PUT /api/config/agent//general` takes `sandboxImage`, `sandboxRuntime`, `sandboxJob` and `sandboxCopyFrom`; Settings, Security gains `agent_sandbox.job.env_from_secrets`. Saving an enabled sandbox with no image anywhere is refused with `sandbox.image` named, and the "no sandbox image" warning links to the controls that fix it. + +### Fixed + +- Fleet self-reports: the GitHub proxy's upstream TLS dial failing (`proxy upstream dial failed` / `transparent proxy upstream dial failed`, for example `error=EOF` from `api.github.com:443`) now files under the network-path class `proxy_connect_dial_failed`, with its operator remedy, instead of as an `unclassified_error_repeated` code defect ([#18763](https://github.com/hivecommons/hive/issues/18763)). +- A workflow hand-off to a Copilot session no longer ends in a false "no hive-open-pr tool" stand-down: the prompt now says `git` and `hive-open-pr` are shell commands (with the push and PR-request commands for the repo and issue) and that a stand-down is for a refused command, so the TechDocs drafter can open its draft PR (#18777). +- The Calendar section now has the Inbox's layout and spacing: each meeting is a row with status and platform chips, the title on its own line, a time line that leads with the next occurrence of a series (with "repeats weekly" after it, the first date in a tooltip, and the time zone shown once), a meta line, and grouped actions that wrap on narrow screens; a row awaiting approval is tinted and says in plain words why it waits; forwarded "FW:" and "Fwd:" prefixes are hidden in the title (display only); headings, the Add meeting disclosure and the empty states share one rhythm with the Inbox (#18807). +- Model family: a model id with a provider or gateway path (`anthropic/claude-opus-5-5`, `openai-codex/gpt-6.1-terra:high`) now reads as its vendor family (`claude`, `gpt`) instead of `anthropic/claude` or `openai`. The evidence summary's by-family counts and the reviewer-accuracy card's author families stop filing those authors under `other`, and `review_models.exclude_author_family` and the same/cross-family split now treat a prefixed and a bare spelling of the same vendor as the same family, so a "cross-family" review can no longer be same-vendor. Verdicts already stamped `same_family` keep their stored value. + +## 2026-11-17 (v5.306.0) + +### Added + +- **Customers: agents and the meeting persona are told who the work is for (#18742).** When a kick is about an issue whose human author, assignee or claimer is a customer, the prompt gains a `# Customer context` block: their GitHub login, the tags that are on, up to three goals a person confirmed, and a count. It is capped at 1,024 bytes and never holds an email address, an id, notes or the satisfaction assessment; goals the hive inferred and nobody confirmed stay out. Goals are text people typed, so each is scanned by `ioscan` and dropped whole if it holds an address, an id or a recognised attack, and the rest sit in a fenced `untrusted-customer-data` block with a fresh nonce, marked as data. The meeting persona gets a people retriever: when a question names a customer, it can describe them from a name, tags and confirmed goals, and never says notes or the satisfaction assessment aloud. Agents still cannot query the customers store; they only receive this slice. `src/docs/security-model.md` describes the boundary. +- **Customers: goal and satisfaction suggestions (#18742).** When the owner turns on **Settings, Features, Customers, Suggest goals and satisfaction** (`customers.inference.enabled`, default off, env `HIVE_CUSTOMERS_INFERENCE_ENABLED`), the hive reads what a customer has written (the issues they opened, the pull requests they authored and mail from them that was approved) and asks the model configured for meetings to suggest what they are trying to get done and how it is going for them, with the evidence behind each. They appear on the profile for a person to confirm, edit or reject; a confirmed or manual value is never overwritten, a rejected suggestion is not offered again, and there is no numeric score. The text is cleaned, scanned and fenced as untrusted data before it is sent, the reply is bounded (at most three short goals and one level, each citing only the evidence it was given), at most three customers are read per pass, a person is not read again for 24 hours or while their evidence is unchanged, and the model has its own budget of about 40,000 tokens a day. It is off by default because it sends text about people, some of whom never signed up, to that model. Each pass is audited as `customer_inference` with the person id and counts, never text. +- **Customers: graph view, merge and split, export (#18742).** A profile now has a **Graph**: a drawing of the person, the things they touched and the other people on those things, read from the customer graph; clicking another person opens their profile, and a read-only user's graph holds only themselves. The owner and read-write users can **merge** a customer into another when they are the same person (identities, tags, goals and activity move across, and two dashboard users are never merged), **undo** a merge exactly (only what the merge brought goes back), and **split off** an identity, which moves it and the activity it produced to a new customer. The owner can **export** everything held about a person in an in-app viewer (the profile, merge history, hints and up to 10,000 activity references). Four new routes under `/api/customers/{id}`, audited as `customer_merge`, `customer_unmerge`, `customer_split` and `customer_export`; a read-only user can use none of them, including on their own profile. + +### Fixed + +- The hive's own refresh of the shared Claude login can no longer lose the rotated grant when the write fails: the new grant is saved to a private `.credentials.pending` file before the shared file is written, held and retried with backoff without calling the token endpoint again, adopted at boot after a crash, and a dashboard banner and log line say so when it cannot be saved; an `invalid_grant` is no longer final while a newer grant from an agent or session home exists, and the refresher, the agents' bridge and the session adopt-back now write the shared login through one "only if strictly newer" function (#18775). + +### Security + +- **Betty: round-2 security review fixes.** A spoken consent notice that reports no audio (nothing could be synthesised) is no longer taken as delivered, so the bot leaves instead of staying unannounced. Speech that began before the consent notice but is finalised just after it is not stored, and an unreadable Quorum transcript cursor now fails closed for 30 seconds instead of open (the cursor read is retried once). Persona retrieval never searches the `meetings` vault or quotes `meeting-notes` facts, so one meeting's notes and Betty's replies cannot be quoted in another. A question nobody addressed to her is no longer sent to the public web (an addressed question or an explicit "search the web" still is). A line equal to one she said or posted in the last minute is treated as her own echo and can no longer trigger "betty leave". Rendered transcripts collapse line breaks and defuse participant names that imitate her `(assistant, ...)` label. + +## 2026-11-17 (v5.305.0) + +### Added + +- **Customers: a read-only GraphQL endpoint over the customer graph (#18742).** `POST /api/graph` answers GraphQL queries over people, the artefacts they touched and the edges between them: `me`, `person(id)`, `people(tag, first, after)` and `artefact(ref)`, with `Person.edges` paged newest first and `Artefact.people` for the walk back. There are no mutations and no subscriptions, so any signed-in, named user may call it, and every field that returns a person checks the viewer: the owner and read-write users reach every customer, a read-only user reaches only their own profile by any path (by id, through the list, through a shared artefact, through aliases or fragments; tested), suggested people are never returned, and an edge is shown only to a viewer who could open its artefact where it lives. Limits per query: depth 8, 8 KB of query text, pages of at most 100, 5,000 nodes and 5 seconds; introspection is off and the schema is in `src/docs/api-reference/customers.md`. Each query is audited as `customer_graph_query` with the operation name, node count and error count, never the query text. A profile's **Activity** in the Customers section is now a timeline read from this endpoint, grouped by what each entry points at, with **Show more** for the next page. New dependency: `github.com/graph-gophers/graphql-go` v1.11.1 (BSD-2-Clause), imported only by `pkg/customers/gql`; it brought no other new module into the build. +- **Customers: audit activity and "Same person?" hints (#18742).** The discovery sweep now reads the dashboard audit log: a customer gets one `acted` edge per day they did something and a `logged_in` edge on days they signed in. Only the user, the day and the kind of action are read, never an audit line's detail, and an edge goes when its day leaves the 90-day audit retention. Hive also raises "Same person?" questions when a suggested address starts like a customer's login (or a suggested login like one of their addresses); names are never compared, short and role addresses are skipped, and nothing is linked until the owner or a read-write user answers on the profile: yes makes the suggested identity theirs, no pins the pair so it is not asked again (`POST /api/customers/hints/{hid}/answer`, audited as `customer_hint_answer`). `src/docs/security-model.md` now describes the customers store, the position on people who never signed up, and the one trust assumption in identity linking: a `github:` access-list entry is taken as proof of that GitHub login. The budgeted GitHub search on accept is not part of this change. + +### Fixed + +- Meetings: the bundled Quorum is v0.5.1, which keeps "leave" right after the persona's name in the transcription hints; with v0.5.0's order the spoken "Betty leave" was transcribed as "Betty Lee" (#18745). +- **Deleting a session now runs in the background, shows its progress, and can no longer leave a session listed whose files are gone** ([#18767](https://github.com/hivecommons/hive/issues/18767)). Deleting an ended session looked like it did nothing: the request stayed open for about a minute with no indicator, then the dashboard said "could not remove the session's files" although the files had been removed, and the session stayed in the list. Three things caused it. The sandbox was deleted under the 10-second timeout meant for tmux calls, which a HOME with a CLI's caches outlasts. The cancel that the timeout triggered ran `su-exec root kill`, and the image has no `kill` binary, so the cancel itself failed. The hive then reported that cancel error over a removal that had finished, and kept the record. Now `DELETE /api/sessions/{id}` on an ended or failed session answers 202 at once and the session is `deleting`: the tab shows "Deleting…" with a spinner and no controls, and disappears by itself when the hive is done. One job per session removes the files under its own 15-minute ceiling and removes the record last; what is on disk decides the outcome, so an error from a command that left nothing behind is a success. A real failure puts the session back as it was with the reason on the tab and a **Retry delete** button. The login safety from #18728 is unchanged in what it protects: a session holding a strictly newer, usable Claude login that cannot be adopted is not deleted, and now says so ("this session holds the hive's current sign-in; adopting it failed: ..."); having nothing to adopt never blocks or slows a delete. The cancel of a privileged child now uses the shell's builtin `kill`, so a real timeout ends the child instead of waiting for it. Sessions already left half-deleted are repaired without a manual step: at the next sweep (boot, and every list) an `ended` record whose sandbox and worktree are both gone is dropped, and a delete click on one completes at once. Every delete outcome writes one log line with its duration and a `session_closed` audit entry, failures included. `DELETE ...?remove=true` on a running session closes and deletes it in one call. +- Activity monitor: a row no longer offers **Approve**, **Request changes…** or **Let hive decide** when no decision is pending. The gate pill and its verbs now read one rule (the payload's new `human_gate`), so a PR whose reviewer sign-off a person already approved shows *Approved by @login · waiting on …* naming the real blocker instead of *Needs human · review*; triage and author-owned rows keep their own lead instead of a decision pill; a hold or sentinel pill on an unparked row keeps only its own answer. Required checks queued or in progress past `HIVE_TRACKER_CHECK_STUCK_AFTER` (default `2h`) read **stuck** and are named, not shown as running, and a verb clicked from a stale view says what the item is waiting on and refreshes the row ([#18769](https://github.com/hivecommons/hive/issues/18769)). + +## 2026-11-17 (v5.304.0) + +### Added + +- **Customers: the dashboard section (#18742).** A new **Customers** section in the Collaborate group shows one profile per person. Everyone who signs in sees their own profile first, as **Me**; the owner and read-write users also see every customer, can add one by hand, and can accept or dismiss the people hive suggests. A profile shows the person's goals (add, confirm, edit or reject, with the references behind each suggestion), a satisfaction level with its evidence and no score (owner and read-write only), tags with an auto or manual marker and **Reset to automatic**, identities (one a read-only user adds to their own profile stays unconfirmed until someone with full access confirms it), activity counts, notes, and **Forget** for the owner. A read-only user sees and edits only their own profile. The section hides itself when the feature is off, and **Settings › Features › Customers** is the one switch (`customers.enabled`, default on; a change applies on restart; `HIVE_CUSTOMERS_ENABLED` overrides it). Nothing in the section leaves the hive. +- **Customers: discovery (#18742).** A `customers` sweep now fills the Customers section from what the hive already holds, every ten minutes and without a single GitHub call (a test runs it against a client that counts requests). Everyone on the access list becomes a customer; a `github:` entry, the owner's connected GitHub account and proven calendar emails are linked to their dashboard user. Issue authors, assignees and mentioned logins, pull-request authors and requested reviewers (all from the governor's last enumeration), claim holders, mail senders, Calendar organisers and attendees, and whoever added an upload or sent hive into a meeting become activity on a customer's profile, or, for anyone who is not a customer, a suggestion that holds only a key, counts and at most five references until someone accepts it. Bots, the hive's own author account, mail awaiting approval, purged meetings and display names produce nothing. Tags are assigned automatically from role, association and history (`maintainer`, `contributor`, `end-user`, `stakeholder`) and a tag a person set is never changed. Each pass also prunes: when a meeting is purged or deleted, a Calendar event removed, an upload deleted or a mail item removed, the activity that pointed at it, the suggestions that rested on it and the evidence that cited it go with it, so a profile cannot keep what retention deleted. A forgotten or dismissed person is not rediscovered, and an identity a person removed is not linked again. Dashboard user names are now matched with or without the `github:` prefix, as the access list matches them. + +### Fixed + +- A hand-created agent that is paused keeps its card in the dashboard instead of disappearing from every view while its name stays taken ("agent already exists"), so it can be resumed, edited or deleted again (#18730). +- A Claude agent at `Please run /login` whose credential file still looks valid is no longer restarted on the file's say-so: the hive verifies the credential against the provider first, and an HTTP 401 (revoked grant) marks the agent `revoked`, raises the dashboard banner and hub verdict "Claude login revoked: sign in again", pages the operator once, and holds the 3-per-24h token-restart budget instead of burning it on the same dead login. After a dashboard Claude sign-in, agents still at the prompt are restarted once even when that window is exhausted (#18732). +- Betty (meetings) round 2 (#18745): every line she delivers is now in the meeting transcript, the Inbox item and the notes, marked as hers, with channel, source and timing, and undelivered lines are shown as such; replies fall back to the other channel when chat or voice fails, a meeting she cannot reach is flagged and left after ten minutes, and calls into the meeting no longer block the meeting loop. "Leaving now." is out before she leaves and reaches the companion window after the meeting ends. Acknowledgements no longer delay answers or use the speaker's name, the spoken intro is short with the full text in chat, and fixed lines are pre-rendered when a voice meeting goes live. Hive status answers use the dashboard's counts with a stated scope, partial counts and age, name the working agents, and give fuller PR and issue lookups. Web answers use cleaned queries, never send hive questions to the web, and add Wikipedia, Open-Meteo and GitHub release lookups; product questions are answered from a brief built from the docs and from git knowledge sources. Misheard product words in lines addressed to her are corrected or queried, busy research is queued with its failure reason kept, and research notes create their knowledge channel on first use. + +## 2026-11-17 (v5.303.0) + +### Added + +- **Customers: the REST API, "me" and forget (#18742).** The people store is now wired into the hive and served under `/api/customers` (seven routes, in `dashboard/openapi.json` and `src/docs/api-reference/customers.md`). Every signed-in user has their own profile, `me`, created on first read. The verified owner and read-write users see every customer and every suggested person and can add, edit, accept and dismiss; only the owner can forget a person, which deletes them and their edges and leaves salted-hash tombstones. A read-only user sees only their own profile and can change only its name, identities, tags and goals, through `POST /api/customers/me/edit` (the one write the dashboard lets a read-only user make): any other id answers 404 exactly as a missing one does, the rule is enforced by the handlers and again by the store's service, and an identity a read-only user adds is an unconfirmed claim that resolves nobody and attracts no activity until someone with the full view confirms it. Profile opens, adds, edits, accepts, dismissals and forgets are audited with the person id and the kind of change, never the value. `customers.enabled: false` (or `HIVE_CUSTOMERS_ENABLED=false`) opens no store and turns the routes off. There is no section in the dashboard yet; that is the next PR. +- **Inbox: Quick note, larger hit targets and an honest list of input methods.** **+ Add** now has a **Quick note** box: type or dictate text and it becomes an Inbox item, sent as a markdown file (`note--