Skip to content

fix(process): share ETXTBSY retry helper across git/bd/os spawns#46

Merged
droidnoob merged 1 commit into
mainfrom
fix/etxtbsy-shared-retry
May 26, 2026
Merged

fix(process): share ETXTBSY retry helper across git/bd/os spawns#46
droidnoob merged 1 commit into
mainfrom
fix/etxtbsy-shared-retry

Conversation

@droidnoob
Copy link
Copy Markdown
Owner

Summary

  • The Linux `ETXTBSY` race that PR fix(statusline): compose with Claude prefix + bring back ctx bar (v0.7.1) #43 fixed for the git module also hits the brew-install probe in `hew_core::os` — surfaced post-0.8.1 as `macos_with_brew_propagates_failure` panicking because the spawned brew stub raced its own write fd.
  • Promote the retry helper to a shared `hew_core::process` module and route every in-tree spawn site through it (`git`, `os`, `bd`). Defense in depth: `bd`'s tests don't stub-install today, but the same race applies any time the binary gets rewritten under a concurrent reader.

Symbols touched (per hew blast)

  • hew_core::process::spawn_with_etxtbsy_retry (new)
  • hew_core::os::run_brew_install_git (use helper)
  • hew_core::bd::RealBd::run + run_to_file_inner (use helper)
  • hew_core::lib (module declaration)

Test plan

  • Failing test `macos_with_brew_propagates_failure` — passes 10/10 in a stress loop locally.
  • `cargo test` (default + `--no-default-features`): green.
  • `cargo clippy --all-targets -- -D warnings`: clean.
  • `cargo fmt --all -- --check`: clean.
  • CI green on the 4-way matrix.

🤖 Generated with Claude Code

The Linux "Text file busy" race that the git module already handled
(commit 2368c7a) also hits the brew-install probe in os.rs — the
0.8.1 CI surfaced it as `macos_with_brew_propagates_failure`
panicking because the spawned brew stub raced its own write fd.

Promote the retry helper to a shared `hew_core::process` module and
route every in-tree spawn site through it:

- hew_core::process::spawn_with_etxtbsy_retry — new shared module.
  pub(crate) so the binary doesn't see it but every hew-core module
  can. Exponential backoff up to ~150ms total, then a final attempt.
- hew_core::git: drop the local copy, import from process.
- hew_core::os::run_brew_install_git: use the helper (fixes the
  failing test).
- hew_core::bd::RealBd::run / run_to_file_inner: use the helper for
  defense in depth — bd's tests don't stub-install today, but the
  same race applies any time the binary itself gets rewritten under
  a concurrent reader (hew init refresh during a parallel run).

Verification:
- Failing test `macos_with_brew_propagates_failure`: now passes 10/10
  in a stress loop.
- cargo test (default + --no-default-features): green.
- cargo clippy --all-targets -- -D warnings: clean.
- cargo fmt --all -- --check: clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@droidnoob droidnoob merged commit 8ee6974 into main May 26, 2026
14 checks passed
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