mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:23:33 +00:00
fix(agents): avoid empty task text and clear idle spinner
This commit is contained in:
@@ -113,7 +113,22 @@ impl AgentManager {
|
||||
.agents
|
||||
.values()
|
||||
.next()
|
||||
.map(|agent| (agent.context.clone(), agent.output_goal.clone()))
|
||||
.map(|agent| {
|
||||
let context = agent
|
||||
.context
|
||||
.as_ref()
|
||||
.and_then(|value| if value.trim().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(value.clone())
|
||||
});
|
||||
let task = if agent.prompt.trim().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(agent.prompt.clone())
|
||||
};
|
||||
(context, task)
|
||||
})
|
||||
.unwrap_or((None, None));
|
||||
let payload = AgentStatusUpdatePayload { agents, context, task };
|
||||
let _ = sender.send(payload);
|
||||
|
||||
@@ -6644,6 +6644,29 @@ impl ChatWidget<'_> {
|
||||
self.agent_context = context;
|
||||
self.agent_task = task;
|
||||
|
||||
// Fallback: if every agent we know about has reached a terminal state and
|
||||
// there is no active streaming or tooling, clear the spinner even if the
|
||||
// backend hasn't sent TaskComplete yet. This prevents the footer from
|
||||
// getting stuck on "Responding..." after multi-agent runs that yield
|
||||
// early.
|
||||
if self.bottom_pane.is_task_running() {
|
||||
let all_agents_terminal = !self.agent_runtime.is_empty()
|
||||
&& self
|
||||
.agent_runtime
|
||||
.values()
|
||||
.all(|rt| rt.completed_at.is_some());
|
||||
if all_agents_terminal {
|
||||
let any_tools_running = !self.exec.running_commands.is_empty()
|
||||
|| !self.tools_state.running_custom_tools.is_empty()
|
||||
|| !self.tools_state.running_web_search.is_empty();
|
||||
let any_streaming = self.stream.is_write_cycle_active();
|
||||
if !(any_tools_running || any_streaming) {
|
||||
self.bottom_pane.set_task_running(false);
|
||||
self.bottom_pane.update_status_text(String::new());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update overall task status based on agent states
|
||||
self.overall_task_status = if self.active_agents.is_empty() {
|
||||
"preparing".to_string()
|
||||
|
||||
Reference in New Issue
Block a user