Enforce single tool output type in codex handlers (#14157)

We'll need to associate output schema with each tool. Each tool can only
have on output type.
This commit is contained in:
pakrym-oai
2026-03-09 22:49:44 -06:00
committed by GitHub
parent 63597d1b2d
commit d71e042694
26 changed files with 345 additions and 355 deletions

View File

@@ -46,7 +46,7 @@ use crate::state::TaskKind;
use crate::tasks::SessionTask;
use crate::tasks::SessionTaskContext;
use crate::tools::ToolRouter;
use crate::tools::context::TextToolOutput;
use crate::tools::context::FunctionToolOutput;
use crate::tools::context::ToolInvocation;
use crate::tools::context::ToolPayload;
use crate::tools::handlers::ShellHandler;
@@ -89,11 +89,10 @@ use std::time::Duration as StdDuration;
#[path = "codex_tests_guardian.rs"]
mod guardian_tests;
fn expect_text_tool_output(output: &dyn std::any::Any) -> String {
let Some(output) = output.downcast_ref::<TextToolOutput>() else {
panic!("unexpected tool output");
};
output.text.clone()
use codex_protocol::models::function_call_output_content_items_to_text;
fn expect_text_tool_output(output: &FunctionToolOutput) -> String {
function_call_output_content_items_to_text(&output.body).unwrap_or_default()
}
struct InstructionsTestCase {
@@ -4144,7 +4143,7 @@ async fn rejects_escalated_permissions_when_policy_not_on_request() {
})
.await;
let output = expect_text_tool_output(&*resp2.expect("expected Ok result"));
let output = expect_text_tool_output(&resp2.expect("expected Ok result"));
#[derive(Deserialize, PartialEq, Eq, Debug)]
struct ResponseExecMetadata {