Skip to content

test(cli): await sibling startup completion instead of a polling deadline - #8062

Merged
lidge-jun merged 1 commit into
devfrom
goat/windows-sibling-start-readiness
Oct 31, 2026
Merged

lidge-jun merged 1 commit into
devfrom
goat/windows-sibling-start-readiness

Conversation

@lidge-jun

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

Copy link
Copy Markdown
Owner

Summary

  • Fix the sibling-start fixture used by the failed dev batch 41218193787, Windows 5/11 job 124587099192 at d5708c37c0235194c1d7bdba63bdc587099f6fcf. It now awaits the real CLI's existing Client startup work complete. output event or child exit, then asserts the runtime PID/port and /readyz identity/status. Both pipes are drained immediately; early exit or stdout EOF/read failure reports bounded output tails and exit state. Existing test budgets are unchanged.
  • The failed child had started and read the expected sibling config; it was still alive when the 45-second record-polling deadline expired. The log contains no crash/early-exit report, no runtime record, no stdout, and no socket rows for its requested port. The config warning identifies the expected ocx-sibling/config.json. Production publishes runtime-port.json under OPENCODEX_HOME after bind and before the startup-complete signal. The confirmed harness defect is imposing a startup latency deadline and then killing a still-running child. The historical log does not trace the exact pre-bind stage, so slow initialization versus a stall inside that stage remains unproven; this PR makes no production-race or port-contention claim.
  • Verified with git log and git diff that the intervening merges are fix(anthropic): support Ultra quota windows and show subscription names #8055 (Anthropic quota/GUI) and test(messaging): verify handle closure without racy fd probes #8058 (messaging test only), with no changes to CLI start, sibling handoff, runtime records, or port selection. Queried runs 41205004779 (67bdeb03a3) and 41214537933 (e972776ece): all 11 Windows shards succeeded in each.
  • Reuse tests/helpers/startup-child-output.ts, found by searching for the CLI's startup-complete marker, rather than adding a production hook. Preserve routing/journal/handoff/stop assertions and allowlisted runtime diagnostics. No new test files or layout/baseline changes are needed.

Verification

Windows host, Bun 1.4.4:

  • Deterministic red-before-green: the new clock-jump regression failed with the former polling-deadline algorithm despite receiving the completion marker, then passed with event-based waiting. No real delay was introduced. A scratch probe also exercised the pristine failed-head waitFor implementation: the same published record was accepted at elapsed 0 and rejected at simulated elapsed 90,000 ms. This proves the deadline failure mechanism, not reproduction of the hosted runner's internal stall.
  • bun test tests/cli/cli-start-journal-order.test.ts: 12 pass, 0 fail.
  • bun test tests/cli/sibling-home-client-sync.test.ts: 36 pass, 1 existing skip, 0 fail. Covers real-child exit diagnostics, stdout EOF/read failure, split UTF-8/markers, tail eviction and pipe backpressure. The pre-existing FIFO skip is unchanged.
  • bun run test:changed: 63 pass, 1 existing skip, 0 fail, 3 selected files, including the final journal fixture.
  • bun run typecheck: no type errors in 2,259 files.
  • bun test tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 38 pass, 0 fail.
  • bun run privacy:scan: passed. git diff --check: passed.
  • NOT RUN: full local suite (2,836 test files is disproportionate to this three-file fixture change; both helper consumers and the import-selected coverage ran), new hosted CI results, cross-platform runtime checks. Normal PR CI will provide hosted Ubuntu evidence; Windows/macOS batch validation remains maintainer-owned.
  • No merge, workflow dispatch, or CI rerun was performed.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. Test-only change; user-facing behavior is unchanged.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. No production/security-boundary changes; runtime diagnostics retain their field allowlist.

Summary by CodeRabbit

  • Tests
    • Improved coverage of CLI startup readiness, including behavior during clock changes and when a child process exits or its output stream fails before signaling readiness.
    • Startup output is now captured through readiness checks, with clearer diagnostics when startup fails.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 31, 2026 17:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-31T17:09:12.824881Z 55350a3 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.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Oct 31, 2026
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between d5708c3 and 55350a3.

Files selected for processing: 3
  • tests/cli/cli-start-journal-order.test.ts
  • tests/cli/sibling-home-client-sync.test.ts
  • tests/helpers/startup-child-output.ts

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

Walkthrough

Startup child output capture now exposes a wait for the startup signal or child exit. CLI tests use the signal before checking runtime records and readiness, and add coverage for clock changes, stream termination, read failures, and split UTF-8 output.

Changes: Sibling startup output

Layer / File(s) Summary
Track and await startup completion
tests/helpers/startup-child-output.ts, tests/cli/sibling-home-client-sync.test.ts
The output capture helper exposes waitForStartup, which resolves on the startup marker or detects incomplete startup. Tests cover clock changes, child exit, stdout end or read failure, and split UTF-8 output.
Use startup capture in sibling-start tests
tests/cli/cli-start-journal-order.test.ts
startSibling waits for startup before validating the runtime record and /readyz response. Cleanup finalizes captured output, and stop-output assertions use the captured stdout tail.

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

Change: Other

Possibly related PRs

Suggested labels: chore

Merge Risk: Minimal · up to 55350

The fixture now waits for startup completion before checking readiness. No actionable merge-blocking risk was established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "test(cli): await sibling startup completion instead of a polling deadline" matches the main change. The raw summary and objectives show that the sibling-start fixture now waits for the chil…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Title check

Explanation

The title "test(cli): await sibling startup completion instead of a polling deadline" matches the main change. The raw summary and objectives show that the sibling-start fixture now waits for the child's startup signal or exit instead of polling for a runtime record and readiness against a 45-second deadline. The title names the test scope, the new waiting mechanism, and the replaced polling deadline. It does not list the added /readyz validation or the captured output helper, but the PR does not need to cover every detail. The title is 73 characters and 10 words, which fits the requested concise, single-sentence form.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.

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

@lidge-jun
lidge-jun merged commit 98bd8c0 into dev Oct 31, 2026
30 checks passed
@lidge-jun
lidge-jun deleted the goat/windows-sibling-start-readiness branch October 31, 2026 17:20
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