Skip to content

test(tui): reap the interactive shell fixture’s stopped job - #4703

Closed
devswha wants to merge 2 commits into
mainfrom
fix/tui-job-cleanup
Closed

devswha wants to merge 2 commits into
mainfrom
fix/tui-job-cleanup

Conversation

@devswha

@devswha devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner

What broke

In the standalone TUI PTY test, Bash reported the launcher stopped before the screen itself stopped. fg could send its continuation too early. Teardown could then leave the fixture's stopped launcher and screen behind.

Fix

Wait for the screen's actual stopped state before fg. In finally, end only the identified screen and allow its launcher and then Bash to reap their children before the PTY is closed. Production code is unchanged.

Validation

  • In an isolated Linux child-subreaper probe, main left 7 launcher/screen pairs in 80 runs; the fix left none in 70 runs.
  • bun test --timeout 30000 ./tui/host/restore.contract.test.ts passed. A separate focused process-group check also passed 60 times. Native macOS was not exercised.
  • Re-ran bun run check fast with a shorter TMPDIR and six unit workers. Workflow syntax, generated-file checks, typecheck, and build passed; the unit stage reached the 510-second command deadline (exit 124) without a reported assertion failure before interruption. A prior remote run failed on the same account invite case as main CI's Fast checks. Publishing with that validation gap per the lead's decision.
  • After the review fix: 30 PTY contract tests passed, and the reap regression passed 40 repeated runs; bun run typecheck and bun run build passed on the final code.

Review notes

Codex reviewed c42d2c2f7f6bc05455904ac32c119f6f8a1d614f once. Fixed the reproduced medium finding that killing a whole process group could orphan the screen. The previous group-ID reuse concern was not reproduced; teardown now checks exact process identities and no longer signals the entire group.

Closes #4562

@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b0f20e7 and 52553fa.

Files selected for processing: 4

  • changelog.d/tui-job-test-cleanup.md
  • tui/host/restore.contract.test.ts
  • tui/testing/host-fixture.ts
  • tui/testing/launcher-fixture.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devswha

devswha commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #4725

@devswha devswha closed this Nov 25, 2026
devswha added a commit that referenced this pull request Nov 25, 2026
…xture (#4725)

## Changes

- [#4701 — Preserve last-pane
history](#4701). In an isolated
core, a picker jump from a zoomed pane returned `layout_conflict`: the
screen stayed on `t2`, but the previous-pane history changed to `t1`.
Preserve history through the tentative focus change and intervening
refresh; record the pane left only after confirmation. Codex reviewed
`478825873`; its reproduced refresh finding was fixed in `0ed0033cc`.
[CodeRabbit was
rate-limited](#4701 (comment)).

  Closes #4519

- [#4702 — Use the intended launcher
target](#4702). Isolated PTY probes
reproduced the wrong core with a non-default Herdr plugin session and a
relative socket; launcher fixtures reproduced inherited SSH X11
settings, the wrong desktop session, and one request to an unrelated
listener after the app stopped. Share plugin-config lookup, resolve the
socket relative to the calling shell, drop forwarded X11 settings only
for a newly started core, and verify the desktop server record and
listener before using its port. Codex reviewed `672d07e8a`; its three
reproduced findings (shutdown port reuse, standalone TUI gating, and
legacy launcher validation) were fixed in `1869a756c`. [CodeRabbit was
rate-limited](#4702 (comment)).

  Closes #4577  
  Closes #4576  
  Closes #4561  
  Closes #4463  
  Refs #4460 (partly: the remaining gaps are listed on the issue)

Bundle follow-up `e5f6cad72` restores the desktop `start`/`stop`
guidance that the new listener check masked. These commands do not
contact the server; commands that use its port still require a valid
listener record.

- [#4703 — Synchronize the stop-and-continue
fixture](#4703). An isolated Linux
child-subreaper probe found seven launcher/screen pairs left behind in
80 runs on main. Wait for the screen itself to stop before `fg`, then
let the launcher reap the screen and Bash reap the launcher. Production
code is unchanged by this source PR. Codex reviewed `c42d2c2f7`; its
reproduced teardown finding was fixed in `52553fac1`. [CodeRabbit was
rate-limited](#4703 (comment)).

  Closes #4562

Supersedes #4701 #4702 #4703

## Validation

- Linux: 14 focused zoom and last-pane tests passed; 197 launcher tests
passed (one Windows-only case skipped); all 30 terminal-restoration PTY
tests passed.
- The real `ovis tui` entry rendered an isolated test pane and detached
in both PTY probes: a non-default session discovered through the Herdr
plugin and a relative core socket.
- The stop-and-continue regression passed 40 repeats; the isolated
process-group check passed 60 repeats.
- `bun run typecheck` and `git diff --check origin/main...HEAD` passed.
- The existing desktop lifecycle regression failed on the initial bundle
and passed after `e5f6cad72`. The first fast run also hit an unrelated
SSH Unix-socket path-length failure; all three tests in
`server/ssh-account-add.test.ts` passed with a shorter `TMPDIR`.
- `bun run check fast` passed on `e5f6cad72` with the shorter `TMPDIR`:
27,969 unit tests passed, 0 failed, 247 skipped.
- Native macOS and Windows were not exercised.

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(tui): the stop-and-continue contract case sometimes leaves a stopped launcher and screen behind

1 participant