mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
b1bcb8e6dfc3c5f502e071b187a2ea3a73677cd7
Problem: When calling send_agent_prompt on an agent that already has an
active run, it errored with "Agent {id} already has an active run"
instead of interrupting and sending the prompt (like the app does).
Solution: Modified the send_agent_prompt MCP handler in mcp-server.ts to:
- Check if agent has an active run (lifecycle === "running" || pendingRun)
- If running, call cancelAgentRun() to interrupt the current run
- Poll wait (max 5s, 50ms interval) for agent to become idle
- Then start the new run
This matches the behavior of session.ts:interruptAgentIfRunning().
The polling wait is necessary because cancelAgentRun() only initiates
cancellation (fires and forgets via void promise.catch()) and doesn't
wait for the pendingRun to be cleared.
Added E2E test "send_agent_prompt interrupts running agent and processes
new message" that verifies the fix works correctly.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Languages
TypeScript
98.1%
JavaScript
1.3%
Shell
0.1%
Swift
0.1%