Skip to content

Commit 8cf5b00

Browse files
authored
fix: more stable notify script (#13011)
1 parent fe439af commit 8cf5b00

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

codex-rs/app-server/tests/suite/v2/initialize.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ async fn turn_start_notify_payload_includes_initialize_client_name() -> Result<(
197197
r#"from pathlib import Path
198198
import sys
199199
200-
Path(__file__).with_name("notify.json").write_text(sys.argv[-1], encoding="utf-8")
200+
payload_path = Path(__file__).with_name("notify.json")
201+
tmp_path = payload_path.with_suffix(".json.tmp")
202+
tmp_path.write_text(sys.argv[-1], encoding="utf-8")
203+
tmp_path.replace(payload_path)
201204
"#,
202205
)?;
203206
let notify_file = codex_home.path().join("notify.json");

codex-rs/core/tests/suite/user_notification.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ use responses::start_mock_server;
2323
use std::time::Duration;
2424

2525
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
26-
#[ignore = "flaky on ubuntu-24.04-arm - aarch64-unknown-linux-gnu"]
27-
// The notify script gets far enough to create (and therefore surface) the file,
28-
// but hasn’t flushed the JSON yet. Reading an empty file produces EOF while parsing
29-
// a value at line 1 column 0. May be caused by a slow runner.
3026
async fn summarize_context_three_requests_and_instructions() -> anyhow::Result<()> {
3127
skip_if_no_network!(Ok(()));
3228

@@ -43,7 +39,10 @@ async fn summarize_context_three_requests_and_instructions() -> anyhow::Result<(
4339
&notify_script,
4440
r#"#!/bin/bash
4541
set -e
46-
echo -n "${@: -1}" > $(dirname "${0}")/notify.txt"#,
42+
payload_path="$(dirname "${0}")/notify.txt"
43+
tmp_path="${payload_path}.tmp"
44+
echo -n "${@: -1}" > "${tmp_path}"
45+
mv "${tmp_path}" "${payload_path}""#,
4746
)?;
4847
std::fs::set_permissions(&notify_script, std::fs::Permissions::from_mode(0o755))?;
4948

0 commit comments

Comments
 (0)