Skip to content

Commit 328e951

Browse files
authored
Preserve namespaces on custom tool calls (#30302)
## Summary - Preserve the optional namespace on custom tool calls during response deserialization and app-server replay. - Use the namespaced tool identifier for streaming argument handling and tool dispatch. - Regenerate app-server protocol schemas. - Add regression tests covering namespace serialization and routing. ## Testing - Ran affected protocol and app-server test suites. - Ran the full core test suite; two load-sensitive timing tests passed when rerun individually. - Ran Clippy and formatting checks. - Verified with a local end-to-end app-server replay that the namespace is preserved through the complete request/response flow.
1 parent c464468 commit 328e951

21 files changed

Lines changed: 217 additions & 38 deletions

codex-rs/app-server-protocol/schema/json/ClientRequest.json

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/app-server-protocol/schema/json/v2/RawResponseItemCompletedNotification.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/app-server-protocol/schema/typescript/ResponseItem.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/core/src/codex_delegate_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ async fn forward_events_cancelled_while_send_blocked_shuts_down_delegate() {
8080
status: None,
8181
call_id: "call-1".to_string(),
8282
name: "tool".to_string(),
83+
namespace: None,
8384
input: "{}".to_string(),
8485
internal_chat_message_metadata_passthrough: None,
8586
},

codex-rs/core/src/context_manager/history_tests.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ fn for_prompt_strips_images_when_model_does_not_support_images() {
513513
status: None,
514514
call_id: "tool-1".to_string(),
515515
name: "js_repl".to_string(),
516+
namespace: None,
516517
input: "view_image".to_string(),
517518
internal_chat_message_metadata_passthrough: None,
518519
},
@@ -582,6 +583,7 @@ fn for_prompt_strips_images_when_model_does_not_support_images() {
582583
status: None,
583584
call_id: "tool-1".to_string(),
584585
name: "js_repl".to_string(),
586+
namespace: None,
585587
input: "view_image".to_string(),
586588
internal_chat_message_metadata_passthrough: None,
587589
},
@@ -1090,6 +1092,7 @@ fn remove_first_item_handles_custom_tool_pair() {
10901092
status: None,
10911093
call_id: "tool-1".to_string(),
10921094
name: "my_tool".to_string(),
1095+
namespace: None,
10931096
input: "{}".to_string(),
10941097
internal_chat_message_metadata_passthrough: None,
10951098
},
@@ -1378,6 +1381,7 @@ fn normalize_adds_missing_output_for_custom_tool_call() {
13781381
status: None,
13791382
call_id: "tool-x".to_string(),
13801383
name: "custom".to_string(),
1384+
namespace: None,
13811385
input: "{}".to_string(),
13821386
internal_chat_message_metadata_passthrough: None,
13831387
}];
@@ -1393,6 +1397,7 @@ fn normalize_adds_missing_output_for_custom_tool_call() {
13931397
status: None,
13941398
call_id: "tool-x".to_string(),
13951399
name: "custom".to_string(),
1400+
namespace: None,
13961401
input: "{}".to_string(),
13971402
internal_chat_message_metadata_passthrough: None,
13981403
},
@@ -1512,6 +1517,7 @@ fn normalize_mixed_inserts_and_removals() {
15121517
status: None,
15131518
call_id: "t1".to_string(),
15141519
name: "tool".to_string(),
1520+
namespace: None,
15151521
input: "{}".to_string(),
15161522
internal_chat_message_metadata_passthrough: None,
15171523
},
@@ -1556,6 +1562,7 @@ fn normalize_mixed_inserts_and_removals() {
15561562
status: None,
15571563
call_id: "t1".to_string(),
15581564
name: "tool".to_string(),
1565+
namespace: None,
15591566
input: "{}".to_string(),
15601567
internal_chat_message_metadata_passthrough: None,
15611568
},
@@ -1668,6 +1675,7 @@ fn normalize_adds_missing_output_for_custom_tool_call_panics_in_debug() {
16681675
status: None,
16691676
call_id: "tool-x".to_string(),
16701677
name: "custom".to_string(),
1678+
namespace: None,
16711679
input: "{}".to_string(),
16721680
internal_chat_message_metadata_passthrough: None,
16731681
}];
@@ -1810,6 +1818,7 @@ fn normalize_mixed_inserts_and_removals_panics_in_debug() {
18101818
status: None,
18111819
call_id: "t1".to_string(),
18121820
name: "tool".to_string(),
1821+
namespace: None,
18131822
input: "{}".to_string(),
18141823
internal_chat_message_metadata_passthrough: None,
18151824
},

codex-rs/core/src/session/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10482,6 +10482,7 @@ async fn fatal_tool_error_stops_turn_and_reports_error() {
1048210482
status: None,
1048310483
call_id: "call-1".to_string(),
1048410484
name: "shell_command".to_string(),
10485+
namespace: None,
1048510486
input: "{}".to_string(),
1048610487
internal_chat_message_metadata_passthrough: None,
1048710488
};

0 commit comments

Comments
 (0)