Skip to content

fix(fleet): place the fake gh with cp so parallel forks can't ETXTBSY it (#11834) - #11897

Merged
dezren39 merged 1 commit into
mainfrom
fix/fleet-fake-gh-etxtbsy
Nov 18, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/fleet-fake-gh-etxtbsy

Conversation

@dezren39

@dezren39 dezren39 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Before: gh::tests::raw_mode_runs_gh_without_token could fail with Text file busy (os error 26) and exit 3, as it did in fleet-smoke run 44347324734 (#11834). The fake gh was written by the test process itself, so a parallel test thread that forked at the wrong moment held a writable descriptor to it while another test exec'd it. Separately, the same test failed on any runner that carries its own GH_TOKEN, since it expected an empty token in the log.

After: the fake gh is placed by a short-lived cp process from a side file, so the test process never holds it open for writing and no fork can make it busy. The raw-mode test expects the ambient GH_TOKEN (empty when none) to pass through untouched, which is the raw-mode contract: no token injected.

How: fake_gh in pkgs/fleet/crates/fleet/src/gh.rs writes fake-gh.src, runs cp to fake-gh, then chmods it. Ran the fleet bin tests 5× with no token and once with one; all 62 pass. Leaves the ONNX fetch part of #11834 alone, which was already triaged as infrastructure.


Generated by Claude Code


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

Summary by CodeRabbit

  • Tests
    • Updated automated checks for how GitHub CLI credentials are passed to child processes, including when no token is set.
    • Adjusted test setup to launch the mock command through a copied executable script. These changes affect test behavior only; no user-facing functionality changed.

fake_gh wrote the script with std::fs::write in the test process. Tests
run on parallel threads, and a thread that forks to spawn a child holds
a copy of every open descriptor until its exec, including the one the
script was being written through. Exec'ing the script inside that
window fails with ETXTBSY, which fleet-smoke hit under the Nix build
sandbox (#11834). The text now goes to a side file and a separate `cp`
process writes the executable, so this process never has it open for
writing.

raw_mode_runs_gh_without_token also compared the logged token with "",
which assumes the runner has no GH_TOKEN of its own; it now expects the
ambient value passed through untouched, which is what raw mode does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 18, 2026 20:20
@dezren39
dezren39 requested a review from a team as a code owner November 18, 2026 20:20
@dezren39
dezren39 merged commit e050759 into main Nov 18, 2026
@dezren39
dezren39 deleted the fix/fleet-fake-gh-etxtbsy branch November 18, 2026 20:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T20:21:55.416812Z da717da Draft marked ready
ℹ️ 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 Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The fake_gh test helper now creates the executable by copying a side file. The raw-mode test now expects the child process to receive the ambient GH_TOKEN, or an empty value when the variable is unset.

Changes: GH test changes

Layer / File(s) Summary
Fake GitHub test setup and token expectation
pkgs/fleet/crates/fleet/src/gh.rs
fake_gh writes the script to a side file, removes any existing executable, and copies the script into place. The raw-mode test derives its expected token from the ambient GH_TOKEN, using an empty value when unset.

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

Change: Other · Severity of issue fixed: Low

Possibly related issues

  • Issue 11834 reports a “Text file busy” error when the test runs the generated fake GitHub executable. The updated setup addresses that executable-copy failure; the issue’s ONNX fetch and Nix cache handling are not covered by these changes.

Suggested reviewers: claude

Merge Risk: Minimal · up to da717

This change only adjusts test setup so parallel tests no longer hit text-file-busy errors, and it aligns a token expectation with the ambient environment. It has no production impact and is ready to merge.

- [ ] 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

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