GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(ssh): zombie-reap launch test no longer races the shell by tris203 · Pull Request #20052 · pingdotgg/t3code

Conversation

@tris203

@tris203 tris203 commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Problem

launch script > replaces a managed server that exited but was not reaped in packages/ssh/src/tunnel.test.ts fails intermittently on CI with AssertionError: expected '' to include 'Z' (example run, on a PR that does not touch packages/ssh).

The test built its zombie with sh -c "sleep 600 & echo $!; exec sleep 600", killed the background pid as soon as it was printed, and then expected ps to report Z. When the kill lands before sh reaches exec, dash is still the parent and reaps the child: on SIGCHLD it runs wait4(-1, WNOHANG) between commands. No zombie is left, so ps prints nothing.

Change

The test now kills the child only after sh has exec'd into node. Node does not reap a child it did not spawn, because libuv only waits on its own process handles. Node prints the pid from its SIGCHLD handler, which the kernel only sends once the child is a zombie. The test reads that line instead of waiting on a timer, so it now checks ps once. That replaces the polling loop #15715 added for the same flake. The rest of the test is unchanged.

Scope and approval

Test-only fix for an obvious flake, with one problem in one file and no product behavior change, so it qualifies as a very small, focused fix without a prior issue.

Verification

  • Root cause. On Linux with dash, strace of the old shape showed dash reaping the background child with wait4(-1, WNOHANG) after SIGCHLD and before exec. Widening the window between echo and exec with a builtin-only busy loop reproduced the empty ps output in 9 of 10 runs.
  • Polling loop on main. The loop fix(web): show minimap previews as plain text, not raw markdown #15715 added covers a kill that has not finished yet, but not this reap. A standalone repro of main's exact check passed 100 of 100 times with the natural timing. With the kill forced before exec, it failed 10 of 10 times, exiting 1 with empty output: ps finds no process and the loop exits at once.
  • Still failing on main with the loop. In the first five hours after fix(web): show minimap previews as plain text, not raw markdown #15715 merged, this test failed 5 times at the loop's own assert.equal(zombieState.exitCode, 0, zombieState.stdout) (tunnel.test.ts:1472). Four were pushes to main that include fix(web): show minimap previews as plain text, not raw markdown #15715 (1, 2, 3, 4) and one was a PR run. Each message is a bare expected 1 to equal +0 with no loop output in front of it. Empty output means ps found no process on its first try: the child had already been reaped. A child still dying would have printed S or R. These came from the logs of all 128 failed test jobs in CI runs since fix(web): show minimap previews as plain text, not raw markdown #15715 merged.
  • New setup. A standalone script performing the same steps as the test produced a zombie 100 of 100 times idle and 100 of 100 times with every core saturated by busy loops.
  • Focused test. vp test run packages/ssh/src/tunnel.test.ts -t "replaces a managed server that exited but was not reaped" passed 50 of 50 runs idle and 50 of 50 with all cores loaded. The same loops passed again after rebasing onto current main, and a full run of tunnel.test.ts passed 34 of 34. vp lint and vp fmt --check on the file are clean.
  • Not checked. macOS was not run. /bin/sh there is bash, whose own reaping is the same hazard the new setup avoids, but this is unverified on a Mac.

Written with Claude Opus 5.5 in Claude Code (T3 Code); reviewed with GPT-6.1-Sol in Codex.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 15, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 15, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This is a small, ignored test-only fix with no apparent product-runtime change. The modified file is within the SSH/authentication-sensitive package, so human review is required under the safety criteria.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8905c2df-d8ad-41e5-add6-515f3ff2f20e
📥 Commits

Reviewing files that changed from the base of the PR and between 1cae508878a1063710569725bf8a65cd5e921f2a and b3d651a.

📒 Files selected for processing: 1
  • packages/ssh/src/tunnel.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The zombie-process test replaces shell-based polling with a Node-controlled fixture. The fixture kills the child after SIGCHLD, prints its PID, and verifies that ps reports zombie state before testing replacement.

Changes: SSH tunnel zombie-process test

Layer / File(s) Summary
Zombie-process test setup
packages/ssh/src/tunnel.test.ts
The test uses a Node-controlled child process fixture. It prints the child PID after the child is killed and SIGCHLD is received. The test directly verifies the zombie state and retains the replacement check.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to b3d65

The test-only change has no identified issue blocking merge, subject to normal checks.

Architecture risk: 🔵 Low · up to b3d65

The change affects 1 system.

Changed systems: packages/ssh

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/ssh (library) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/ssh/src/tunnel.test.ts: The test replaces its shell-based zombie setup and polling loop with a Node-controlled fixture: sh starts sleep, execs into Node, Node kills the child after SIGCHLD, prints its PID, and the test directly verifies ps reports Z.
Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing a race in the SSH zombie-reaping launch test.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the failure, fix, scope rationale, focused verification results, unteste…
Full details: Description check

Explanation

The pull request description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the failure, fix, scope rationale, focused verification results, untested macOS coverage, and the agent and harness used.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@only21mil only21mil mentioned this pull request Oct 17, 2026
fix(codex): end the session when an incoming message is too long #19733
Merged
@tris203
test(ssh): zombie-reap launch test no longer races the shell
b3d651a
The test killed the background child as soon as sh printed its pid. If the
kill landed before sh exec'd, dash's SIGCHLD handling reaped the child, so
no zombie was left and ps printed nothing.

Kill the child only after sh has exec'd into node, which never reaps an
inherited child, and print its pid once SIGCHLD confirms it is a zombie.
@tris203
tris203 force-pushed the fix/ssh-tunnel-zombie-test-flake branch from 1cae508 to b3d651a Compare October 20, 2026 07:01
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 20, 2026 07:01

Dismissing prior approval to re-evaluate b3d651a

@Alb11747 Alb11747 mentioned this pull request Oct 20, 2026
[Bug]: Flaky browser and server tests on 4-vCPU CI runners, and a Windows-only update.test.ts failure #22324
Closed
2 tasks done
This was referenced Oct 20, 2026
test(ssh): unreaped-server launch test races the zombie state toolboxmd/chromeria#589
Closed
test(ssh): establish the zombie fixture before checking replacement toolboxmd/chromeria#591
Merged
@tris203

tris203 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Note

Claude Opus 5.5 responding on behalf of @tris203

Closing: #22427 fixed the same race, where dash reaps the killed child before exec. It waits for the parent to exec before killing the child, and no test job that has failed in CI since it merged shows this test failing. What's left here would only swap those ps loops for the SIGCHLD signal, which isn't worth a separate PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tris203 tris203 closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@tris203
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.