Summary
The daily AI-credit guardrail can permanently block subsequent workflow activations within its 24-hour scan window when an agent job fails before the AI agent executes.
The failed job produces an empty agent/token_usage.jsonl, correctly reflecting zero model usage. However, component coverage treats every non-skipped agent job as an executed billable component and requires a non-empty accounting file. The next workflow run therefore fails closed with:
Daily workflow AI Credits are unknown: Missing accounting for executed agent component
This prevents the next run from reaching the agent or testing the underlying workflow fix. Repeated runs continue inspecting the same prior failure and remain blocked.
Confirmed reproduction
Repository: https://github.com/githubnext/gh-aw-enclave-demo-public
Original pre-agent failure
Run: https://github.com/githubnext/gh-aw-enclave-demo-public/actions/runs/34650415396
The agent job started but failed in Start MCP Gateway, before Execute GitHub Copilot CLI or any model invocation. The run's aggregate usage artifact contains:
agent/token_usage.jsonl empty
detection/token_usage.jsonl empty
The activity summary also records zero invocations:
{
"working_set": {
"measurement_state": "unavailable",
"cumulative_input_tokens": 0,
"peak_input_tokens": 0,
"rebuild_excess_tokens": 0,
"invocations": 0
}
}
Subsequent blocked run
Run: https://github.com/githubnext/gh-aw-enclave-demo-public/actions/runs/34659134360
The activation job selected the prior run's usage artifact and downloaded its accounting files, then failed in Check daily workflow token guardrail:
[daily-workflow-aic] Listed workflow artifacts: {"runId":34650415396,...}
[daily-workflow-aic] Selected guardrail artifact: {"runId":34650415396,"artifactName":"usage"}
[daily-workflow-aic] Downloaded guardrail artifact: {...,"usageJSONLFiles":["github_rate_limits.jsonl","agent/token_usage.jsonl","detection/token_usage.jsonl"]}
##[error]Daily workflow AI Credits are unknown: Missing accounting for executed agent component
The agent, detection, safe_outputs, and conclusion jobs were all skipped because activation failed. This run therefore did not exercise the enclave/MCP fix it was intended to validate.
Root cause
In actions/setup/js/daily_aic_component_coverage.cjs, loadBillableJobs() records component jobs by name and sumCoveredComponents() considers every component whose job conclusion is not skipped to have executed:
for (const [name, job] of components) {
if (job.conclusion === "skipped") continue;
...
const selected = candidates.find(file =>
fs.existsSync(file) && fs.readFileSync(file, "utf8").trim()
);
if (!selected) {
throw new Error(`Missing accounting for executed ${name} component`);
}
}
A GitHub Actions job conclusion cannot distinguish these cases:
- the model-execution step ran and accounting is unexpectedly missing;
- the job failed during setup before the model-execution step and legitimately consumed zero AI credits.
The current implementation conservatively classifies both as unknown usage. Because daily_aic_scan.cjs scans all completed runs in the preceding 24 hours, the unresolved run poisons every later activation during that window.
Impact
- Subsequent runs cannot proceed even though the prior failure provably consumed zero AI credits.
- Retrying does not recover because the same completed run remains in the authoritative scan window.
- Unrelated workflow fixes cannot be tested end to end.
- Operators must wait for the run to age out or apply a generated-lock workaround.
This is fail-closed, which is appropriate when usage is genuinely unknown, but a pre-agent failure needs a trustworthy way to prove zero usage.
Diagnostic workaround
Downstream PR githubnext/gh-aw-enclave-demo-public#47 adds a generated-lock-only cache observation for exactly run 34650415396:
{
"version": 2,
"coverage_version": 1,
"repository": "githubnext/gh-aw-enclave-demo-public",
"workflow_id": 352687633,
"run_id": 34650415396,
"run_attempt": 1,
"created_at": "2026-09-11T21:39:15Z",
"updated_at": "2026-09-11T21:41:59Z",
"aic": 0
}
The observation uses the authoritative run identity and is accepted by readScanCache()/matchesCompletedRun(). It preserves normal guardrail enforcement for every other run.
This is diagnostic only and should not become the general solution.
Required fix
The workflow should emit trustworthy component accounting even when failure occurs before model execution. Possible approaches include:
- Always produce an explicit zero-usage accounting record for a component when its model execution step was never entered.
- Publish a component execution marker that distinguishes setup failure from attempted model execution, and require non-empty usage only for the latter.
- Derive execution from the specific model-execution step outcome rather than the enclosing job's non-
skipped conclusion.
The implementation must remain fail-closed when model execution began but complete accounting cannot be proven. A generic continue-on-error, missing-artifact-as-zero rule, or job-failure-as-zero rule would weaken quota enforcement and is not acceptable.
Regression coverage
Add tests covering at least:
- agent job skipped: zero usage;
- agent job fails before model execution: explicit/provable zero usage;
- agent execution begins and emits valid usage: counted normally;
- agent execution begins but accounting is absent or malformed: fail closed;
- detection component follows the same rules;
- rerun attempts and aggregate artifacts cannot reuse stale zero-usage evidence;
- cache observations remain bound to repository, workflow ID, run ID, attempt, and exact timestamps.
An integration test should construct a workflow where setup fails immediately before the agent command, then confirm the next activation accepts the prior run as zero usage without disabling the daily guardrail.
Acceptance criteria
- A pre-agent failure produces authoritative zero-AIC evidence.
- The next workflow activation does not fail with
Missing accounting for executed agent component for that run.
- Missing accounting after actual model execution still fails closed.
- Attempt identity and artifact freshness checks remain enforced.
- The downstream enclave demo proceeds beyond activation after recompilation with the fix.
Follow-up confirmation
Once downstream PR #47 is merged and a new run completes, this issue can be updated with the result to confirm that the zero-usage diagnosis is sufficient to unblock activation and expose the next stage of workflow execution.
Summary
The daily AI-credit guardrail can permanently block subsequent workflow activations within its 24-hour scan window when an
agentjob fails before the AI agent executes.The failed job produces an empty
agent/token_usage.jsonl, correctly reflecting zero model usage. However, component coverage treats every non-skippedagentjob as an executed billable component and requires a non-empty accounting file. The next workflow run therefore fails closed with:This prevents the next run from reaching the agent or testing the underlying workflow fix. Repeated runs continue inspecting the same prior failure and remain blocked.
Confirmed reproduction
Repository: https://github.com/githubnext/gh-aw-enclave-demo-public
Original pre-agent failure
Run: https://github.com/githubnext/gh-aw-enclave-demo-public/actions/runs/34650415396
The
agentjob started but failed inStart MCP Gateway, beforeExecute GitHub Copilot CLIor any model invocation. The run's aggregateusageartifact contains:The activity summary also records zero invocations:
{ "working_set": { "measurement_state": "unavailable", "cumulative_input_tokens": 0, "peak_input_tokens": 0, "rebuild_excess_tokens": 0, "invocations": 0 } }Subsequent blocked run
Run: https://github.com/githubnext/gh-aw-enclave-demo-public/actions/runs/34659134360
The activation job selected the prior run's
usageartifact and downloaded its accounting files, then failed inCheck daily workflow token guardrail:The
agent,detection,safe_outputs, andconclusionjobs were all skipped because activation failed. This run therefore did not exercise the enclave/MCP fix it was intended to validate.Root cause
In
actions/setup/js/daily_aic_component_coverage.cjs,loadBillableJobs()records component jobs by name andsumCoveredComponents()considers every component whose job conclusion is notskippedto have executed:A GitHub Actions job conclusion cannot distinguish these cases:
The current implementation conservatively classifies both as unknown usage. Because
daily_aic_scan.cjsscans all completed runs in the preceding 24 hours, the unresolved run poisons every later activation during that window.Impact
This is fail-closed, which is appropriate when usage is genuinely unknown, but a pre-agent failure needs a trustworthy way to prove zero usage.
Diagnostic workaround
Downstream PR githubnext/gh-aw-enclave-demo-public#47 adds a generated-lock-only cache observation for exactly run
34650415396:{ "version": 2, "coverage_version": 1, "repository": "githubnext/gh-aw-enclave-demo-public", "workflow_id": 352687633, "run_id": 34650415396, "run_attempt": 1, "created_at": "2026-09-11T21:39:15Z", "updated_at": "2026-09-11T21:41:59Z", "aic": 0 }The observation uses the authoritative run identity and is accepted by
readScanCache()/matchesCompletedRun(). It preserves normal guardrail enforcement for every other run.This is diagnostic only and should not become the general solution.
Required fix
The workflow should emit trustworthy component accounting even when failure occurs before model execution. Possible approaches include:
skippedconclusion.The implementation must remain fail-closed when model execution began but complete accounting cannot be proven. A generic
continue-on-error, missing-artifact-as-zero rule, or job-failure-as-zero rule would weaken quota enforcement and is not acceptable.Regression coverage
Add tests covering at least:
An integration test should construct a workflow where setup fails immediately before the agent command, then confirm the next activation accepts the prior run as zero usage without disabling the daily guardrail.
Acceptance criteria
Missing accounting for executed agent componentfor that run.Follow-up confirmation
Once downstream PR #47 is merged and a new run completes, this issue can be updated with the result to confirm that the zero-usage diagnosis is sufficient to unblock activation and expose the next stage of workflow execution.