Skip to content

fix: onhost supervisor reloading test#2681

Merged
vjripoll merged 2 commits into
mainfrom
fix-supervisor-reloading-test
Jul 14, 2026
Merged

fix: onhost supervisor reloading test#2681
vjripoll merged 2 commits into
mainfrom
fix-supervisor-reloading-test

Conversation

@vjripoll

@vjripoll vjripoll commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ISSUE

File logging reload: run_file_logging_scenario dropped the StartedAgentControl handle on return, so Agent Control stopped before the test's final retry. That retry could never wait for the post-reload log to appear (AC was already gone), and the only window for the second-run log was a fixed 5s sleep, which slow CI exceeded.

Self-replacer: the workspace tests run in parallel. While one test writes a binary (fs::copy/fs::write holding a writable fd), another test fork (to spawn its process) inherits that fd, so executing the just-written binary intermittently fails with ETXTBSY ("Text file busy").

FIX

File logging: the scenario now returns the StartedAgentControl handle and the test keeps it alive, so AC stays running while the test waits. The final retry now waits for the full expected log state (both messages present/absent as expected, up to 60s) instead of checking once after AC had stopped.

Self-replacer: serialize the write+exec tests behind a shared lock so only one write+exec sequence runs at a time, and build the example binary at most once (Once) to remove the concurrent-build.

@vjripoll vjripoll changed the title fix: onhost supervisor reloading test WIP fix: onhost supervisor reloading test Jul 9, 2026
@vjripoll vjripoll force-pushed the fix-supervisor-reloading-test branch 3 times, most recently from b7ff10e to bed38b5 Compare July 10, 2026 09:02
@vjripoll vjripoll changed the title WIP fix: onhost supervisor reloading test fix: onhost supervisor reloading test Jul 10, 2026
@vjripoll vjripoll marked this pull request as ready for review July 10, 2026 11:49
@vjripoll vjripoll requested a review from a team as a code owner July 10, 2026 11:49

@sigilioso sigilioso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two minor questions. Thanks!

Comment thread self-replacer/tests/test_helpers.rs Outdated

/// Serializes write+exec tests to avoid ETXTBSY (a concurrent fork inheriting the writable fd of a
/// binary being written makes its exec fail with "Text file busy").
static EXEC_SERIAL_LOCK: Mutex<()> = Mutex::new(());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we use serial_test in other tests that can be problematic when executed in parallel. Does the Mutex approach cover something that using the #[serial] macro doesn't?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, I didn't even remember the serial_test. I'll change it and add the dependency. Thank you!

Comment on lines 173 to -175
std::thread::sleep(Duration::from_secs(5));

dirs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd like to confirm that I'm understanding the issue and the fix.

Before, we had a 5s. sleep keep the AC proccess running to write the logs and, sometimes, the expected logs weren't written on time and that made the test fail. Now, we keep the AC process running for as long as the test runs and we rely on the check's retries to give some time to the process to write the files.

If that's right, would it make sense to remove this 5s. sleep and just adjust the retries in the corresponding test(s)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right on both counts. Removed the post-reload sleep and let the retry (up to 60s, with AC now kept alive) wait for the logs. Kept the pre-reload sleep, since it ensures the first run's log lands before the reload can disable logging.

@vjripoll vjripoll force-pushed the fix-supervisor-reloading-test branch from bed38b5 to 4b43837 Compare July 10, 2026 13:46
@danielorihuela

Copy link
Copy Markdown
Contributor

👍

danielorihuela
danielorihuela previously approved these changes Jul 13, 2026
sigilioso
sigilioso previously approved these changes Jul 14, 2026

@sigilioso sigilioso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've left two nits, feel free to ignore them

Comment thread self-replacer/Cargo.toml Outdated
Comment thread self-replacer/tests/integration_tests.rs
@vjripoll vjripoll dismissed stale reviews from sigilioso and danielorihuela via fe8ca69 July 14, 2026 08:02
@vjripoll vjripoll force-pushed the fix-supervisor-reloading-test branch from 4b43837 to fe8ca69 Compare July 14, 2026 08:02

@sigilioso sigilioso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@vjripoll vjripoll enabled auto-merge (squash) July 14, 2026 08:08
@vjripoll vjripoll merged commit d845844 into main Jul 14, 2026
60 of 62 checks passed
@vjripoll vjripoll deleted the fix-supervisor-reloading-test branch July 14, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants