Skip to content

feat: Mid-execution escalation — WAITING_FOR_INPUT state, chat notifications, pause/resume #112

@Abernaughty

Description

@Abernaughty

Summary

Implement mid-execution escalation: when an agent encounters a decision point requiring user input, the graph pauses indefinitely in a WAITING_FOR_INPUT state, notifies the user via Chat, and resumes when they respond.

Context

Per the Dashboard Workflow Roadmap, Section 2.4. Currently, agents either complete autonomously or escalate at the end (budget/retry exhaustion). This adds a mid-stream pause mechanism for ambiguous decisions that need human judgment.

Design

Escalation Flow

  1. Agent encounters decision point exceeding its authority
  2. Graph enters WAITING_FOR_INPUT state (reuses existing ESCALATED non-terminal status)
  3. Token budget clock pauses
  4. Chat UI receives SSE event triggering notification badge on Chat activity bar icon
  5. Planner reformulates the question as a clear prompt for the user
  6. User responds in Chat
  7. Response feeds back into the graph at the requesting node
  8. Token budget clock resumes

Timeout Behavior

Pause indefinitely until user responds. No auto-cancel, no best-guess attempts. The task waits.

SSE Events

# New SSE event type
{
    "type": "waiting_for_input",
    "task_id": "...",
    "agent_id": "dev",
    "question": "Should I use REST or GraphQL for this endpoint?",
    "context": "...",
    "timestamp": "..."
}

# Resume event
{
    "type": "input_received",
    "task_id": "...",
    "response": "Use GraphQL",
    "timestamp": "..."
}

Acceptance Criteria

  • WAITING_FOR_INPUT graph state (reusing ESCALATED non-terminal status)
  • Token budget clock pauses during wait
  • SSE waiting_for_input event emitted with question and context
  • Chat notification badge on activity bar icon when input needed
  • Planner reformulates agent question as clear user prompt
  • User response captured in Chat and fed back to requesting node
  • Graph resumes execution from the paused node
  • Token budget clock resumes after response
  • Indefinite pause — no timeout, no auto-cancel
  • Multiple concurrent waits handled (edge case: unlikely in Phase 2 single-task mode)
  • Unit tests for pause/resume state transitions
  • Integration test: trigger escalation → respond → verify resume

Dependencies

Effort

Medium (1-2 sessions)

Source

Dashboard Workflow Roadmap, Section 2.4 — Mid-Execution Escalation

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions