Repository navigation
Description
Summary
scanDailyAIC treats an empty first page of the completed-run listing as a
complete 24-hour window with no runs. The guardrail then reports 0 AI Credits and
under_budget, and the agent runs. On one day, 10 of 64 activations of a
pull_request_target workflow read 0. The activations around them read about
6,000 against a 20,000 cap.
Version
Seen on v0.89.21 (github/gh-aw-actions/setup@924af5fd). The same logic is on
v1.0.1, v1.2.1, and main at 1da90b1.
Where
actions/setup/js/check_daily_aic_workflow_guardrail.cjs,
listCompletedWorkflowRunsPage: inworkflow_idmode it calls
listWorkflowRunswithstatus: "completed".sourceRunCountis the page
length.actions/setup/js/daily_aic_scan.cjs:
if (result.sourceRunCount < 100) complete = true;also fires for 0 on page 1.
TheArray.isArray(pageRuns)check on main accepts[].- The window is then complete with no candidates. The total is 0 and the status
isunder_budget.
Evidence
From one activation job, in order:
[daily-aic-cache] Restored verified scan observations: {"producerRunId":<id>,"artifactId":<id>,"entries":118}
[daily-workflow-aic] Loaded scan observations: {"workflowId":<id>,"cachedEntries":118}
[daily-workflow-aic] Listed workflow run candidates: {"page":1,"lookupMode":"workflow_id","sourceRunCount":0,"returnedRunCount":0}
[daily-workflow-aic] Completed AIC inspection window: {"candidateRunsCount":0,"inspectedRunsCount":0,"countedRunIds":[],"currentAIC":0,"threshold":20000,"exceeded":false}
The restore step's listWorkflowRuns call without status found a producer run
about 1 second before the scan. The scan's call with status: "completed"
returned no runs. The next normal activation, 31 minutes later, counted 94
candidates and 6,237 AIC.
All 10 zero reads fell between 15:05 and 16:52 UTC on 2026-10-22. Four other
activations in that span listed runs normally. We saw no empty listing in 739
later activations. GitHub's REST docs list status as a parameter that makes
this endpoint a search. We do not know why the search returned an empty page.
Not reproduced.
Expected
An empty or failed listing never counts as zero usage. When page 1 is empty and
other evidence shows completed runs in the window, the guardrail reports unknown
usage and fails closed, like the other incomplete-accounting paths.
Proposed fix
In scanDailyAIC, when page 1 returns 0 source runs:
- Count restored scan observations for this workflow with
created_atinside
the window. - In
workflow_idmode, list the workflow's runs once withoutstatus
(per_page: 10). Count completed runs inside the window, other than the
current run. - If either count is above 0, throw. The existing catch reports
transient_errorand fails activation.
A workflow with no completed runs still reads 0.
Tests:
- Restored observations plus an empty listing rejects.
- An empty cache plus a completed run in the unfiltered listing rejects.
- An empty cache plus no completed run in the unfiltered listing reads 0.
A wider alternative is to list without status and keep only completed runs in
the client. That avoids the search path. It changes how in-progress runs are
handled, so it needs its own review.
We carry this check as a local patch on v0.89.21 until a release includes a fix.
Activity