Skip to content

[codex] Stabilize ccusage timeout cleanup test#501

Open
zergzorg wants to merge 1 commit into
robinebers:mainfrom
zergzorg:codex/fix-ccusage-timeout-test
Open

[codex] Stabilize ccusage timeout cleanup test#501
zergzorg wants to merge 1 commit into
robinebers:mainfrom
zergzorg:codex/fix-ccusage-timeout-test

Conversation

@zergzorg
Copy link
Copy Markdown
Contributor

@zergzorg zergzorg commented May 23, 2026

Summary

  • make ccusage_timeout_kills_descendant_and_closes_pipes wait for the descendant pid file with a short retry loop
  • give the fake runner a 1s timeout budget instead of 100ms so the shell has time to create descendant.pid before the timeout kill path runs
  • keep the production ccusage timeout/kill behavior unchanged

Why

The test was racing its own setup. On a slower or busy machine, the 100ms timeout can kill the fake shell runner before it reaches:

echo $! > descendant.pid

When that happens, the assertion fails with:

read descendant pid: Os { code: 2, kind: NotFound, message: "No such file or directory" }

The test is meant to verify timeout cleanup of descendant processes and pipe draining, not whether a shell script can always initialize in under 100ms. The new version still exercises the timeout path, keeps the cleanup hang guard, and then verifies that the descendant is killed.

Validation

  • cargo test plugin_engine::host_api::tests::ccusage_timeout_kills_descendant_and_closes_pipes -- --nocapture
  • cargo test

Summary by cubic

Stabilizes the ccusage_timeout_kills_descendant_and_closes_pipes test to remove timing flakiness on slower machines while keeping production timeout/kill behavior unchanged.

  • Bug Fixes
    • Poll for descendant.pid with a 20ms interval and 1s deadline before asserting.
    • Increase the fake runner timeout from 100ms to 1s to avoid setup races; still exercises the timeout path and verifies descendant kill and pipe cleanup.

Written for commit beb1dd4. Summary will update on new commits. Review in cubic

@github-actions github-actions Bot added the rust Pull requests that update rust code label May 23, 2026
@validatedev validatedev requested a review from Copilot May 23, 2026 21:59
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 stabilizes the Unix-only ccusage_timeout_kills_descendant_and_closes_pipes test in src-tauri by reducing timing flakiness while keeping production timeout/kill behavior unchanged.

Changes:

  • Add a small retry loop helper to wait for descendant.pid to appear before parsing it.
  • Increase the fake runner timeout budget from 100ms to 1s, while still exercising the timeout path and verifying cleanup.

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

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants