Skip to content

Count generated jobs in the daily AIC guardrail - #66298

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-daily-aic-guardrail-counts
Oct 7, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/fix-daily-aic-guardrail-counts

Conversation

Copilot AI commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

The daily AIC guardrail treated completed Agent and Detection jobs as having no billable usage because it matched only lowercase job names. It also reused the resulting zero-credit scan entries, allowing runs to start despite exceeding the daily limit.

  • Accounting: Map generated job display names to canonical component keys before checking coverage and reading usage.
  • Cache: Bump the scan coverage version so affected recorded-zero entries are re-inspected.
  • Regression coverage: Check generated job names, missing accounting, and reinspection of old zero-credit entries.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix daily AI Credits guardrail counts after upgrade to v0.91.2 Count generated jobs in the daily AIC guardrail Oct 6, 2026
Copilot AI requested a review from pelikhan October 6, 2026 22:25
@pelikhan
pelikhan marked this pull request as ready for review October 6, 2026 23:00
Copilot AI balanced review requested due to automatic review settings October 6, 2026 23:00
@pelikhan

pelikhan commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@copilot consider using the job id instead of name if available.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The generated Evaluations job remains unmapped, allowing its usage to be omitted and cached.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes daily AIC accounting for generated job display names and invalidates stale scan entries.

Changes:

  • Normalizes Agent and Detection job names.
  • Bumps cache coverage version and adds regression tests.
File Description
actions/​setup/​js/​daily_aic_component_coverage.cjs Normalizes billable job names.
actions/​setup/​js/​daily_aic_component_coverage.test.cjs Tests generated display names.
actions/​setup/​js/​daily_aic_cache_helpers.cjs Invalidates old coverage entries.
actions/​setup/​js/​daily_aic_scan.test.cjs Tests stale-zero reinspection.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +31 to +32
const name = typeof job.name === "string" ? job.name.toLowerCase() : "";
if (!Object.hasOwn(COMPONENT_FILES, name)) continue;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in 8d273c1: the generated Evaluations name maps to evals, with regression coverage for the generated name. The job-ID preference was added in the same commit, and the changes are preserved after merging main in cbe472d.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@copilot consider using the job id instead of name if available.

Done in 8d273c1. Component lookup now prefers job.job_id when the job object has one. It falls back to the display name, and Evaluations now maps to evals. The GitHub jobs API usually doesn't return the workflow job key, so the name fallback is still what runs in most cases.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/daily_aic_component_coverage.cjs:32): The generated eval job is named Evaluations (pkg/workflow/compiler_job_annotations.go:17), so lowercasing yields evaluations, which is not the evals key in COMPONENT_FILES. Runs with evaluations will still omit that component's AIC, and the incomplete total can now be cached under coverage version 2. Map Evaluations to evals and add it to the generated-name regression case. - Count generated jobs in the daily AIC guardrail #66298 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: 8d273c1
Sous-chef work: 5661ea79c99caf633917906455c9b341e56372c5f328c4721fd1b650ebb0e8ab
Sous-chef state: 71c17a0f993d699e657980f42dd782e3e627106b56574ce2398749f00606b74b

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 8.96 AIC · ⌖ 12.3 AIC · ⊞ 1K · ◷
Comment /souschef to run again

…-guardrail-counts

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 6, 2026 23:54
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check JS Tests (shard 3/4) (FAILURE): https://github.com/github/gh-aw/actions/runs/37548963477/job/112572868708.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: cbe472d
Sous-chef work: 99fc195661b90dc631a5960c0642aa21aa4812000fe92377f25629fbdc6e618e
Sous-chef state: c2fa7acccf9a2a31f15a511dbb5a041b5b65ca11007ad484d7408961920d0168

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 10.6 AIC · ⌖ 6.06 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

make merge-main succeeded; the branch already included the fetched latest main. The Evaluations → evals mapping and generated-name regression test were already present in 8d273c1 and remain intact. The shard failure is fixed in 202d80b by making the weighted-distribution test deterministic.

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

make merge-main succeeded; the branch already included the fetched latest main. Fixed the flaky weighted-distribution test in 202d80b with deterministic samples; the focused test and impacted JavaScript suite pass.

@pelikhan
pelikhan merged commit bc4077a into main Oct 7, 2026
2 checks passed
@pelikhan
pelikhan deleted the copilot/fix-daily-aic-guardrail-counts branch October 7, 2026 10:36
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daily AIC guardrail counts completed v0.91.2 runs as zero

4 participants