fix: allow errand agent to end session with questions and resume

The errand agent can now write { "status": "questions", ... } to
signal.json to pause mid-task and ask the user for clarification.
The session ends cleanly; the user answers via UI or CLI; the system
resumes the agent with their answers via sendUserMessage.

Two changes:
- buildErrandPrompt: adds "Option B" explaining the questions signal
  format and the resume-on-answer lifecycle, alongside the existing
  inline-question approach.
- sendUserMessage: extends allowed statuses from running|idle to also
  include waiting_for_input, so agents paused on a questions signal
  can be resumed when the user replies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas May
2026-03-06 14:54:53 +01:00
parent e2c489dc48
commit 41c5d292bb
5 changed files with 52 additions and 4 deletions

View File

@@ -634,7 +634,7 @@ export class MultiProviderAgentManager implements AgentManager {
const agent = await this.repository.findById(agentId);
if (!agent) throw new Error(`Agent not found: ${agentId}`);
if (agent.status !== 'running' && agent.status !== 'idle') {
if (agent.status !== 'running' && agent.status !== 'idle' && agent.status !== 'waiting_for_input') {
throw new Error(`Agent is not running (status: ${agent.status})`);
}