story-kit: create 131_bug_get_agent_output_stream_always_times_out_for_running_agents

This commit is contained in:
Dave
2026-02-24 13:05:07 +00:00
parent cbe3545a47
commit 88aa2de2ad

View File

@@ -25,6 +25,21 @@ The `get_agent_output` MCP tool consistently returns "Stream timed out; call aga
`get_agent_output` streams back text tokens and status events from the running agent in real time. `session_id` is populated once the agent's first streaming event arrives. `get_agent_output` streams back text tokens and status events from the running agent in real time. `session_id` is populated once the agent's first streaming event arrives.
## Reopened — Previous Fix Did Not Work
This was archived after a coder pass but the bug is still present. With 3 agents actively running:
- `get_agent_output` returned 141 events on one call, then 0 events on the next call with a 5s timeout
- None of the events contained text output — only metadata/status events
- The server logs (`get_server_logs`) DO show agent activity (spawn commands, MCP calls), so the agents are working — the output just isn't being captured/forwarded
### Investigation needed
The coder needs to trace the full data path:
1. How does `run_agent_pty_streaming` (server/src/agents.rs) capture PTY output from the claude process?
2. How are those events published to the broadcast channel that `get_agent_output` subscribes to?
3. Is the broadcast channel being created before the agent starts producing output, or is there a race where early events are lost?
4. Are text tokens from the PTY being sent as `AgentEvent` variants that `get_agent_output` actually serializes, or are they filtered out?
## Acceptance Criteria ## Acceptance Criteria
- [ ] get_agent_output returns streaming text events while an agent is actively running - [ ] get_agent_output returns streaming text events while an agent is actively running