Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Stabilize write ordering in the shared message board scenario (#53632)

jif6042ec37b0e6
diff --git a/codex-rs/core/tests/suite/scenarios_agent_message_board.rs b/codex-rs/core/tests/suite/scenarios_agent_message_board.rs
index 918908e68c..c857a313d7 100644
--- a/codex-rs/core/tests/suite/scenarios_agent_message_board.rs
+++ b/codex-rs/core/tests/suite/scenarios_agent_message_board.rs
@@ -983,35 +983,29 @@ async fn codex_instances_share_board_with_fixed_access() -> anyhow::Result<()> {
body: tool("checkpoint", "get_channels", json!({})),
},
],
- response(sse(vec![
- ev_function_call_with_namespace(
- "wrong-board",
- "collaboration",
- "post",
- &json!({
- "channel_name":"policy", "text":"Must not publish",
- "agents_to_notify":["/root/00000000000040008000000000000002"]
- })
- .to_string(),
- ),
- ev_function_call_with_namespace(
- "update",
- "collaboration",
- "post",
- &json!({"channel_name":"policy", "text":"A new policy"}).to_string(),
- ),
- ev_function_call_with_namespace(
- "explicit-update",
- "collaboration",
- "post",
- &json!({
- "channel_name":"policy", "text":"An explicit update",
- "agents_to_notify":["/root/00000000000040008000000000000001"]
- })
- .to_string(),
- ),
- ev_completed("update"),
- ])),
+ // Separate responses order the writes before snapshotting last_message_id.
+ // Non-parallel tools exclude one another but can acquire the lock in either order.
+ response(tool(
+ "wrong-board",
+ "post",
+ json!({
+ "channel_name":"policy", "text":"Must not publish",
+ "agents_to_notify":["/root/00000000000040008000000000000002"]
+ }),
+ )),
+ response(tool(
+ "update",
+ "post",
+ json!({"channel_name":"policy", "text":"A new policy"}),
+ )),
+ response(tool(
+ "explicit-update",
+ "post",
+ json!({
+ "channel_name":"policy", "text":"An explicit update",
+ "agents_to_notify":["/root/00000000000040008000000000000001"]
+ }),
+ )),
response(done()),
response(done()),
])
@@ -1167,7 +1161,7 @@ async fn codex_instances_share_board_with_fixed_access() -> anyhow::Result<()> {
.iter()
.map(|body| serde_json::from_slice::<Value>(body))
.collect::<serde_json::Result<Vec<_>>>()?;
- assert_eq!(bodies.len(), 15);
+ assert_eq!(bodies.len(), 17);
for body in &mut bodies {
for item in body["input"].as_array_mut().context("request input")? {
if let Some(Value::String(output)) = item.get_mut("output") {
diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_message_board__board_connections.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_message_board__board_connections.snap
index 191cbcd810..f4be7df78a 100644
--- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_message_board__board_connections.snap
+++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_message_board__board_connections.snap
@@ -76,14 +76,16 @@ Scenario: Independent Codex runtimes share a local board: a writer publishes, an
Publish an update.
-- request 14 (request) --
08:function_call/collaboration.post:{"agents_to_notify":["/root/00000000000040008000000000000002"],"channel_name":"policy","text":"Must not publish"}
-09:function_call/collaboration.post:{"channel_name":"policy","text":"A new policy"}
-10:function_call/collaboration.post:{"agents_to_notify":["/root/00000000000040008000000000000001"],"channel_name":"policy","text":"An explicit update"}
-11:function_call_output:no thread with id: <UUID 4>
-12:function_call_output:{"author":"/root/00000000000040008000000000000000","channel_name":"policy","created_at":"2026-09-18T12:00:00Z","message_id":"<UUID 5>","thread_id":"<UUID 5>"}
+09:function_call_output:no thread with id: <UUID 4>
+-- request 15 (request) --
+10:function_call/collaboration.post:{"channel_name":"policy","text":"A new policy"}
+11:function_call_output:{"author":"/root/00000000000040008000000000000000","channel_name":"policy","created_at":"2026-09-18T12:00:00Z","message_id":"<UUID 5>","thread_id":"<UUID 5>"}
+-- request 16 (request) --
+12:function_call/collaboration.post:{"agents_to_notify":["/root/00000000000040008000000000000001"],"channel_name":"policy","text":"An explicit update"}
13:function_call_output:{"author":"/root/00000000000040008000000000000000","channel_name":"policy","created_at":"2026-09-18T12:00:00Z","message_id":"<UUID 6>","thread_id":"<UUID 6>"}
-## Window 4 (after request 14: input diverged at item 04, settings changed (prompt_cache_key))
--- request 15 (request) --
+## Window 4 (after request 16: input diverged at item 04, settings changed (prompt_cache_key))
+-- request 17 (request) --
00:message/developer:
<MODEL_INSTRUCTIONS>
01:message/developer: