fix(engine): gate the external-agent option test helpers to unix so Windows compiles (CW-7879)

Five helpers in runtime_threads/tests/external_agent.rs (options_fixture,
received, pid_alive, refusal_code, options_thread_request) are called only
from tests that are #[cfg(unix)]. On Windows they were dead code, and the
workspace compiles tests with -D warnings, so 'Check every workspace target
compiles on Windows' has failed since 10ca1deee0 landed in cf4464f72a:
'could not compile codewhale-engine (lib test) due to 5 previous errors'.
It was caught on a contributor's pull request, whose required Windows check
failed for a reason it did not cause.

The helpers now carry the same gate as their callers. On unix the compiled
code is unchanged.

Checks on this commit: rustfmt clean, preflight OK. The Windows compile is
proved only by hosted CI on this commit; no Windows build was run locally.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
CodeWhale BotandClaude Fable 5.2 committed 2026-11-10 20:15:17 -08:00
1 parent 77bdd783f4
commit a37d7fdd27
1 file changed
+5
@@ -716,10 +716,12 @@ async fn an_abandoned_external_startup_stops_its_agent_inside_the_shutdown_barri
Ok(())
}
#[cfg(unix)]
fn options_fixture() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/acp-options-agent.mjs")
}
#[cfg(unix)]
fn received(workspace: &Path) -> Vec<Value> {
std::fs::read_to_string(workspace.join("options-received.jsonl"))
.unwrap_or_default()
@@ -728,6 +730,7 @@ fn received(workspace: &Path) -> Vec<Value> {
.collect()
}
#[cfg(unix)]
fn pid_alive(pid: u64) -> bool {
std::process::Command::new("kill")
.args(["-0", &pid.to_string()])
@@ -736,12 +739,14 @@ fn pid_alive(pid: u64) -> bool {
.is_ok_and(|status| status.success())
}
#[cfg(unix)]
fn refusal_code(error: &anyhow::Error) -> Option<&'static str> {
error
.downcast_ref::<crate::fleet::agents::ExecutorUnavailable>()
.map(|refusal| refusal.code)
}
#[cfg(unix)]
fn options_thread_request(workspace: &Path, model: &str) -> CreateThreadRequest {
let mut request = fixture_thread_request(workspace, "ask");
request.executor.as_mut().unwrap().config.model = Some(model.to_string());