Skip to content

Interactive workflows cannot resume after approval gate (parent_conversation_id is NULL) #1131

@jejanov

Description

@jejanov

Bug Description

Interactive workflows with approval gates (interactive loop nodes with gate_message) cannot resume after the user approves. The workflow pauses correctly, the approval is recorded in the DB, but the resume never triggers.

Steps to Reproduce

  1. Create a DAG workflow with interactive: true at the workflow level
  2. Include an interactive loop node with gate_message (e.g., a plan approval gate)
  3. Run the workflow from the web UI
  4. Workflow runs through prior nodes, pauses at the interactive gate
  5. Approve via the UI button or by typing in chat
  6. Expected: workflow resumes from the paused node
  7. Actual: no further events are written; the run stays in failed status

Root Cause

In packages/core/src/orchestrator/orchestrator-agent.ts, dispatchOrchestratorWorkflow has three dispatch paths:

  1. Resumable run detected (line ~269) — calls executeWorkflow with 9 args
  2. Interactive workflow (line ~282) — calls executeWorkflow with 9 args
  3. Background workflow — calls dispatchBackgroundWorkflow which pre-creates the run with parent_conversation_id set

Paths 1 and 2 never pass parentConversationId (the 11th parameter of executeWorkflow), so it's stored as NULL in remote_agent_workflow_runs.

When the approval is processed, the resume lookup at findResumableRunByParentConversation (in packages/core/src/db/workflows.ts) queries:

WHERE parent_conversation_id = $2

This never matches NULL, so the resumable run is never found and the workflow never resumes.

Evidence

Queried the DB for a real workflow run that hit this:

id: 6e4d0513...
workflow_name: compliance-phase
status: failed
parent_conversation_id: NULL  <-- this is the problem

Events show approval_received but no subsequent node execution events.

Environment

  • Archon v0.3.6 (dev branch, commit a4242e6)
  • Platform: web UI
  • Database: SQLite

Proposed Fix

Pass conversation.id as parentConversationId for the interactive and resumable-run branches in dispatchOrchestratorWorkflow, matching what the background workflow path already does via the pre-created run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority - Address soon, next in queuearea: databaseDatabase operationsarea: orchestratorMain conversation orchestrationarea: workflowsWorkflow enginebugSomething is brokeneffort/lowSingle file or function, one responsibility, isolated change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions