Skip to content

logs --json: runs[].aic is 0 when usage is unavailable, indistinguishable from zero cost #79253

Done

Description

@mnkiefer

Problem

RunData.AIC is float64 with json:"aic" (no omitempty). newRunData initializes it to 0, and buildRunData sets it only when pr.TokenUsage.TotalAIC > 0 (pkg/cli/logs_report.go). A run without a usage artifact therefore serializes as "aic": 0, indistinguishable from a measured zero cost. TokenUsage is documented as always emitted to distinguish "no tokens recorded" from "field absent", but aic has no equivalent signal. summary.total_aic uses omitempty, so absence and zero also collide there.

Evidence

Requesting 36 schema-feature-coverage run attempts with gh aw logs --stdin --artifacts usage --json returned 21 runs; 10 of them report "aic": 0 while token_usage_summary.total_aic is absent (mostly failed runs, and runs without retained usage). Summing runs[].aic therefore understates cost, which makes per-output cost ratios look better than they are.

Proposed fix

Make aic nullable (*float64, null when no usage summary exists) or add an explicit aic_coverage: available|unavailable. Apply the same distinction to summary.total_aic.

Metadata

Metadata

Labels

backlog:cli-observability

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions