Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix: bypass config for picker timeout in tests (macOS CI) (#1815)

worktrunk-bot3ae83fcf8ec4
diff --git a/src/config/user/sections.rs b/src/config/user/sections.rs
index ec4954565..f6b280cad 100644
--- a/src/config/user/sections.rs
+++ b/src/config/user/sections.rs
@@ -369,8 +369,13 @@ impl SwitchPickerConfig {
}
/// Wall-clock budget for picker data collection (default: 500ms).
- /// Returns `None` when disabled (timeout_ms = 0).
+ /// Returns `None` when disabled (timeout_ms = 0 or WORKTRUNK_TEST_PICKER_NO_TIMEOUT set).
pub fn timeout(&self) -> Option<std::time::Duration> {
+ // Env var bypass for test reliability — config file loading is unreliable
+ // in PTY subprocesses on macOS CI, so tests disable the timeout directly.
+ if std::env::var_os("WORKTRUNK_TEST_PICKER_NO_TIMEOUT").is_some() {
+ return None;
+ }
match self.timeout_ms {
Some(0) => None,
Some(ms) => Some(std::time::Duration::from_millis(ms)),
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index d280feffd..6a515168f 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1224,6 +1224,12 @@ impl TestRepo {
"WORKTRUNK_APPROVALS_PATH".to_string(),
self.test_approvals_path().display().to_string(),
),
+ // Disable picker collect timeout to prevent flaky snapshots on slow
+ // CI runners (especially macOS). Bypasses config file loading.
+ (
+ "WORKTRUNK_TEST_PICKER_NO_TIMEOUT".to_string(),
+ "1".to_string(),
+ ),
]);
vars