flake: TestAgent_Session_EnvironmentVariables
- Dominant language
- No language data
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
CI Run: https://github.com/coder/coder/actions/runs/26794065833
Failing job: https://github.com/coder/coder/actions/runs/26794065833/job/78987123522 (test-go-pg windows-2022)
Commit under test:
- https://github.com/coder/coder/commit/550aa6d6a22b5f9522595fc315d2f02b6c318cc1 (Thomas Kosiewski)
Failure signature:
```
=== FAIL: agent TestAgent_Session_EnvironmentVariables/CODER (0.00s)
agent_test.go:433:
Error: Received unexpected error:
EOF
--- FAIL: TestAgent_Session_EnvironmentVariables/CODER (0.00s)
=== FAIL: agent TestAgent_Session_EnvironmentVariables/MY_MANIFEST (0.00s)
agent_test.go:433:
Error: Received unexpected error:
EOF
=== FAIL: agent TestAgent_Session_EnvironmentVariables/MY_OVERRIDE (0.00s)
agent_test.go:433:
Error: Received unexpected error:
EOF
=== FAIL: agent TestAgent_Session_EnvironmentVariables/MY_SESSION_MANIFEST (0.00s)
agent_test.go:433:
Error: Received unexpected error:
EOF
```
Context:
- In `agent/agent_test.go` (around lines 420-470), `TestAgent_Session_EnvironmentVariables` starts `cmd.exe`/`sh` and uses a shared `bufio.Scanner` to read stdout. Each subtest scans until a matching env var value is found, then checks `s.Err()` and expects only EOF. The failure is thrown at the `s.Err()` check (`errors.Is(err, io.EOF)`), which implies the scanner hit EOF before the expected output was observed.
- No data race, panic, or OOM indicators found in logs.
Root cause (best guess):
- Flaky Windows SSH session output collection. The shared scanner can reach EOF before the echoed env var output is observed (timing/PTY/session lifecycle), causing the EOF to be treated as unexpected.
Assignment analysis:
- Intended blame step: `git blame -L 430,470 agent/agent_test.go` (failing function range). Blame could not be derived from the shallow CI checkout; no direct line-level author available in this environment.
- Next step used: `git log --oneline -10 --follow agent/agent_test.go` and `git log --oneline -20 agent/` to identify recent, meaningful owners in the agent/test area.
- Assigning to @mafredri as the primary agent-area maintainer based on recent ownership across `agent/` and related test fixes.
Related issues (not duplicates):
- https://github.com/coder/internal/issues/792 (agent ReconnectingPTY EOF)
- https://github.com/coder/internal/issues/1289 (cli EOF in SSH stdio)
Suggested reproduction:
- Windows runner: `go test ./agent -run TestAgent_Session_EnvironmentVariables -count=50`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.