Skip to content

make test-e2e-tui leaves engine daemons running after it exits #841

Description

@santoshkumarradha

What happened

2026-09-10, Spark, make test-e2e-tui on #835's head (64428f999), 21:01:37–21:13:38 EDT. After the suite exited, three engine daemons it had spawned were still running, reparented to init:

4147936  ppid 1  started 21:01:59  bin/aforge engine --daemon --workspace /tmp/TestTUIE2Eask_here_end_to_end172218942/002/askws
4151320  ppid 1                    bin/aforge engine --daemon --workspace /tmp/TestTUIE2Ethe_firing_reaches_the_person2969219725/002/firews
4187785  ppid 1  started 21:10:30  bin/aforge engine --daemon --workspace /tmp/TestTUIE2Ea_refused_landing_is_incomplete2235951024/002/refusedgatews

One exited by itself later. The other two stayed up, holding the binary of a worktree about to be removed, until they were stopped by hand. On a shared box every suite run leaks engines like this.

Replication

Deterministic (no model). Not without a key: the daemons are spawned by subtests that drive a real conversation.

Field (real models). Needs a provider key and tmux; about 17 minutes:

make test-e2e-tui
pgrep -fa 'engine --daemon --workspace /tmp/TestTUIE2E'

Today the pgrep prints one line per leaked daemon, with parent PID 1.

Where

  • The windows the suite drives and their teardown: start / quit in internal/e2e/tmux_test.go.
  • Where a chat window starts its engine: the engine --daemon launch in cmd/aforge (search "--daemon").

The fix

A subtest owns every engine its windows started: its cleanup stops them (by the PID the engine writes into the subtest's AFORGE_HOME, never by a process pattern) and waits for them to exit before t.TempDir is removed.

Acceptance

  • e2e: after make test-e2e-tui, pgrep -f 'engine --daemon --workspace /tmp/TestTUIE2E' prints nothing, asserted by a final check in the suite itself that fails and names any engine still running under one of its homes.
  • Unit: the teardown helper stops a stub daemon started under a temp home and returns only after it has exited.

Drafted with CodeAF · reviewed and owned by the author

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:testsThe suite itself — flakes, harnesses, laws, CI redsbugSomething the code does that it should notsev:papercutA wording, a hint, a small wrongness that costs a moment

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions