mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
Stabilize write ordering in the shared message board scenario (#53632)
## Why Non-parallel tool calls can acquire their lock in either order, making the shared board scenario's `last_message_id` snapshot nondeterministic. ## What changed Send each `collaboration.post` call in a separate mocked response to order the writes before snapshotting. Update the `board_connections` snapshot and expected request count from 15 to 17 to reflect the additional responses. GitOrigin-RevId: a290a01f5071a2081d4d0b1531b1b31bfbb8a6e6
This commit is contained in:
@@ -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") {
|
||||
|
||||
+8
-6
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user