test(acpmux): a gated fake agent exits with its daemon
A test that stopped its daemon before opening FAKE_START_GATE left the gated fake_agent.py polling forever. It runs in its own process group (process_group(0)), so the daemon's SIGTERM never reached it, and its gate loop never read stdin. machine-mesh counted 257 of them on huge-blue (2026-10-21). The 13 I inspected were all aas-<tag>-<pid>/gate pollers from person_auto_start.rs.
fake_agent.py: while it waits at the gate, it selects on stdin. EOF ends it: the daemon is gone, even after a SIGKILL of the test binary. Bytes that arrive first are kept and read after the gate.person_auto_start.rs: theDaemondrop kills a daemon that hasn't stopped within 10 s, so a hung shutdown can't keep its agents' stdin open.- New test
auto_start_a_gated_agent_exits_with_its_daemon_and_keeps_what_came_first: a gated agent exits when its stdin closes, and aninitializesent before the gate opens still gets its reply.
Test-only; no product code changes.
Changelog
none
Observed / Not run
Observed, on cmux16 (cargo test --locked -p acpmux --test person_auto_start):
- base
fake_agent.pywith the new test: FAILED, "a gated agent outlived the stdin of its daemon"; - head: 15 passed, and no
aas-gateagents left afterwards; - the other gate users pass on head:
hub_integrationan_agent_that_never_answers_its_start_fails_with_a_deadline and lib a_prompt_is_accepted_when_recorded_before_the_agent_starts.
Not run: the full acpmux suite (left to CI).
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes gated fake agents that polled forever after their daemon died, leaving orphan processes behind (257 on huge-blue, 2026-10-21). A gated agent now selects on stdin while waiting at the start gate: stdin EOF ends it, and bytes received early are kept until the gate opens. The test Daemon drop also kills a daemon that won't stop within 10s, so a hung shutdown can't hold its agents' stdin open. Adds a test covering both behaviors. Test-only; no product code changes.