execute_prompt: add BUSY check before session reset to prevent conflicts
Apra Fleet is an open-source MCP server
Brought to you by:
apralabs
Originally created by: kumaakh
When a session is reset and a new prompt is dispatched, there is no check for whether a running process is still active on the member. The old process keeps running and may conflict with the new session.
Fix: Before resetting a session, check for running agent processes (similar to fleetProcessCheck) and surface a warning or block if the member is actively running.
Backlog item [#8] from docs/MCP-BACKLOG.md. Low priority.
Originally posted by: kumaakh
Related to [#147] — the internal retry paths in execute-prompt.ts (stale session retry + server overload retry, lines 139–152) are a concrete instance of this problem: each retry spawns a new process without killing the previous one. Fix for [#147] will address this.
Related
Tickets:
#147Originally posted by: kumaakh
Superseded by [#147] which has a deeper root cause analysis: the retry logic uses SSH exit codes as a proxy for Claude's state, which is unreliable. The process-existence check described here is the right fix direction.
Related
Tickets:
#147Originally posted by: kumaakh
Technical direction: Superseded by [#147] which contains a complete root cause analysis and implementation plan (PID tracking + kill before retry). Closing this issue is appropriate once [#147] is implemented — that fix covers this scenario as a subset (the stale-session retry is the exact instance of this bug, and the kill-stored-PID logic at the top of every execute_prompt call prevents any new dispatch from conflicting with a still-running process on the same member).
Related
Tickets:
#147