From 690af5c73762461d50c4cf687bb0e697076fd561 Mon Sep 17 00:00:00 2001 From: rebuildup Date: Sat, 21 Nov 2026 17:22:16 +0900 Subject: [PATCH 1/2] fix(agent): refresh stale fallback e2e attestations + staleness detection (#203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All four fallback profiles resolved NO USABLE CANDIDATES because the committed live-e2e evidence (2026-11-04/13) aged past the 7-day DEFAULT_MAX_EVIDENCE_AGE_MS window — fallback was silently dead. - Re-verified all candidate route+model pairs with real runs on 2026-11-21 (file-create tool calls confirmed on disk): omp.kilo, omp.groq via agent task run; opencode.kilo via launcher run mode; omp.openrouter-free via launcher print mode (omp 19.0.0, opencode 2.3.2). Evidence at/sha/note updated; unverified extra models dropped from kilo attestation values rather than overclaiming. - agent check now prints per-candidate rejection warnings (incl. attestation-stale) on every run — CI surfaces upcoming expiry instead of discovering it at quota exhaustion. Advisory only: renewal needs real provider calls CI cannot perform. - fallback-exec test: replace the fixed-calendar nowMs pin (which broke on every renewal/aging cycle — the same trap as #203) with a clock anchored to the freshest committed evidence +24h, keeping the freshness check itself exercised. agent fallback now reports USABLE for all 4 profiles. --- config/agents.toml | 27 ++++++++++------------- script/agent.fallback-exec.test.ts | 25 ++++++++++++++++----- script/agent/commands.ts | 35 +++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/config/agents.toml b/config/agents.toml index 2dac394..ad3d602 100644 --- a/config/agents.toml +++ b/config/agents.toml @@ -1150,10 +1150,10 @@ status = "verified-live" provenance = "measured" [catalog.routes."omp.openrouter-free".e2e.evidence] -at = "2026-11-04T00:00:00Z" +at = "2026-11-21T08:20:00Z" source = "live-e2e" -sha = "bed3716a5008c424a3b2bf97204f1d8ebafe8a6b" -note = "Real response + Bash tool call, OMP 18.16.0." +sha = "9547021c2da03170e883dec307223c12f4a8480d" +note = "Real response + shell tool call (file create verified on disk) via agent launcher print mode, omp 19.0.0, 2026-11-21." [catalog.routes."claude.opencode-go".quota] scope = "plan" @@ -1597,31 +1597,28 @@ note = "Real response + tool call + file edits through the launcher, claude 2.1. [catalog.routes."opencode.kilo".e2e] value = [ { model = "nvidia/nemotron-3-ultra-550b-a55b:free", tool_call = true }, - { model = "kilo-auto/free", tool_call = true }, - { model = "cohere/north-mini-code:free", tool_call = true }, ] status = "verified-live" provenance = "measured" [catalog.routes."opencode.kilo".e2e.evidence] -at = "2026-11-13T00:00:00Z" +at = "2026-11-21T08:20:00Z" source = "live-e2e" -sha = "65a2bbc21d3e8dc889669c7bb818e567358a891f" -note = "Real response + tool call + file edits through the launcher, opencode 2.2.7; create-task and bug-fix task." +sha = "9547021c2da03170e883dec307223c12f4a8480d" +note = "Real response + shell tool call (file create verified on disk) through the launcher run mode, opencode 2.3.2, 2026-11-21. kilo-auto/free and cohere/north-mini-code:free dropped from this attestation pending re-verification." [catalog.routes."omp.kilo".e2e] value = [ { model = "nvidia/nemotron-3-ultra-550b-a55b:free", tool_call = true }, - { model = "kilo-auto/free", tool_call = true }, ] status = "verified-live" provenance = "measured" [catalog.routes."omp.kilo".e2e.evidence] -at = "2026-11-13T00:00:00Z" +at = "2026-11-21T08:20:00Z" source = "live-e2e" -sha = "65a2bbc21d3e8dc889669c7bb818e567358a891f" -note = "Real response + bash/edit tool calls + bun test through the launcher, omp 18.18.9; create-task and bug-fix task." +sha = "9547021c2da03170e883dec307223c12f4a8480d" +note = "Real response + shell tool calls (file create verified on disk) through agent task run, omp 19.0.0, 2026-11-21. kilo-auto/free dropped from this attestation pending re-verification." [catalog.routes."claude.requesty".e2e] value = [ @@ -1669,10 +1666,10 @@ status = "verified-live" provenance = "measured" [catalog.routes."omp.groq".e2e.evidence] -at = "2026-11-13T00:00:00Z" +at = "2026-11-21T08:20:00Z" source = "live-e2e" -sha = "65a2bbc21d3e8dc889669c7bb818e567358a891f" -note = "Real response + bash/edit tool calls + bun test through the launcher, omp 18.18.9; create-task 320s and the bug-fix task." +sha = "9547021c2da03170e883dec307223c12f4a8480d" +note = "Real response + shell tool calls (file create verified on disk) through agent task run, omp 19.0.0, 2026-11-21." # --------------------------------------------------------------------------- # Fallback profiles (issue #136 / T020, Epic #86): opt-in continuity profiles diff --git a/script/agent.fallback-exec.test.ts b/script/agent.fallback-exec.test.ts index bab8aa4..c617642 100755 --- a/script/agent.fallback-exec.test.ts +++ b/script/agent.fallback-exec.test.ts @@ -5,7 +5,9 @@ import { describe, it, expect } from "bun:test";; import { classifyFailure, executeWithFallback, FallbackExhaustedError, CATEGORY_FACTS, CATEGORY_SEVERITY, FALLBACK_CIRCUIT_BREAKER_THRESHOLD, FALLBACK_CIRCUIT_BREAKER_RESET_MS, FALLBACK_MAX_RETRIES_PER_CANDIDATE, FALLBACK_MAX_TOTAL_RETRIES, type FallbackAttemptRecord } from "./agent/fallback-exec.ts";; -import { loadConfig } from "./agent/config.ts";; +import { loadConfig } from "./agent/config.ts"; +import { loadCatalog } from "./agent/catalog.ts"; +import { seedAttestationsFromCatalog } from "./agent/fallback.ts";; import { ContractError, formatRouteId, parseRouteId } from "./agent/contract.ts";; import { dirname, join } from "node:path";; import { realpathSync } from "node:fs";; @@ -256,11 +258,22 @@ describe("executeWithFallback", () => { describe("FallbackExhaustedError", () => { const realConfigPath = join(repoRoot(), "config", "agents.toml"); - // The committed catalog e2e evidence is dated 2026-11-13; pin the - // resolution clock inside its 7-day freshness window so the suite does not - // silently start rejecting every candidate once wall-clock time passes it. - // The freshness check itself still runs — it just evaluates a fixed `now`. - const EVIDENCE_FRESH_NOW_MS = Date.parse("2026-11-14T00:00:00Z"); + // Anchor the resolution clock just after the FRESHEST committed e2e + // evidence, whatever its date: pinning a fixed calendar date made the + // suite break every time evidence aged past (or was renewed beyond) the + // pin — the same date-dependent trap as dotfiles#203. Deriving `now` from + // the catalog keeps the freshness check itself running while making the + // mechanics under test independent of the renewal calendar. Staleness + // detection for operators lives in `agent check` warnings / `agent + // fallback`, not in this suite. + const catalogFactsForClock = loadCatalog(realConfigPath); + let freshestEvidenceMs = 0; + for (const attestation of seedAttestationsFromCatalog(catalogFactsForClock).values()) { + const at = attestation.evidence?.at ?? attestation.value?.evidence?.at; + const ms = typeof at === "string" ? Date.parse(at) : NaN; + if (Number.isFinite(ms) && ms > freshestEvidenceMs) freshestEvidenceMs = ms; + } + const EVIDENCE_FRESH_NOW_MS = freshestEvidenceMs + 24 * 60 * 60 * 1000; /** Run the executor against a real profile with a stub task function. */ async function exhaustWith( diff --git a/script/agent/commands.ts b/script/agent/commands.ts index 11d90d5..dd9a860 100644 --- a/script/agent/commands.ts +++ b/script/agent/commands.ts @@ -251,8 +251,9 @@ export function cmdCheck(config: Config): number { // tables: a malformed profile (bad primary_route, bad cap, bad billing) must // fail CI here rather than at `agent fallback` time with a stack trace. let profileCount = 0; + let parsedToml: Record; try { - const parsedToml = parseTomlTable(readFileSync(config.path, "utf8"), config.path); + parsedToml = parseTomlTable(readFileSync(config.path, "utf8"), config.path); for (const id of listFallbackProfiles(parsedToml)) { parseFallbackProfile(parsedToml, id); profileCount++; @@ -263,6 +264,38 @@ export function cmdCheck(config: Config): number { } throw error; } + // Attestation freshness is time-dependent: committed e2e evidence older + // than DEFAULT_MAX_EVIDENCE_AGE_MS silently disables every fallback + // candidate (dotfiles#203). Surface rejections as warnings on every + // `agent check` run — CI prints them — without failing the structural + // check, since renewal needs real provider calls CI cannot perform. + try { + const catalogFacts = loadCatalog(config.path); + const catalogLike = buildFallbackCatalog(config, catalogFacts); + const attestationMap = mergeAttestations( + seedAttestationsFromCatalog(catalogFacts), + loadCatalogAttestations(), + ); + for (const id of listFallbackProfiles(parsedToml)) { + const profile = parseFallbackProfile(parsedToml, id); + if (profile === null) continue; + const resolution = resolveFallbackProfile( + profile, + catalogLike, + attestationMap, + getPrimaryQuotaScope(catalogFacts, profile.primaryRoute), + ); + for (const rejected of resolution.rejected) { + const target = rejected.candidate + ? `${rejected.candidate.route}/${rejected.candidate.model}` + : "(unresolved)"; + console.log(`warning: fallback '${id}' rejects ${target}: ${rejected.reason}`); + } + } + } catch { + // Resolution warnings are advisory; structural validation above already + // failed closed on malformed input. + } console.log( `config OK: ${config.path} ` + `(${Object.keys(config.providers).length} providers, ` + From 7a2f1cbf3ac568cc631c274d2b655638533d7683 Mon Sep 17 00:00:00 2001 From: rebuildup Date: Sat, 21 Nov 2026 17:25:13 +0900 Subject: [PATCH 2/2] fix(agent): renew claude/opencode openrouter-free e2e + de-pin catalog freshness clock (#203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catalog freshness test asserted all three openrouter-free routes' e2e usable at a fixed 2026-11-06 clock; renewing only the omp variant left the other two stale. Re-verified both with real launcher runs (claude 2.1.328 print mode, opencode 2.3.2 run mode; file creates confirmed on disk) and anchored the test clock to the freshest catalog evidence +24h — same renewal-calendar independence as the fallback-exec fix. --- config/agents.toml | 12 ++++++------ script/agent.catalog.test.ts | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/config/agents.toml b/config/agents.toml index ad3d602..0d8a44e 100644 --- a/config/agents.toml +++ b/config/agents.toml @@ -1128,10 +1128,10 @@ status = "verified-live" provenance = "measured" [catalog.routes."claude.openrouter-free".e2e.evidence] -at = "2026-11-01T00:00:00Z" +at = "2026-11-21T08:25:00Z" source = "live-e2e" -sha = "fe67db6e8d27fc2b1b0f604ec2299eafb6e3f4e2" -note = "Real response + Bash tool call, claude 2.1.314." +sha = "9547021c2da03170e883dec307223c12f4a8480d" +note = "Real response + shell tool call (file create verified on disk) via agent launcher print mode, claude 2.1.328, 2026-11-21." [catalog.routes."opencode.openrouter-free".e2e] value = [{ model = "nvidia/nemotron-3-ultra-550b-a55b:free", tool_call = true }] @@ -1139,10 +1139,10 @@ status = "verified-live" provenance = "measured" [catalog.routes."opencode.openrouter-free".e2e.evidence] -at = "2026-11-01T00:00:00Z" +at = "2026-11-21T08:25:00Z" source = "live-e2e" -sha = "fe67db6e8d27fc2b1b0f604ec2299eafb6e3f4e2" -note = "Real response + Bash tool call, opencode 2.2.3." +sha = "9547021c2da03170e883dec307223c12f4a8480d" +note = "Real response + shell tool call (file create verified on disk) through the launcher run mode, opencode 2.3.2, 2026-11-21." [catalog.routes."omp.openrouter-free".e2e] value = [{ model = "nvidia/nemotron-3-ultra-550b-a55b:free", tool_call = true }] diff --git a/script/agent.catalog.test.ts b/script/agent.catalog.test.ts index 0f2f1ba..6792787 100644 --- a/script/agent.catalog.test.ts +++ b/script/agent.catalog.test.ts @@ -19,8 +19,14 @@ import { ContractError, isUsable } from "./agent/contract"; const REPO = dirname(dirname(realpathSync(import.meta.path))); const REAL_CONFIG = join(REPO, "config", "agents.toml"); -/** Reference clock for freshness checks: fresh for every recorded evidence date. */ -const NOW = Date.parse("2026-11-06T12:00:00Z"); +/** Reference clock for freshness checks, anchored just after the freshest + * committed e2e evidence (set in beforeAll once the catalog is loaded). + * A fixed calendar date made this suite break on every evidence renewal — + * the same date-dependent trap as dotfiles#203; deriving `now` from the + * catalog keeps the freshness check itself exercised without coupling the + * suite to the renewal calendar. Operator-facing staleness detection lives + * in `agent check` warnings, not here. */ +let NOW = Date.parse("2026-11-06T12:00:00Z"); let catalog: Catalog; @@ -75,6 +81,15 @@ note = "fixture" describe("loadCatalog: real config", () => { beforeAll(() => { catalog = loadCatalog(REAL_CONFIG); + let freshest = 0; + for (const route of Object.values(catalog.routes)) { + for (const attested of [route.e2e, route.restriction]) { + const at = attested?.evidence?.at; + const ms = typeof at === "string" ? Date.parse(at) : NaN; + if (Number.isFinite(ms) && ms > freshest) freshest = ms; + } + } + if (freshest > 0) NOW = freshest + 24 * 60 * 60 * 1000; }); test("real config catalog validates (malformed catalog fails here)", () => {