Skip to content

v0.6 reliability: stray stty job after Ctrl+Z, reattach-repaint test race - #207

Merged
raiseCatError merged 3 commits into
fix/199-pty-resize-ebadffrom
test/v06-reliability
Sep 29, 2026
Merged

raiseCatError merged 3 commits into
fix/199-pty-resize-ebadffrom
test/v06-reliability

Conversation

@raiseCatError

Copy link
Copy Markdown
Owner

Closes #206

Stacked PR. Base: fix/199-pty-resize-ebadf (PR #205), which is stacked on #204. Merge order: #204 → #205 → this PR, retargeting each to dev as the one below merges. Diff vs #205: only this fix.

1. Product fix: stray stty -echo job after Ctrl+Z (#206)

  • Symptom: under load, jobs after Ctrl+Z listed an extra suspended (tty output) job. jobs -l and ps showed it was stty -echo in state TN, stopped by SIGTTOU.
  • Cause: NMSh's managed-zsh precmd/preexec hooks ran stty as ordinary commands with job control on. Right after a job stops, zsh can run precmd before it has taken the terminal back. stty then runs as a separate job and is stopped when it changes terminal modes.
  • Fix: a nmsh_tty_echo helper runs stty with localoptions nomonitor (not a job) and localtraps + trap '' TTOU (SIGTTOU ignored for that call only), so the mode change is simply applied. The hooks' other global option changes are unchanged.
  • Evidence: this was the cause of the intermittent Ctrl+Z end-to-end failure (JOBCOUNT=1, seen locally and in CI on Multiplexer interoperability: behavior matrix and contract tests #204). The stress run of 18 parallel Ctrl+Z test processes went from 6 of 18 failing to 0 of 18.

2. Test fix: reattach-repaint race

reattach into a fullscreen app … repaint at the new size (from #128, failed once in CI on #204) detached the first window before the fixture had installed its WINCH trap, so the reattach resize could arrive first. The fixture now prints TRAP-READY, and the test waits for it. It passed 4/4 serially and 12/12 in parallel.

Verification

  • Build, typecheck and git diff --check are clean. The full suite passed 604/604 twice.
  • shellSession, powerlevel10k and inProcessSessionClient (hook compatibility) passed 3/3.
  • CI: stacked PRs get no automatic checks here (CI triggers only for dev/master), so it's run with workflow_dispatch; see the comment below.

After Ctrl+Z, zsh can run precmd before it has taken the terminal back.
NMSh's hook ran 'stty -echo' as an ordinary job, which could then be
stopped by SIGTTOU and stay in the user's job table as
'suspended (tty output)'. The hooks now change the echo mode through a
helper that runs stty outside job control with SIGTTOU ignored for that
call only, so the mode change is simply applied. This was the cause of
the intermittent Ctrl+Z test failure (a second job made JOBCOUNT=1).

Also fix a race in the reattach-repaint test: it detached before the
fixture had installed its WINCH trap, so the reattach resize could
arrive first. The fixture now reports when the trap is ready.
@raiseCatError

Copy link
Copy Markdown
Owner Author

CI (workflow_dispatch on test/v06-reliability): run 36519113625. Node 22 and Node 26 both passed.

Shells ended by service.close() write their spool afterwards, recreating
the directory the test removed; wait for them first.
@raiseCatError

Copy link
Copy Markdown
Owner Author

CI at current head 4df8bc5 (workflow_dispatch): run 36519897898. Node 22 and Node 26 both passed.

@raiseCatError
raiseCatError added this pull request to stack #210 September 29, 2026 10:19
@raiseCatError
raiseCatError merged commit c9308a5 into dev Sep 29, 2026
2 of 4 checks passed
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.

1 participant