Skip to content

bug: TestACPConformance/SharedSession/Nudge_RunningSession flaky — broken pipe on ACP teardown race #716

@rileywhite

Description

@rileywhite

Before you continue

  • I searched existing issues and did not find a duplicate.
  • I read the relevant docs and contributor guidance.

Gas City version

0.14.1 (commit: f2fb908d, built: 2026-04-14T15:26:26Z)

Environment

Ubuntu 24.04, x86_64, GitHub Actions runner (ubuntu-latest)

Reproduction

This is a flaky failure observed in CI — not reliably reproducible on demand. The failure appears during the ACP conformance test suite:

go test ./internal/runtime/acp/... -count=1 -race

The test sporadically fails in TestACPConformance/SharedSession/Nudge_RunningSession. It does not fail consistently, and main branch CI passes across recent runs. The observed failure occurred on PR #714's CI run.

Expected behavior

TestACPConformance/SharedSession/Nudge_RunningSession passes (and the conformance suite overall completes cleanly without pipe errors).

Actual behavior

The test fails with a broken-pipe error when Nudge attempts to write to a session that has already closed its stdin/stdout:

--- FAIL: TestACPConformance (0.68s)
    --- FAIL: TestACPConformance/SharedSession (0.01s)
        --- FAIL: TestACPConformance/SharedSession/Nudge_RunningSession (0.00s)
            conformance.go:574: Nudge: sending prompt to "gc-acp-conform-33": write: write |1: broken pipe
FAIL
coverage: 76.7% of statements
FAIL	github.com/gastownhall/gascity/internal/runtime/acp	4.138s

The failure is preceded by 30+ repeated log lines indicating the ACP child process closed its read pipe before the harness finished writing:

acp: readLoop exit: read |0: file already closed
acp: readLoop exit: read |0: file already closed
... (repeating ~30 times)

This suggests a teardown race: the conformance harness calls Nudge on a session that has already begun tearing down its stdin/stdout pipes.

Logs, screenshots, or traces

Check	Test	2026-04-14T21:48:36Z acp: readLoop exit: read |0: file already closed
Check	Test	2026-04-14T21:48:36Z acp: readLoop exit: read |0: file already closed
... (30+ repetitions)
Check	Test	2026-04-14T21:48:36Z --- FAIL: TestACPConformance (0.68s)
Check	Test	2026-04-14T21:48:36Z     --- FAIL: TestACPConformance/SharedSession (0.01s)
Check	Test	2026-04-14T21:48:36Z         --- FAIL: TestACPConformance/SharedSession/Nudge_RunningSession (0.00s)
Check	Test	2026-04-14T21:48:36Z             conformance.go:574: Nudge: sending prompt to "gc-acp-conform-33": write: write |1: broken pipe

Full CI run: https://github.com/gastownhall/gascity/actions/runs/24424517638 (job 71355195886)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugBroken behaviorpriority/p2Medium — real problem, workaround exists

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions