Skip to content

test: report the sibling-recycle child's state when it stalls - #6893

Merged
lidge-jun merged 1 commit into
devfrom
codex/4956-sibling-child-diagnostics
Oct 10, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/4956-sibling-child-diagnostics

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

The "an ended link recycles a connected sibling after listener cleanup" case in tests/clients/client-link-runtime.test.ts spawns a Bun child with piped stdout and stderr and, until the last wait, never reads either. On Windows CI the child once wrote no readiness marker for 45.9 s (run 38041407670, attempt 3, windows 6/9); the test failed with timed out waiting for connected client readiness and nothing about the child. That is the #4956 signature: the process exists and shows no progress. The same case passed on the job rerun.

This makes the next occurrence diagnosable instead of silent:

  • Both pipes are drained from spawn into buffers that keep the last 4000 characters each, the same pattern chore(ci): consolidate development hooks and hosted reliability fixes #5509 introduced for the reset-credit two-process case.
  • The readiness, recycle-exit and replacement waits now fail with the child's pid, exit code and recent stdout/stderr appended.
  • The replacement wait no longer opens a second reader on child.stderr, which would conflict with the drain's reader lock.
  • Cleanup waits at most 2 s for the drain after the child exits; the replacement runtime logs to a file, so the pipes close with the child.

No production code changes. This does not claim a cause for #4956 (Bun already reads spawned pipes eagerly, so an unread pipe is not established as the stall), and the issue should stay open.

Refs #4956

Verification

  • bun test tests/clients/client-link-runtime.test.ts: 6 pass, 0 fail (macOS).
  • bun run typecheck: exit 0.
  • Independent review of the plan (read-only gpt-6-sol leaf): near-pass, findings folded (diagnostics framing, bounded buffers, bounded drain wait).
  • Hosted: Cross-platform CI on this head, including the Windows shards.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (Test-only.)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (Diagnostics contain only fixture child output from a temp home.)

Summary by CodeRabbit

  • Tests
    • Test timeout errors now include client process details and recent output, making failures easier to diagnose.
    • Test cleanup allows up to two seconds for output collection to finish.

The connected-sibling recycle case spawns a Bun child with piped stdout and stderr and, until the replacement wait, never looked at either. On Windows CI the child once wrote no readiness marker for 45.9 s and the test failed with a bare timeout, leaving no trace of what the child was doing (#4956 family). Drain both pipes from spawn into bounded buffers and append the child's pid, exit code and recent output to every wait's timeout. The replacement wait no longer opens a second reader on an already drained stream.

Refs #4956
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 10, 2026 11:21
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T11:23:25.227861Z dc9fa3a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

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: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c450088b-4a73-415e-8076-e5eb12452d69

📥 Commits

Reviewing files that changed from the base of the PR and between 84b9e88 and dc9fa3a.


📒 Files selected for processing (1)
  • tests/clients/client-link-runtime.test.ts

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



📝 Walkthrough

Walkthrough

The sibling-recycle test retains the spawned client process and drains stdout and stderr concurrently. Readiness, exit, and replacement-runtime wait failures now include the process PID, exit code, and recent output. Cleanup waits up to two seconds for output draining to finish.

Changes

Client test diagnostics

Layer / File(s) Summary
Capture output and report wait failures
tests/clients/client-link-runtime.test.ts
The test drains both output streams and retains their latest 4,000 characters. Wait failures include the PID, exit code, and latest 700 characters from each stream. Cleanup waits up to two seconds for the drain tasks. Changes are at lines 99, 126–149, 157–164, and 172.

Priority: ⬇️ Low

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

Change: Other


Merge Risk: ⚪ Minimal · up to dc9fa

This change only improves failure diagnostics in a test and does not alter production behavior. It carries no identified merge risk.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding diagnostics for a stalled sibling-recycle child process. It matches the test-only changes in tests/clients/client-link-runtime.test.ts…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • 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

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

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Oct 10, 2026
@lidge-jun
lidge-jun merged commit 3649d58 into dev Oct 10, 2026
32 of 34 checks passed
@lidge-jun
lidge-jun deleted the codex/4956-sibling-child-diagnostics branch October 10, 2026 12:01
@lidge-jun lidge-jun mentioned this pull request Oct 10, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant