Repository navigation
Description
Analysis
Same root-cause class as #63717 (mine as well), but on a different consumer: actions/setup/js/parse_token_usage.cjs hardcodes every path it reads as a literal /tmp/gh-aw/... string, never rewritten for runner.topology: arc-dind:
const TOKEN_USAGE_AUDIT_PATH = "/tmp/gh-aw/sandbox/firewall-audit-logs/api-proxy-logs/token-usage.jsonl";
const TOKEN_USAGE_PATH = "/tmp/gh-aw/sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl";
const TOKEN_USAGE_AWF_AUDIT_PATH = "/tmp/gh-aw/sandbox/firewall/audit/api-proxy-logs/token-usage.jsonl";
const TOKEN_USAGE_PATHS = [TOKEN_USAGE_AUDIT_PATH, TOKEN_USAGE_AWF_AUDIT_PATH, TOKEN_USAGE_PATH];
const AGENT_USAGE_PATH = "/tmp/gh-aw/agent_usage.json";
const AGENT_USAGE_JSONL_PATH = "/tmp/gh-aw/agent_usage.jsonl";
const COPILOT_SESSION_STATE_DIR = "/tmp/gh-aw/sandbox/agent/logs/copilot-session-state";generateTokenUsageSummary() (pkg/workflow/compiler_yaml_ai_execution.go:317) runs this as a plain actions/github-script step — outside the AWF sandbox, on the bare runner filesystem — after the agent job. Under runner.topology: arc-dind, the real files live under ${RUNNER_TEMP}/gh-aw/... (per rewriteArcDindEngineCommand(), same mechanism #63717 already documents), not literal /tmp/gh-aw/.... So on arc-dind:
getReadableTokenUsagePaths(TOKEN_USAGE_PATHS)finds nothing →tokenUsagePaths.length === 0.- Falls back to
findCopilotUsageCheckpoint(COPILOT_SESSION_STATE_DIR)— also a hardcoded literal path → also finds nothing → returnsnull. - Falls through to
writeEmptyUsageEvidence()(actions/setup/js/parse_token_usage.cjs:41-42, writes literal{"ai_credits":0}) and returns without ever callingcore.exportVariable("GH_AW_AIC", ...).
GH_AW_AIC (or its absence) is what send_otlp_span.cjs reads to build the gh-aw.aic attribute on the gh-aw.agent.conclusion/gh-aw.agent.agent spans — explaining the gh-aw.aic=0/missing gh-aw.turns/missing gen_ai.usage.* symptom below, and (separately) why the Step Summary's own token table goes missing on the same runs — same silent-empty-fallback path, not two different bugs.
Reproduction
Direct before/after OTLP trace comparison, same repo, both engine: pi:
vm-poc topology (not arc-dind), gh-aw v0.89.20 — gh-aw.agent.conclusion span:
gh-aw.aic=313.14946
gh-aw.turns=168
gen_ai.usage.input_tokens=64872
gen_ai.usage.output_tokens=30014
gen_ai.usage.total_tokens=94886
runner.topology: arc-dind, gh-aw v0.90.0 — same span type, same workflow shape:
gh-aw.aic=0
gh-aw.turns and all gen_ai.usage.* fields absent entirely. In the same trace, the underlying api_proxy.copilot.request child spans still show real, non-zero, correctly-accumulating cost:
awf.ai_credits=2.5404, awf.ai_credits_total=17.29828
awf.ai_credits=1.69931, awf.ai_credits_total=27.79273
confirming AWF's own proxy is logging real data throughout the run — it just never reaches the summary/OTLP layer, consistent with the hardcoded-path analysis above rather than a data-loss issue.
(Initially reported this as a v0.89.20→v0.90.0 version regression before tracing the code — it isn't; the v0.89.20 comparison run happened to be on vm-poc, not arc-dind. This is an arc-dind topology gap present since arc-dind support was added, same as #63717, just not exercised/reported until now.)
Also confirmed on our own runs: Log path not found: /tmp/gh-aw/pi-streaming.jsonl in the job log alongside Removed symbolic link before artifact upload: /tmp/gh-aw/pi-streaming.jsonl — the #63717 workaround (mount + pre-touch) is applied and fixes the exit-1 crash, but the summary/OTLP gap above persists independently, since it's a different file entirely.
Implementation Plan
- Make the arc-dind path rewrite apply to every consumer, not just the engine command. Either:
- Extend
rewriteArcDindPath()/rewriteArcDindEngineCommand()(pkg/workflow/awf_arc_dind.go) to also cover the generatedparse_token_usage.cjsstep's own path constants when compiling forrunner.topology: arc-dind, or - Have
parse_token_usage.cjsresolve these paths via${{ runner.temp }}/gh-aw/...(an env var already available to the step) instead of a hardcoded literal, falling back to/tmp/gh-aw/...when unset/equal — same fix shape as engine: pi on runner.topology arc-dind exits 1 after a successful run: tee target rewritten onto AWF's read-only ${RUNNER_TEMP}/gh-aw mount #63717's proposed fix for the pi streaming log.
- Extend
- Audit every other hardcoded
/tmp/gh-awliteral in a step that runs outside the sandbox, not just this file —generateAgentStepSummaryAppend()and the "Write agent output placeholder" step (pkg/workflow/compiler_yaml_ai_execution.go) use the same literal pattern and may have the same gap; worth the broader sweep engine: pi on runner.topology arc-dind exits 1 after a successful run: tee target rewritten onto AWF's read-only ${RUNNER_TEMP}/gh-aw mount #63717's own plan already called for ("audit other engines for the same pattern") extended to post-sandbox parsing steps in general. - Tests: a
runner.topology: arc-dindcase inparse_token_usage.test.cjsassertingmain()still finds/reports real AIC when the underlying files exist only under the rewritten path, not the literal one.
No workaround available from workflow frontmatter for this one (unlike #63717's) — the read-side paths are compiled into the generated step, not configurable per-workflow.
Activity
[-]engine:pi lost AIC/turns/token rollup on summary spans between v0.89.20 and v0.90.0 (raw cost still recorded in child spans)[/-][+]gh-aw.aic/turns/gen_ai.usage.* missing on summary spans under runner.topology: arc-dind (parse_token_usage.cjs hardcodes /tmp/gh-aw, same class as #63717)[/+]lpcox commentedon Oct 2, 2026
🔗 AWF tracking issue: github/gh-aw-firewall#9352
ekbritecore commentedon Oct 6, 2026
@lpcox @pelikhan does the awf merge solve this one?