## TL;DR
`TestAgent_ReconnectNoLifecycleReemit` failed once on a Windows nightly
run. The test checks that an agent does not report its lifecycle states
a second time after it reconnects. Before that check, it waited up to 10
seconds for a startup script, `echo hello`, to finish. On the Windows
runner the shell process took 11 seconds, so the test failed during
setup and never reached the reconnect check. The script is not needed
for what the test checks, so this PR removes it. The test no longer
depends on how fast the host shell starts.
Refs
https://linear.app/codercom/issue/CORE-665/flake-testagent-reconnectnolifecyclereemit-windows-startup-readiness
<details>
<summary>How to navigate this PR</summary>
- Test code only. One file, 5 lines deleted, no production change.
- `agent/agent_test.go`: the `Scripts` entry is removed from the
manifest in `TestAgent_ReconnectNoLifecycleReemit`. Check that nothing
later in the test reads the script or its output.
</details>
<details>
<summary>Implementation</summary>
- `agent/agent_test.go`: removed the `echo hello` startup script from
the manifest passed to `agenttest.NewClient`.
- The wait for the `ready` state is unchanged. With no start scripts the
agent still reports `starting` then `ready`, so the wait now depends on
the agent alone.
- The wait was not raised to a longer timeout. That would make the
failure less likely but leave the dependency on the host shell in place.
- No reconnect coverage is given up. The agent reports `ready` only
after start scripts return, so the script had always exited before the
test disconnected. The only script work that could overlap the reconnect
was its completion report, and the test has no assertion on it.
</details>
<details>
<summary>Expected Output</summary>
- The test reaches the `ready` state without starting a shell process.
- After a disconnect and reconnect, the reported lifecycle states are
the same list as before: `starting`, `ready`.
- If the agent reports its states again after a reconnect, the test
still fails with "lifecycle states should not be re-reported after
reconnect".
</details>
<details>
<summary>Testing</summary>
- `TestAgent_ReconnectNoLifecycleReemit` in `agent/agent_test.go` is the
only test changed.
- `go test ./agent -run '^TestAgent_ReconnectNoLifecycleReemit$'
-count=3` passes on macOS.
- Checked that the test still catches the bug it guards. With the agent
temporarily changed to report its states again on every reconnect, the
test without the script failed with the expected states `starting`,
`ready` and the actual states `starting`, `ready`, `starting`, `ready`.
This check was run on an earlier `main` commit with the same test
change, and the agent change was reverted.
- Forced the original failure locally to confirm the cause. With the
script changed to `sleep 11` the old test failed at the same wait with
the same message as the nightly run. With `sleep 9` it passed.
- Not run on Windows locally. The Windows CI job on this PR is the first
Windows run of the change.
</details>