mirror of
https://github.com/openai/codex.git
synced 2026-05-01 09:56:37 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user