mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Attach hosted app context to file uploads (#38101)
## What changed - Include the connector ID, action name, and model in file creation requests for hosted app tool calls. - Use the file size returned by upload finalization when available, while falling back to the local size for older server responses. - Keep upload finalization requests empty for compatibility with older servers. ## Testing - Cover hosted app upload metadata and legacy finalization responses. GitOrigin-RevId: 1bc834736db4fe3515f8224965cde0e5d6955ca3
This commit is contained in:
1 parent
ca4d532b2a
commit
c909d1bc04
5 files changed
+149
-15
No files matched your search
@@ -23,6 +23,7 @@ use crate::turn_metadata::McpTurnMetadataContext;
|
||||
use codex_analytics::AppInvocation;
|
||||
use codex_analytics::InvocationType;
|
||||
use codex_analytics::build_track_events_context;
|
||||
use codex_api::HostedFileUploadContext;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::types::AppToolApproval;
|
||||
use codex_config::types::ApprovalsReviewer;
|
||||
@@ -434,11 +435,21 @@ async fn handle_approved_mcp_tool_call(
|
||||
}
|
||||
maybe_mark_thread_memory_mode_polluted(sess, turn_context, &prepared_call)
|
||||
.await;
|
||||
let hosted_upload = item_metadata
|
||||
.connector_id
|
||||
.as_ref()
|
||||
.zip(item_metadata.action_name.as_ref())
|
||||
.map(|(connector_id, action_name)| HostedFileUploadContext {
|
||||
connector_id: connector_id.clone(),
|
||||
action_name: action_name.clone(),
|
||||
model: turn_context.model_info.slug.clone(),
|
||||
});
|
||||
let rewritten_arguments = rewrite_mcp_tool_arguments_for_openai_files(
|
||||
sess,
|
||||
step_context,
|
||||
arguments_value,
|
||||
metadata.openai_file_input_optional_fields.as_ref(),
|
||||
hosted_upload.as_ref(),
|
||||
)
|
||||
.await
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
|
||||
Reference in new issue
Block a user