feat: rename to get more explicit close agent (#14935)

https://github.com/openai/codex/issues/14907
This commit is contained in:
jif-oai 2026-03-17 14:37:20 +00:00 committed by GitHub
parent 31648563c8
commit 4ed19b0766
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 7 deletions

View file

@ -95,13 +95,15 @@ impl ToolHandler for Handler {
.await;
result?;
Ok(CloseAgentResult { status })
Ok(CloseAgentResult {
previous_status: status,
})
}
}
#[derive(Debug, Deserialize, Serialize)]
pub(crate) struct CloseAgentResult {
pub(crate) status: AgentStatus,
pub(crate) previous_status: AgentStatus,
}
impl ToolOutput for CloseAgentResult {

View file

@ -971,7 +971,7 @@ async fn wait_agent_returns_final_status_without_timeout() {
}
#[tokio::test]
async fn close_agent_submits_shutdown_and_returns_status() {
async fn close_agent_submits_shutdown_and_returns_previous_status() {
let (mut session, turn) = make_session_and_context().await;
let manager = thread_manager();
session.services.agent_control = manager.agent_control();
@ -993,7 +993,7 @@ async fn close_agent_submits_shutdown_and_returns_status() {
let (content, success) = expect_text_output(output);
let result: close_agent::CloseAgentResult =
serde_json::from_str(&content).expect("close_agent result should be json");
assert_eq!(result.status, status_before);
assert_eq!(result.previous_status, status_before);
assert_eq!(success, Some(true));
let ops = manager.captured_ops();

View file

@ -195,9 +195,12 @@ fn close_agent_output_schema() -> JsonValue {
json!({
"type": "object",
"properties": {
"status": agent_status_output_schema()
"previous_status": {
"description": "The agent status observed before shutdown was requested.",
"allOf": [agent_status_output_schema()]
}
},
"required": ["status"],
"required": ["previous_status"],
"additionalProperties": false
})
}
@ -1523,7 +1526,7 @@ fn create_close_agent_tool() -> ToolSpec {
ToolSpec::Function(ResponsesApiTool {
name: "close_agent".to_string(),
description: "Close an agent when it is no longer needed and return its last known status. Don't keep agents open for too long if they are not needed anymore.".to_string(),
description: "Close an agent when it is no longer needed and return its previous status before shutdown was requested. Don't keep agents open for too long if they are not needed anymore.".to_string(),
strict: false,
defer_loading: None,
parameters: JsonSchema::Object {