huskies: merge 551_bug_get_agent_output_mcp_tool_returns_fetch_failed_for_running_agents
This commit is contained in:
@@ -142,8 +142,13 @@ pub(super) async fn tool_get_agent_output(
|
||||
all_lines.push(String::new()); // blank line between sessions
|
||||
}
|
||||
|
||||
// Append buffered live events when a specific agent is requested.
|
||||
if let Some(agent_name) = agent_name_filter
|
||||
// Append buffered live events only when no disk logs exist yet.
|
||||
// emit_event() writes to disk synchronously, so disk is always up-to-date
|
||||
// when log files are present. Showing live events alongside disk logs would
|
||||
// produce duplicates. Only fall back to in-memory events when the log
|
||||
// writer failed and nothing was persisted to disk.
|
||||
if log_files.is_empty()
|
||||
&& let Some(agent_name) = agent_name_filter
|
||||
&& let Ok(live_events) = ctx.agents.drain_events(story_id, agent_name)
|
||||
&& !live_events.is_empty()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user