Skip to content

test(acpmux): a gated fake agent exits with its daemon - #22936

Merged
teamleaderleo merged 3 commits into
feat-cmux-nextfrom
cmux/fake-agent-orphans
Oct 21, 2026
Merged

teamleaderleo merged 3 commits into
feat-cmux-nextfrom
cmux/fake-agent-orphans

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

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: the Daemon drop 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 an initialize sent 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.py with the new test: FAILED, "a gated agent outlived the stdin of its daemon";
  • head: 15 passed, and no aas-gate agents left afterwards;
  • the other gate users pass on head: hub_integration an_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


View with [code]smith Autofix with [code]smith
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.

Written for commit 03eda2d. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits October 20, 2026 21:35
The FAKE_START_GATE loop polls for its gate file and never reads stdin, so
a test that stops its daemon before opening the gate leaves the agent (in
its own process group) polling forever: 257 were left on huge-blue
(2026-10-21). Red: the agent outlives its closed stdin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15bf1-fdac-78a0-ac2e-a3aef81402c7&host=cosmic-gray
While it waits at FAKE_START_GATE it now selects on stdin: EOF (the daemon
that started it is gone, even after a SIGKILL) ends it, and lines that
arrive first are kept for after the gate. person_auto_start's Daemon drop
kills a daemon that does not stop within 10 s, so a hung shutdown never
holds its agents' stdin open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15bf1-fdac-78a0-ac2e-a3aef81402c7&host=cosmic-gray
@teamleaderleo teamleaderleo added the risk:low Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 21, 2026 04:35 — with GitHub Actions Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

owner: 01a15bf1-fdac-78a0-ac2e-a3aef81402c7

1 similar comment
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

owner: 01a15bf1-fdac-78a0-ac2e-a3aef81402c7

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 03eda2d: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr22936 -f ref=cmux/fake-agent-orphans -f platform=macos -f backend_mode=local

Review: splitlines() also breaks at U+2028/U+2029, which serde_json writes
unescaped, and strict UTF-8 differs from stdin's own decoding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15bf1-fdac-78a0-ac2e-a3aef81402c7&host=cosmic-gray
@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 21, 2026 04:38 — with GitHub Actions Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-4wv29 created for this PR by the cmux coordinator.

@teamleaderleo
teamleaderleo merged commit f70e7fe into feat-cmux-next Oct 21, 2026
@teamleaderleo
teamleaderleo deleted the cmux/fake-agent-orphans branch October 21, 2026 04:44
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review: independent subagent PASS. The low note on how pre-gate lines split was fixed in 03eda2d. Compile: cmux-next fast tier (cargo) passed on this head, and cargo test -p acpmux --test person_auto_start compiled and passed (15 tests) on cmux16 at this head's Rust. No Swift changed. Remaining reds: defaults-snapshot, a base red (stale optchat inspector bundle; #22877 fixes it). Fast tier and Release compile were cancelled by the owned-pool rescue before they ran.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This branch had an error being deployed

1 failed and 2 inactive deployments
artifacts — 03eda2d8 Deployed Oct 21, 2026 by teamleaderleo
sentry-dsyms — 03eda2d8 Deployed Oct 21, 2026 by teamleaderleo
cmux-tui-merge-tree — 03eda2d8 Deployed Oct 21, 2026 by teamleaderleo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant