gh-aw icon indicating copy to clipboard operation
gh-aw copied to clipboard

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

Open ekbritecore opened this issue 2 months ago • 5 comments

Analysis

Under runner.topology: arc-dind, rewriteArcDindEngineCommand() (pkg/workflow/awf_arc_dind.go) rewrites every /tmp/gh-aw occurrence in the engine command to ${RUNNER_TEMP}/gh-aw:

func rewriteArcDindPath(path string) string {
	return strings.ReplaceAll(path, constants.TmpGhAwDir, awfArcDindRootPathExpr)
}

For pi this includes the streaming log that buildPiCommand() (pkg/workflow/pi_engine.go) pipes to:

... pi ... 2>&1 | tee /tmp/gh-aw/pi-streaming.jsonl      # PiStreamingLogFile
→ ... pi ... 2>&1 | tee ${RUNNER_TEMP}/gh-aw/pi-streaming.jsonl   # compiled, arc-dind

But the agent container mounts ${RUNNER_TEMP}/gh-aw read-only; appendArcDindMountSettings() (pkg/workflow/awf_command_builder.go) only adds rw mounts for ${RUNNER_TEMP}/gh-aw/home and ${RUNNER_TEMP}/gh-aw/sandbox/agent:

--mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro"
--mount "${RUNNER_TEMP}/gh-aw/home:${RUNNER_TEMP}/gh-aw/home:rw"
--mount "${RUNNER_TEMP}/gh-aw/sandbox/agent:${RUNNER_TEMP}/gh-aw/sandbox/agent:rw"

So tee fails to open its file, and the step's set -o pipefail turns pi's success into exit 1. The agent job fails and safe outputs the agent already emitted are never processed.

Secondary: GH_AW_AGENT_OUTPUT / the log parser still point at /tmp/gh-aw/pi-streaming.jsonl (not rewritten), while artifact upload uses ${{ runner.temp }}/gh-aw/pi-streaming.jsonl, so parsing and upload disagree on arc-dind.

Reproduction

  • gh-aw v0.89.21 (AWF v0.28.23), ARC DinD, DOCKER_HOST=tcp://127.0.0.1:2375, runner.topology: arc-dind, engine: { id: pi, model: copilot/claude-sonnet-5 }, one MCP server, one add-comment safe output.
  • Compile the same workflow with and without runner.topology: the tee target is ${RUNNER_TEMP}/gh-aw/pi-streaming.jsonl vs /tmp/gh-aw/pi-streaming.jsonl.
  • Run log: pi completes normally (model 200s, MCP tool call, add_comment accepted, agent_settled), then:
tee: /home/runner/_work/_temp/gh-aw/pi-streaming.jsonl: Read-only file system
[pi-harness] attempt 1: process closed exitCode=1 duration=8s stdout=121082B stderr=904B
##[error]Agent execution exited with code 1
  • With the workaround below applied (run green), the step-summary parser still misses the file:
Parse agent logs for step summary   GH_AW_AGENT_OUTPUT: /tmp/gh-aw/pi-streaming.jsonl
Log path not found: /tmp/gh-aw/pi-streaming.jsonl

Implementation Plan

  1. Write the pi streaming log to an arc-dind writable path (pkg/workflow/pi_engine.go): when isArcDindTopology(workflowData), use ${RUNNER_TEMP}/gh-aw/sandbox/agent/pi-streaming.jsonl (already rw) for the tee target, or exempt the tee target from rewriteArcDindPath and keep a path the agent can write.
  2. Keep producer and consumers consistent: GetLogFileForParsing(), GetDeclaredOutputFiles(), GH_AW_AGENT_OUTPUT, and artifact upload paths should all resolve to that same file under arc-dind.
  3. Audit other engines for the same pattern: any engine command writing to /tmp/gh-aw/<file> outside home/ or sandbox/agent/ breaks the same way after rewriteArcDindEngineCommand().
  4. Tests (pkg/workflow/awf_arc_dind_test.go / pi_engine_test.go): for pi + arc-dind, assert the tee target sits under a path that appendArcDindMountSettings() mounts rw, and that parser/upload paths match it.

Workaround (verified end-to-end on ARC DinD)

Pre-create the file and mount it rw over the ro parent:

steps:
  - name: Pre-create pi streaming log
    run: touch "${RUNNER_TEMP}/gh-aw/pi-streaming.jsonl"
sandbox:
  agent:
    mounts:
      - "${{ runner.temp }}/gh-aw/pi-streaming.jsonl:${{ runner.temp }}/gh-aw/pi-streaming.jsonl:rw"

(${RUNNER_TEMP} doesn't work in mounts:: the compiler single-quotes it, so it's never expanded.)

ekbritecore avatar Sep 27 '26 00:09 ekbritecore

🔗 AWF tracking issue: github/gh-aw-firewall#9183

Generated by Firewall Issue Dispatcher · copilot · auto · 23.2 AIC · ⊞ 9.1K · ◷

lpcox avatar Sep 29 '26 12:09 lpcox

Found a sibling instance of this same root-cause class (hardcoded /tmp/gh-aw literal, never rewritten for runner.topology: arc-dind) in a different file: actions/setup/js/parse_token_usage.cjs — affects gh-aw.aic/gh-aw.turns/gen_ai.usage.* on the summary spans and the Step Summary token table, not the pi streaming log this issue covers. Filed as #64344 with the same Analysis/Reproduction/Implementation-Plan structure, since it's a distinct file/fix even though it's the same underlying gap.

ekbritecore avatar Sep 29 '26 20:09 ekbritecore

@copilot review status

pelikhan avatar Oct 01 '26 17:10 pelikhan

@ekbritecore file new (linked) issues so we track https://github.com/github/gh-aw/issues/63717#issuecomment-5898747514 otherwize it does not fit in the machinery.

pelikhan avatar Oct 01 '26 17:10 pelikhan

AND THANKS FOR REPORTING ISSUES!!!!

pelikhan avatar Oct 01 '26 17:10 pelikhan