Context
When the server restarts mid-execution, the executor process dies but tool results may still arrive from the client. Tasks.add_tool_result returns {:ok, interaction, :no_executor} in this case. The channel then checks Interaction.all_pending_tools_resolved?/1 to decide whether to resume the agent. This critical recovery path has no test coverage.
Missing Invariant
Tool results arriving after executor death must:
- Be persisted successfully
- Return
:no_executor status
- Trigger agent resume when all pending tools are resolved
Proposed Test
- Start an agent with an interactive tool call
- Kill the executor process (simulating server restart)
- Submit the tool result via
Tasks.add_tool_result
- Assert the return is
{:ok, _interaction, :no_executor}
- Optionally verify
all_pending_tools_resolved? returns true and the agent can be re-started
File
apps/frontman_server/test/frontman_server/tasks/execution_test.exs
Context
When the server restarts mid-execution, the executor process dies but tool results may still arrive from the client.
Tasks.add_tool_resultreturns{:ok, interaction, :no_executor}in this case. The channel then checksInteraction.all_pending_tools_resolved?/1to decide whether to resume the agent. This critical recovery path has no test coverage.Missing Invariant
Tool results arriving after executor death must:
:no_executorstatusProposed Test
Tasks.add_tool_result{:ok, _interaction, :no_executor}all_pending_tools_resolved?returns true and the agent can be re-startedFile
apps/frontman_server/test/frontman_server/tasks/execution_test.exs