Stop a history-replay test from racing on the process cwd

history_replay_redraws_the_conversation_for_the_client built its test path from std::env::current_dir(), but four other tests briefly change that same process-global cwd under ENV_TEST_LOCK. This test never took the lock, so it could read one of those temp directories mid-swap. On CI that handed it a path long enough to trip the tool title's truncation, so the assertion compared a truncated title against an untruncated expectation and failed. Use a fixed path instead; the test never needed the real cwd to begin with. Co-Authored-By: siGit Code <noreply@sigit.si>

Seto Elkahfi committed Sep 15, 2026 at 22:46 UTC 8198f4c58eefd1cead1ad7ec2cc85117d64d86e5
1 file changed +13 -1
src/main.rs
+13 -1
@@ -4193,7 +4193,19 @@ mod tests {
4193
4194 #[test]
4195 fn history_replay_redraws_the_conversation_for_the_client() {
4196 - let changelog_path = std::env::current_dir().unwrap().join("CHANGELOG.md");
4196 + // A fixed path, not `std::env::current_dir()`: the cwd is process-global
4197 + // and a handful of other tests (skills/commands/subagents discovery,
4198 + // the subagent end-to-end test) briefly `set_current_dir` to a temp
4199 + // directory behind `ENV_TEST_LOCK`. This test asserts on the exact
4200 + // rendered title, so racing one of them mid-run doesn't just read a
4201 + // stale value — it can hand back a temp path long enough to trip the
4202 + // title's truncation, breaking an assertion that has nothing to do
4203 + // with the cwd. A literal path sidesteps the shared state entirely.
4204 + let changelog_path = if cfg!(windows) {
4205 + PathBuf::from(r"C:\repo\CHANGELOG.md")
4206 + } else {
4207 + PathBuf::from("/repo/CHANGELOG.md")
4208 + };
4209 let changelog_path_text = changelog_path.to_string_lossy().into_owned();
4210 let arguments = serde_json::json!({ "path": changelog_path_text }).to_string();
4211 let history = vec![