Skip to content

Daily AIC guardrail counts every run of a reusable workflow as 0 AIC #74864

Done

Description

@David-Taylor-Aurora

Summary

When a compiled workflow is called through workflow_call, the daily AIC guardrail counts each of its past runs as 0 AIC. max-daily-ai-credits never trips, however much the workflow spends.

Reproduction (gh-aw v1.0.1)

.github/workflows/hello.md, compiled with gh aw compile hello:

---
on:
  workflow_call:
engine: claude
permissions:
  contents: read
---
Say hi.

.github/workflows/caller.yml:

on: workflow_dispatch
permissions:
  actions: read
  checks: read
  contents: read
  issues: write
  pull-requests: read
jobs:
  caller:
    uses: ./.github/workflows/hello.lock.yml
    secrets: inherit

Run caller.yml twice. The first run's agent_usage.json records "ai_credits":12.22769. The second run's activation log counts it as 0:

[daily-workflow-aic] Computed run AIC: {"runId":<first run>,"aic":0,"reason":"no_billable_jobs"}
[daily-workflow-aic] Completed AIC inspection window: {"candidateRunsCount":2,"inspectedRunsCount":2,"countedRunIds":[...],"currentAIC":0,"threshold":5000,"exceeded":false}

The jobs of the first run are named caller / pre_activation, caller / activation, caller / agent, caller / safe_outputs and caller / conclusion.

Analysis

componentKey() in actions/setup/js/daily_aic_component_coverage.cjs matches job.name exactly against agent, detection and evals. GitHub prefixes the jobs of a called workflow with the caller's job name, so the agent job is named caller / agent. No job matches, loadBillableJobs() returns no components, and getRunAIC() returns 0.

The usage artifact is found correctly: matchesGuardrailArtifactName() already accepts prefixed artifact names. Only the job match fails. The same code is on main.

Suggested fix

In componentKey(), also match the segment after the last / in the job name.

Acceptance criteria

  • In daily_aic_component_coverage.test.cjs, jobs named caller / agent and caller / detection are counted as agent and detection.
  • Jobs nested more than one level, such as outer / caller / agent, are counted as agent.
  • Jobs named agent, detection and evals are counted as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions