Simplify Codex Apps file download materialization

This commit is contained in:
Liang-Ting Jiang
2026-04-28 11:59:29 -07:00
parent c53d84690f
commit 963420d166
2 changed files with 4 additions and 22 deletions
+1 -21
View File
@@ -1,4 +1,3 @@
use crate::session::session::Session;
use crate::session::turn_context::TurnContext;
use codex_api::download_openai_file;
use codex_login::CodexAuth;
@@ -51,25 +50,6 @@ fn should_materialize_codex_apps_file_download(
}
pub(crate) async fn maybe_materialize_codex_apps_file_download_result(
sess: &Session,
turn_context: &TurnContext,
server: &str,
codex_apps_meta: Option<&JsonMap<String, JsonValue>>,
result: CallToolResult,
) -> CallToolResult {
let auth = sess.services.auth_manager.auth().await;
maybe_materialize_codex_apps_file_download_result_with_auth(
turn_context,
&sess.conversation_id.to_string(),
auth.as_ref(),
server,
codex_apps_meta,
result,
)
.await
}
async fn maybe_materialize_codex_apps_file_download_result_with_auth(
turn_context: &TurnContext,
session_id: &str,
auth: Option<&CodexAuth>,
@@ -302,7 +282,7 @@ mod tests {
meta: None,
};
let result = maybe_materialize_codex_apps_file_download_result_with_auth(
let result = maybe_materialize_codex_apps_file_download_result(
&turn_context,
"session-1",
Some(&CodexAuth::create_dummy_chatgpt_auth_for_testing()),
+3 -1
View File
@@ -549,9 +549,11 @@ async fn execute_mcp_tool_call(
.call_tool(server, tool_name, rewritten_arguments, request_meta)
.await
.map_err(|e| format!("tool call error: {e:?}"))?;
let auth = sess.services.auth_manager.auth().await;
let result = maybe_materialize_codex_apps_file_download_result(
sess,
turn_context,
&sess.conversation_id.to_string(),
auth.as_ref(),
server,
metadata.and_then(|metadata| metadata.codex_apps_meta.as_ref()),
result,