Skip to content

Commit b347f80

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents b21a8bb + 996aa23 commit b347f80

74 files changed

Lines changed: 2191 additions & 213 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codex-rs/Cargo.lock

Lines changed: 2 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/ClientRequest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,16 @@
471471
},
472472
{
473473
"properties": {
474+
"detail": {
475+
"anyOf": [
476+
{
477+
"$ref": "#/definitions/ImageDetail"
478+
},
479+
{
480+
"type": "null"
481+
}
482+
]
483+
},
474484
"image_url": {
475485
"type": "string"
476486
},

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7173,6 +7173,16 @@
71737173
},
71747174
{
71757175
"properties": {
7176+
"detail": {
7177+
"anyOf": [
7178+
{
7179+
"$ref": "#/definitions/v2/ImageDetail"
7180+
},
7181+
{
7182+
"type": "null"
7183+
}
7184+
]
7185+
},
71767186
"image_url": {
71777187
"type": "string"
71787188
},

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,6 +3750,16 @@
37503750
},
37513751
{
37523752
"properties": {
3753+
"detail": {
3754+
"anyOf": [
3755+
{
3756+
"$ref": "#/definitions/ImageDetail"
3757+
},
3758+
{
3759+
"type": "null"
3760+
}
3761+
]
3762+
},
37533763
"image_url": {
37543764
"type": "string"
37553765
},

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
},
2626
{
2727
"properties": {
28+
"detail": {
29+
"anyOf": [
30+
{
31+
"$ref": "#/definitions/ImageDetail"
32+
},
33+
{
34+
"type": "null"
35+
}
36+
]
37+
},
2838
"image_url": {
2939
"type": "string"
3040
},

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@
8383
},
8484
{
8585
"properties": {
86+
"detail": {
87+
"anyOf": [
88+
{
89+
"$ref": "#/definitions/ImageDetail"
90+
},
91+
{
92+
"type": "null"
93+
}
94+
]
95+
},
8696
"image_url": {
8797
"type": "string"
8898
},
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// GENERATED CODE! DO NOT MODIFY BY HAND!
22

33
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
4+
import type { ImageDetail } from "./ImageDetail";
45

5-
export type ContentItem = { "type": "input_text", text: string, } | { "type": "input_image", image_url: string, } | { "type": "output_text", text: string, };
6+
export type ContentItem = { "type": "input_text", text: string, } | { "type": "input_image", image_url: string, detail?: ImageDetail, } | { "type": "output_text", text: string, };

codex-rs/app-server/src/codex_message_processor.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ use codex_login::default_client::set_default_client_residency_requirement;
279279
use codex_login::login_with_api_key;
280280
use codex_login::request_device_code;
281281
use codex_login::run_login_server;
282+
use codex_mcp::McpRuntimeEnvironment;
282283
use codex_mcp::McpServerStatusSnapshot;
283284
use codex_mcp::McpSnapshotDetail;
284285
use codex_mcp::collect_mcp_server_status_snapshot_with_detail;
@@ -5724,10 +5725,40 @@ impl CodexMessageProcessor {
57245725
.to_mcp_config(self.thread_manager.plugins_manager().as_ref())
57255726
.await;
57265727
let auth = self.auth_manager.auth().await;
5728+
let runtime_environment = match self.thread_manager.environment_manager().current().await {
5729+
Ok(Some(environment)) => {
5730+
// Status listing has no turn cwd. This fallback is used only
5731+
// by executor-backed stdio MCPs whose config omits `cwd`.
5732+
McpRuntimeEnvironment::new(environment, config.cwd.to_path_buf())
5733+
}
5734+
Ok(None) => McpRuntimeEnvironment::new(
5735+
Arc::new(codex_exec_server::Environment::default()),
5736+
config.cwd.to_path_buf(),
5737+
),
5738+
Err(err) => {
5739+
// TODO(aibrahim): Investigate degrading MCP status listing when
5740+
// executor environment creation fails.
5741+
let error = JSONRPCErrorError {
5742+
code: INTERNAL_ERROR_CODE,
5743+
message: format!("failed to create environment: {err}"),
5744+
data: None,
5745+
};
5746+
self.outgoing.send_error(request, error).await;
5747+
return;
5748+
}
5749+
};
57275750

57285751
tokio::spawn(async move {
5729-
Self::list_mcp_server_status_task(outgoing, request, params, config, mcp_config, auth)
5730-
.await;
5752+
Self::list_mcp_server_status_task(
5753+
outgoing,
5754+
request,
5755+
params,
5756+
config,
5757+
mcp_config,
5758+
auth,
5759+
runtime_environment,
5760+
)
5761+
.await;
57315762
});
57325763
}
57335764

@@ -5738,6 +5769,7 @@ impl CodexMessageProcessor {
57385769
config: Config,
57395770
mcp_config: codex_mcp::McpConfig,
57405771
auth: Option<CodexAuth>,
5772+
runtime_environment: McpRuntimeEnvironment,
57415773
) {
57425774
let detail = match params.detail.unwrap_or(McpServerStatusDetail::Full) {
57435775
McpServerStatusDetail::Full => McpSnapshotDetail::Full,
@@ -5748,6 +5780,7 @@ impl CodexMessageProcessor {
57485780
&mcp_config,
57495781
auth.as_ref(),
57505782
request_id.request_id.to_string(),
5783+
runtime_environment,
57515784
detail,
57525785
)
57535786
.await;

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use codex_app_server_protocol::ThreadStartResponse;
2121
use codex_app_server_protocol::TurnStartParams;
2222
use codex_app_server_protocol::TurnStartResponse;
2323
use codex_app_server_protocol::UserInput as V2UserInput;
24+
use codex_protocol::models::DEFAULT_IMAGE_DETAIL;
2425
use codex_protocol::models::FunctionCallOutputBody;
2526
use codex_protocol::models::FunctionCallOutputContentItem;
2627
use codex_protocol::models::FunctionCallOutputPayload;
@@ -477,7 +478,7 @@ async fn dynamic_tool_call_round_trip_sends_content_items_to_model() -> Result<(
477478
DynamicToolCallOutputContentItem::InputImage { image_url } => {
478479
FunctionCallOutputContentItem::InputImage {
479480
image_url,
480-
detail: None,
481+
detail: Some(DEFAULT_IMAGE_DETAIL),
481482
}
482483
}
483484
})
@@ -535,7 +536,8 @@ async fn dynamic_tool_call_round_trip_sends_content_items_to_model() -> Result<(
535536
},
536537
{
537538
"type": "input_image",
538-
"image_url": "data:image/png;base64,AAA"
539+
"image_url": "data:image/png;base64,AAA",
540+
"detail": "high"
539541
}
540542
])
541543
);

codex-rs/cli/tests/mcp_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async fn list_and_get_render_expected_output() -> Result<()> {
5555
.expect("docs server should exist after add");
5656
match &mut docs_entry.transport {
5757
McpServerTransportConfig::Stdio { env_vars, .. } => {
58-
*env_vars = vec!["APP_TOKEN".to_string(), "WORKSPACE_ID".to_string()];
58+
*env_vars = vec!["APP_TOKEN".into(), "WORKSPACE_ID".into()];
5959
}
6060
other => panic!("unexpected transport: {other:?}"),
6161
}

0 commit comments

Comments
 (0)