Skip to content

fix: harden fake-gemini test double against stdin broken-pipe race - #111

Merged
jmagar merged 1 commit into
mainfrom
claude/infallible-galileo-d5d1d1
Jul 2, 2026
Merged

fix: harden fake-gemini test double against stdin broken-pipe race#111
jmagar merged 1 commit into
mainfrom
claude/infallible-galileo-d5d1d1

Conversation

@jmagar

@jmagar jmagar commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • ai_assess_writes_llm_invocation_audit_row_via_runner intermittently failed under heavy parallel cargo test --lib load with failed to write Gemini stdin: Broken pipe (os error 32).
  • Root cause: the fake gemini script (fake-gemini.sh) in src/app/service_tests.rs exited without ever reading stdin, racing against run_gemini_assessment's concurrent stdin-writer task — under scheduler pressure the child could exit and close its stdin read end before the parent finished writing, surfacing a spurious Broken pipe even though stdout already produced valid, complete output.
  • Fix: the test double now drains stdin (cat >/dev/null) before responding, forcing it to block until the parent's write+shutdown completes. Test-only change — production code (src/assessment.rs) is untouched.
  • Bumped version 3.2.2 → 3.2.3 (patch) per repo convention; CHANGELOG updated.

Closes syslog-mcp-sxx56.

Test plan

  • Reproduced the original failure on unpatched code (single isolated test run failed with the exact reported Broken pipe error under current system load)
  • cargo test --lib app::services::tests::ai_assess_writes_llm_invocation_audit_row_via_runner — passed 6/6 consecutive runs after the fix
  • cargo test --lib assessment::tests:: — all 12 tests pass, including the intentionally-racy gemini_assessment_reports_child_stderr_before_stdin_pipe_error (confirms the fix doesn't mask the exit-status-priority behavior that test depends on)
  • cargo fmt -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo xtask check-release-versions

Summary by cubic

Fixes a flaky unit test by making the fake gemini test double read stdin to EOF (cat >/dev/null) before printing, removing the broken-pipe race under parallel runs. Test-only change; bumps cortex to 3.2.3 and updates Docker/manifest versions to match (addresses syslog-mcp-sxx56).

Written for commit e7d3572. Summary will update on new commits.

Review in cubic

ai_assess_writes_llm_invocation_audit_row_via_runner intermittently
failed under heavy parallel cargo test --lib load with "failed to write
Gemini stdin: Broken pipe (os error 32)". The fake-gemini.sh test double
never read stdin before exiting 0, racing against run_gemini_assessment's
concurrent stdin-writer task under scheduler pressure. Draining stdin
(cat >/dev/null) before responding forces the child to block until the
parent's write+shutdown completes, removing the race deterministically.

Closes syslog-mcp-sxx56.
Copilot AI review requested due to automatic review settings July 2, 2026 07:06
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jmagar, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0fb11640-86ce-4698-93c2-8778c490e4ce

📥 Commits

Reviewing files that changed from the base of the PR and between a874ef1 and e7d3572.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock and included by **/*
📒 Files selected for processing (6)
  • CHANGELOG.md
  • Cargo.toml
  • docker-compose.prod.yml
  • mcpb/manifest.json
  • server.json
  • src/app/service_tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/infallible-galileo-d5d1d1

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens a unit-test fake Gemini CLI script to eliminate an intermittent broken-pipe race when run_gemini_assessment writes to child stdin concurrently under heavy parallel test scheduling. It also applies the repo’s patch-version bump workflow for the fix.

Changes:

  • Update the test double fake-gemini.sh to drain stdin (cat >/dev/null) before emitting stream-json output, preventing the child from exiting before the parent finishes writing+shutdown.
  • Bump version 3.2.2 → 3.2.3 across the tracked version carriers.
  • Add a 3.2.3 changelog entry documenting the flaky-test fix.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/app/service_tests.rs Makes the fake gemini test script block on stdin EOF to remove a deterministic EPIPE race during concurrent stdin writing.
server.json Updates MCP registry metadata version and OCI identifier tag to v3.2.3.
mcpb/manifest.json Updates MCP bundle manifest version to 3.2.3.
docker-compose.prod.yml Updates default image tag fallback to 3.2.3.
CHANGELOG.md Adds the 3.2.3 entry describing the flaky-test fix.
Cargo.toml Bumps crate version to 3.2.3.
Cargo.lock Updates the locked cortex package version to 3.2.3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jmagar
jmagar merged commit 1ac3b73 into main Jul 2, 2026
16 checks passed
@jmagar
jmagar deleted the claude/infallible-galileo-d5d1d1 branch July 2, 2026 07:23
@cubic-dev-ai cubic-dev-ai Bot mentioned this pull request Jul 2, 2026
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.

2 participants