Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prefer job_id and map Evaluations in daily AIC component lookup
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
  • Loading branch information
Copilot and pelikhan authored Oct 6, 2026
commit 8d273c1061269e36211f1e67d38f41119baeff2b
17 changes: 15 additions & 2 deletions actions/setup/js/daily_aic_component_coverage.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ const COMPONENT_FILES = {
evals: [["evals", "token_usage.jsonl"]],
};

// Generated jobs display as "Agent", "Detection" and "Evaluations".
const COMPONENT_DISPLAY_NAMES = { evaluations: "evals" };

function componentKey(job) {
for (const candidate of [job.job_id, job.name]) {
if (typeof candidate !== "string") continue;
const lower = candidate.toLowerCase();
const key = COMPONENT_DISPLAY_NAMES[lower] ?? lower;
if (Object.hasOwn(COMPONENT_FILES, key)) return key;
}
return "";
}

async function loadBillableJobs({ github, budget }, owner, repo, run) {
const components = new Map();
let complete = false;
Expand All @@ -28,8 +41,8 @@ async function loadBillableJobs({ github, budget }, owner, repo, run) {
const jobs = response.data.jobs;
if (!Array.isArray(jobs)) throw new Error("Incomplete daily AIC job metadata");
for (const job of jobs) {
const name = typeof job.name === "string" ? job.name.toLowerCase() : "";
if (!Object.hasOwn(COMPONENT_FILES, name)) continue;
const name = componentKey(job);
if (!name) continue;
if (!Number.isSafeInteger(job.run_attempt) || job.run_attempt < 1 || job.run_attempt > run.run_attempt || job.status !== "completed" || !job.conclusion) {
throw new Error("Incomplete daily AIC component attempt metadata");
}
Expand Down
7 changes: 7 additions & 0 deletions actions/setup/js/daily_aic_component_coverage.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@ it("counts usage for compiler-generated job display names", async () => {
expect(global.core.info).toHaveBeenCalledWith(expect.stringContaining('"component":"detection"'));
});

it("maps the Evaluations display name and job_id to their components", async () => {
const f = evaluate({ "agent_usage.jsonl": '{"aic":1}', "evals/token_usage.jsonl": '{"aic":2}' }, [job("Agent"), job("Evaluations")]);
await expect(f.result).resolves.toBeCloseTo(3);
const g = evaluate({ "agent_usage.jsonl": '{"aic":4}' }, [job("Display", { job_id: "agent" })]);
await expect(g.result).resolves.toBeCloseTo(4);
});

it("requires accounting for executed jobs with generated display names", async () => {
const f = evaluate({}, [job("Agent")]);
await expect(f.result).rejects.toThrow("Missing accounting for executed agent component");
Expand Down
Loading