Skip to content

test(mcpx): poll for the fake daemon's marker in TestEnsureDaemonNeverReadyStillTimesOut (dezren39/nix#445) - #335

Merged
dezren39 merged 2 commits into
mainfrom
creator/445-never-ready-marker-poll
Oct 19, 2026
Merged

dezren39 merged 2 commits into
mainfrom
creator/445-never-ready-marker-poll

Conversation

@dezren39

@dezren39 dezren39 commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Origin issue (cross-repo set): dezren39/darwin-nix#445

This repo's pkgs/mcpx copy has the same test as dezren39/darwin-nix#445, written independently in this repo's #437 port, with the identical defect: TestEnsureDaemonNeverReadyStillTimesOut asserts the fake daemon's marker file with a single os.Stat the instant EnsureDaemon returns at the 1s connect timeout. The spawn is cmd.Start() + Process.Release() (client.go), so the child can legitimately not have run its touch yet — the identical race dezren39/darwin-nix#428 fixed in its polling test.

Fix (test-only, +18/−2): poll for the marker every 10ms up to a 5s deadline and fail only if it never appears — the dezren39/darwin-nix#428 pattern.

Verification:

  • Deterministic repro with the fix(ci): push-to-main runs get their own concurrency group (run_id) in 9 workflows #428 amplification technique (fake daemon's touch delayed 2s in a scratch copy): pre-fix FAIL ensuredaemon_test.go:92: the fake daemon was never spawned (1.03s); with this fix the same delayed construction PASSes (2.06s).
  • Target test -count=3 PASS; full go test ./internal/cli/ -count=1 PASS (23.0s); go vet ./internal/cli/ clean; gofmt clean.

Companion PR in dezren39/nix carries the same fix for that copy and closes the origin issue.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Tests
    • Improved test reliability by allowing the fake daemon additional time to record its startup marker after a readiness timeout.

…rReadyStillTimesOut (dezren39/darwin-nix#445)

The test asserted the marker file the instant EnsureDaemon returned at
the 1s connect timeout, but the spawn is cmd.Start + Release: Start
returns before the child has run any code, so the child's touch can
legitimately land after the return — the same race dezren39/darwin-nix#428
fixed in TestEnsureDaemonCancelWhilePolling. Poll for the marker
(10ms, 5s deadline) and fail only if it never appears.

Reproduced deterministically with the dezren39/darwin-nix#428 amplification
technique (fake daemon's touch delayed 2s): pre-fix FAIL at the
instant stat, post-fix PASS. Origin issue for the set:
dezren39/darwin-nix#445
@dezren39
dezren39 requested a review from a team as a code owner October 19, 2026 04:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-19T04:32:21.766451Z 46438c4 New commits
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9df687e6-c70d-4f0c-bdce-5c476372982a
📥 Commits

Reviewing files that changed from the base of the PR and between f1696b2 and 46438c4.

📒 Files selected for processing: 1
  • pkgs/mcpx/internal/cli/ensuredaemon_test.go

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

📝 Walkthrough

The never-ready daemon test now polls for the fake daemon’s spawn marker for up to five seconds after the readiness timeout.

Changes: Daemon test

Layer / File(s) Summary
Spawn-marker polling
pkgs/mcpx/internal/cli/ensuredaemon_test.go
The test checks for the spawn marker every 10 ms for up to five seconds before failing.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 46438

This test-only change accommodates asynchronous marker creation while retaining the readiness-timeout check and a failure when the marker does not appear. No material merge risk remains.

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 clearly and accurately summarizes the main change: polling for the fake daemon marker in the affected timeout test.
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. Analyzed 1 functions across 1 files.
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

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

@dezren39
dezren39 merged commit 7b081c3 into main Oct 19, 2026
17 checks passed
@dezren39
dezren39 deleted the creator/445-never-ready-marker-poll branch October 19, 2026 04:37
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