[PR #269] [MERGED] fix(image): avoid ETXTBSY in fake regctl setup #304

Closed
opened 2026-10-29 14:22:00 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/269
Author: @yingdi-shan
Created: 9/9/2026
Status: ✅ Merged
Merged: 9/10/2026
Merged by: @yingdi-shan

Base: main ← Head: fix/resolver-fake-regctl-etxtbsy


📝 Commits (1)

  • 75dfcd9 fix(image): avoid ETXTBSY in fake regctl setup

📊 Changes

1 file changed (+16 additions, -21 deletions)

View changed files

📝 src/image/resolver.rs (+16 -21)

📄 Description

What

Fix intermittent Text file busy (os error 26) failures in the resolver's fake regctl setup. Create the executable in a child shell and wait for successful completion before returning its path.

Why

discover_overlaybd_referrer_lists_referrers_unfiltered_and_finds_acr_streaming can fail when another test forks while the helper has the script open for writing. The child inherits that descriptor until exec or exit, so closing the parent's handle, syncing, and renaming the file still leaves a window for ETXTBSY.

N/A — small fix for the reported intermittent unit-test failure.

Scope and non-goals

Only the fake_regctl helper in src/image/resolver.rs changes. Production image resolution and registry behavior are unchanged.

Design and behavior changes

The child shell owns the executable's writable descriptor, so sibling test processes cannot inherit it. The helper checks that installation succeeded before launching the fake command. The path and script are passed as quoted positional arguments; fixture lookup remains relative to $0, preserving support for temporary paths containing shell metacharacters.

Compatibility and operations

  • Public API or generated protocol: N/A; test helper only.
  • Configuration or defaults: N/A; unchanged.
  • Snapshot manifest, artifact layout, or storage format: N/A; unchanged.
  • Upgrade and rollback: no operational impact.
  • Host requirements, permissions, ports, or dependencies: uses the Unix shell and utilities already required by the fake executable; no new dependencies.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:

make fmt
  Passed.
CARGO_TARGET_DIR=/tmp/aenv-target make clippy
  Passed: workspace, all targets/features, -D warnings.
CARGO_TARGET_DIR=/tmp/aenv-target cargo test -p agentenv --lib image::
  Passed: 116 tests, including both referrer-discovery command tests.
git diff --check
  Passed.

Tests used isolated temporary AENV state and dependency paths. A temporary standalone Rust harness exercised the actual helper with four concurrent fixture workers and four concurrent process-spawn workers, holding inherited descriptors for 10 ms before exec. The original helper failed 88 of 400 launches with ETXTBSY; the replacement completed 4,000 launches with zero failures. Successful launches verified argv, stdout, stderr, and both success/failure exit codes, including paths containing spaces, quotes, dollar signs, and backticks. This harness was a local validation tool and is not part of the patch.

Skipped checks and reasons: the focused library tests cover this helper; the aggregate capability/VM suites, Go tests, code generation, documentation, and benchmarks do not apply to this test-only change.

Risks and reviewer notes

Adds a short-lived shell process to each of the two discovery tests. Existing assertions continue to verify the unfiltered registry command and error propagation. Review the descriptor ownership comment and the positional-argument quoting in fake_regctl.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/269 **Author:** [@yingdi-shan](https://github.com/yingdi-shan) **Created:** 9/9/2026 **Status:** ✅ Merged **Merged:** 9/10/2026 **Merged by:** [@yingdi-shan](https://github.com/yingdi-shan) **Base:** `main` ← **Head:** `fix/resolver-fake-regctl-etxtbsy` --- ### 📝 Commits (1) - [`75dfcd9`](https://github.com/kvcache-ai/AgentENV/commit/75dfcd91d1d8773e45aa2b6841a684164793bcff) fix(image): avoid ETXTBSY in fake regctl setup ### 📊 Changes **1 file changed** (+16 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/image/resolver.rs` (+16 -21) </details> ### 📄 Description ## What Fix intermittent `Text file busy (os error 26)` failures in the resolver's fake `regctl` setup. Create the executable in a child shell and wait for successful completion before returning its path. ## Why `discover_overlaybd_referrer_lists_referrers_unfiltered_and_finds_acr_streaming` can fail when another test forks while the helper has the script open for writing. The child inherits that descriptor until exec or exit, so closing the parent's handle, syncing, and renaming the file still leaves a window for `ETXTBSY`. ## Related issue N/A — small fix for the reported intermittent unit-test failure. ## Scope and non-goals Only the `fake_regctl` helper in `src/image/resolver.rs` changes. Production image resolution and registry behavior are unchanged. ## Design and behavior changes The child shell owns the executable's writable descriptor, so sibling test processes cannot inherit it. The helper checks that installation succeeded before launching the fake command. The path and script are passed as quoted positional arguments; fixture lookup remains relative to `$0`, preserving support for temporary paths containing shell metacharacters. ## Compatibility and operations - Public API or generated protocol: N/A; test helper only. - Configuration or defaults: N/A; unchanged. - Snapshot manifest, artifact layout, or storage format: N/A; unchanged. - Upgrade and rollback: no operational impact. - Host requirements, permissions, ports, or dependencies: uses the Unix shell and utilities already required by the fake executable; no new dependencies. ## Validation - [x] `make fmt` - [x] `make clippy` - [ ] `make test-unit` - [ ] Relevant Rust integration tests - [ ] `make -C services test` (required when `services/` changes) - [ ] Generated clients/server regenerated with the documented `make` target - [ ] Documentation updated - [ ] Benchmarks or performance comparison completed Commands and results: ```text make fmt Passed. CARGO_TARGET_DIR=/tmp/aenv-target make clippy Passed: workspace, all targets/features, -D warnings. CARGO_TARGET_DIR=/tmp/aenv-target cargo test -p agentenv --lib image:: Passed: 116 tests, including both referrer-discovery command tests. git diff --check Passed. ``` Tests used isolated temporary AENV state and dependency paths. A temporary standalone Rust harness exercised the actual helper with four concurrent fixture workers and four concurrent process-spawn workers, holding inherited descriptors for 10 ms before exec. The original helper failed 88 of 400 launches with `ETXTBSY`; the replacement completed 4,000 launches with zero failures. Successful launches verified argv, stdout, stderr, and both success/failure exit codes, including paths containing spaces, quotes, dollar signs, and backticks. This harness was a local validation tool and is not part of the patch. Skipped checks and reasons: the focused library tests cover this helper; the aggregate capability/VM suites, Go tests, code generation, documentation, and benchmarks do not apply to this test-only change. ## Risks and reviewer notes Adds a short-lived shell process to each of the two discovery tests. Existing assertions continue to verify the unfiltered registry command and error propagation. Review the descriptor ownership comment and the positional-argument quoting in `fake_regctl`. ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:22:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#304
No description provided.