diff --git a/pm-stack/aggregator/src/render.ts b/pm-stack/aggregator/src/render.ts
index 2ca3b61b2..a0df88846 100644
--- a/pm-stack/aggregator/src/render.ts
+++ b/pm-stack/aggregator/src/render.ts
@@ -4784,13 +4784,28 @@ function jsonForScript(json: string): string {
return json.replace(/ AA_COLLECTOR_CADENCE_MS;
+ const retainedAfterFailure = section?.status === "ok" && section.stale === true;
+ const chipDetail: ProvenanceDetail = olderThanOneCycle || retainedAfterFailure
+ ? { ...detail, aa: { ...aaFacet, state: "stale" } }
+ : detail;
+ return freshnessChips(chipDetail, ["aa"]);
+}
+
+export function renderAa(section: AaFeedSection | null, provenance: Provenance, detail?: ProvenanceDetail): string {
if (!section) {
return layout(
"Cost Explorer",
`
Cost Explorer
The AA data has not reached the dashboard yet — the fleet-feed collector reads it from Supabase (ainventory), and no AA section is in the current feed. The data of record is the ainventory import; this page only renders it.
`,
provenance,
"/aa",
+ "",
+ aaFreshnessChips(detail, null),
);
}
if (section.status === "absent") {
@@ -4799,6 +4814,8 @@ export function renderAa(section: AaFeedSection | null, provenance: Provenance):
`Cost Explorer
The collector could not build the AA section on its last run (${fmtDate(section.generatedAt)}): ${esc(section.reason)}. No successful collection exists yet to fall back to — the page fills in on the first successful collection.
`,
provenance,
"/aa",
+ "",
+ aaFreshnessChips(detail, section),
);
}
const s: AaSection = section;
@@ -4820,6 +4837,15 @@ export function renderAa(section: AaFeedSection | null, provenance: Provenance):
Catalog ids verbatim from the config — this is where unmeasured newcomers (e.g. commandcode/reflection/beam:free, the Reflection Beam seat) sit until the import measures them.
${aaNameList(cov.catalogNotPooledUnmeasured)}`
: `Coverage — measured but not pooled
Coverage was not computed for this section — the collector could not read .opencode/opencode.jsonc on that run.
`;
const catalog = s.catalog;
+ const feedAge = detail?.aa.ageMs === undefined ? "unavailable" : ageMsText(detail.aa.ageMs);
+ const aaTabAge = detail
+ ? `AA data age: ${esc(feedAge)} (fleet-feed age).
`
+ : "";
+ const catalogTabAge = detail
+ ? catalog
+ ? `Model catalog age: ${esc(feedAge)} (fleet-feed age; catalog and AA are read in the same collector run; no separate catalog timestamp is carried).
`
+ : `Model catalog age: unavailable — no catalog in this feed (fleet-feed age: ${esc(feedAge)}).
`
+ : "";
const modelCards = catalog
? `
${catalog.length} models in the fleet's provider catalogs
from .opencode/opencode.jsonc, read by the same collector run as the AA data
@@ -4870,6 +4896,7 @@ ${s.stale ? `
The latest collection failed (${esc(s.staleReas
Hidden
+${aaTabAge}
@@ -4930,6 +4957,7 @@ ${aaConfigsTable(s.configs)}
${s.cai ? aaCaiTable(s.cai) : ""}
+${catalogTabAge}
The fleet's model universe
Every model in the fleet config's provider catalogs: the plan each door belongs to and its effective value multiplier where the registry records one, the pools that seat it, and its AA measurement when the import has one. Click a row for the plan note.
${modelCards}
@@ -4952,7 +4980,7 @@ ${modelCards}
${coverageHtml}
`;
- return layout("Cost Explorer", body, provenance, "/aa", AA_EXPLORER_SCRIPT);
+ return layout("Cost Explorer", body, provenance, "/aa", AA_EXPLORER_SCRIPT, aaFreshnessChips(detail, section));
}
// --- Sessions / identity registry page (#906 §3) ------------------------------
diff --git a/pm-stack/aggregator/src/server.ts b/pm-stack/aggregator/src/server.ts
index d383d00c6..80eff1e2b 100644
--- a/pm-stack/aggregator/src/server.ts
+++ b/pm-stack/aggregator/src/server.ts
@@ -754,7 +754,7 @@ async function handler(req: Request): Promise
{
}
if (path === "/aa") {
- return html(renderAa(await source.aa(), prov()));
+ return html(renderAa(await source.aa(), prov(), provDetail()));
}
if (path === "/api/aa.json") {
const section = await source.aa();
diff --git a/pm-stack/aggregator/test/aa.test.ts b/pm-stack/aggregator/test/aa.test.ts
index 468ab16be..b120cb3aa 100644
--- a/pm-stack/aggregator/test/aa.test.ts
+++ b/pm-stack/aggregator/test/aa.test.ts
@@ -26,7 +26,7 @@ import {
import { PAGES } from "../src/pages.ts";
import { renderAa } from "../src/render.ts";
import { FIXTURE_AA, fixtureSource } from "../src/sources/fixtures.ts";
-import type { AaCaiRow, AaPrice, AaRanking, AaSection, AaTestRun, Provenance } from "../src/model.ts";
+import type { AaCaiRow, AaPrice, AaRanking, AaSection, AaTestRun, Provenance, ProvenanceDetail } from "../src/model.ts";
const PROV: Provenance = {
board: "x",
@@ -42,6 +42,23 @@ const PROV: Provenance = {
aa: "fixtures",
};
+function aaProvenanceDetail(ageMs?: number, state: ProvenanceDetail["aa"]["state"] = "live"): ProvenanceDetail {
+ const fixtures = { text: "fixtures", state: "fixtures" as const };
+ return {
+ board: fixtures,
+ roadmap: fixtures,
+ items: fixtures,
+ comments: fixtures,
+ quota: fixtures,
+ usage: fixtures,
+ attention: fixtures,
+ orchestration: fixtures,
+ dns: fixtures,
+ registry: fixtures,
+ aa: { text: "live (fleet feed)", state, ...(ageMs === undefined ? {} : { ageMs }) },
+ };
+}
+
describe("stripJsonComments", () => {
test("removes // and /* */ comments but keeps URLs inside strings", () => {
const out = stripJsonComments(`{ "npm": "@ai-sdk/openai-compatible", // provider pkg
@@ -635,6 +652,33 @@ describe("aa-explorer manifest + render", () => {
expect(absent).not.toContain("Rankings");
});
+ test("freshness chips and both tab ages use labelled fleet-feed provenance", () => {
+ const html = renderAa(FIXTURE_AA, PROV, aaProvenanceDetail(2 * 60_000));
+
+ expect(html).toContain('class="fchip live" title="live (fleet feed)"');
+ expect(html).toContain("aa · live · 2m old");
+ expect(html).toContain("AA data age: 2m old (fleet-feed age)");
+ expect(html).toContain(
+ "Model catalog age: 2m old (fleet-feed age; catalog and AA are read in the same collector run; no separate catalog timestamp is carried)",
+ );
+ });
+
+ test("an AA facet older than one collector cycle is stale, as is a retained stale section", () => {
+ const oldFeed = renderAa(FIXTURE_AA, PROV, aaProvenanceDetail(6 * 60_000));
+ expect(oldFeed).toContain('class="fchip stale" title="live (fleet feed)"');
+ expect(oldFeed).toContain("aa · stale · 6m old");
+
+ const retained = renderAa({ ...FIXTURE_AA, stale: true }, PROV, aaProvenanceDetail(2 * 60_000));
+ expect(retained).toContain('class="fchip stale" title="live (fleet feed)"');
+ });
+
+ test("legacy callers without provenance detail keep rendering without chips or tab-age claims", () => {
+ const html = renderAa(FIXTURE_AA, PROV);
+ expect(html).not.toContain('class="fchip');
+ expect(html).not.toContain("AA data age:");
+ expect(html).not.toContain("Model catalog age:");
+ });
+
test("fixtureSource().aa() returns the fixture section", async () => {
const section = await fixtureSource().aa();
expect(section?.status).toBe("ok");