Preserve list_agents output compatibility

This commit is contained in:
jif-oai
2026-06-26 14:50:37 +01:00
parent 3603f53af6
commit c6e40371d3
4 changed files with 11 additions and 2 deletions
+3
View File
@@ -78,6 +78,7 @@ pub(crate) struct LiveAgent {
pub(crate) struct ListedAgent {
pub(crate) agent_name: String,
pub(crate) agent_status: AgentStatus,
pub(crate) last_task_message: Option<String>,
}
/// Control-plane handle for multi-agent operations.
@@ -344,6 +345,7 @@ impl AgentControl {
agents.push(ListedAgent {
agent_name: root_path.to_string(),
agent_status: root_thread.agent_status().await,
last_task_message: None,
});
}
@@ -369,6 +371,7 @@ impl AgentControl {
agents.push(ListedAgent {
agent_name,
agent_status: thread.agent_status().await,
last_task_message: None,
});
}
@@ -435,9 +435,13 @@ fn list_agents_output_schema() -> Value {
"agent_status": {
"description": "Last known status of the agent.",
"allOf": [agent_status_output_schema()]
},
"last_task_message": {
"type": ["string", "null"],
"description": "Most recent user or inter-agent instruction received by the agent, when available."
}
},
"required": ["agent_name", "agent_status"],
"required": ["agent_name", "agent_status", "last_task_message"],
"additionalProperties": false
},
"description": "Live agents visible in the current root thread tree."
@@ -393,7 +393,7 @@ fn list_agents_tool_includes_path_prefix_and_agent_fields() {
);
assert_eq!(
output_schema.expect("list_agents output schema")["properties"]["agents"]["items"]["required"],
json!(["agent_name", "agent_status"])
json!(["agent_name", "agent_status", "last_task_message"])
);
}
@@ -179,6 +179,7 @@ struct ListAgentsResult {
struct ListedAgentResult {
agent_name: String,
agent_status: serde_json::Value,
last_task_message: serde_json::Value,
}
#[derive(Debug, Deserialize)]
@@ -1591,6 +1592,7 @@ async fn multi_agent_v2_list_agents_returns_completed_status() {
.find(|agent| agent.agent_name == "/root/worker")
.expect("worker agent should be listed");
assert_eq!(worker.agent_status, json!({"completed": "done"}));
assert_eq!(worker.last_task_message, serde_json::Value::Null);
assert_eq!(success, Some(true));
}