fix(workflows): enable interactive workflow resume after approval gate#1259
fix(workflows): enable interactive workflow resume after approval gate#1259
Conversation
#1131) Interactive DAG workflows with approval/loop gates paused correctly but never resumed on the web UI due to three cascading bugs: missing parent_conversation_id in the DB record, wrong status mutation for interactive loops, and no auto-dispatch from the approve endpoint. Changes: - Pass conversation.id as parentConversationId to executeWorkflow for interactive workflows so findResumableRunByParentConversation matches - Keep interactive_loop runs in 'paused' status (not 'failed') so getPausedWorkflowRun finds them via the natural-language approval path - Auto-dispatch to orchestrator after interactive_loop approval instead of requiring a manual follow-up message - Add test assertion verifying parentConversationId is passed Fixes #1131 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Comprehensive PR ReviewPR: #1259 — fix(workflows): enable interactive workflow resume after approval gate SummaryThe core fix is correct and minimal — adding Verdict:
🔴 High Issues (Must Fix Before Merge)1. Silent Success When Parent Conversation Cannot Be Resolved📍 When Current code: Fix: Guard with early error return when if (!parentConv?.platform_conversation_id) {
getLog().error({ runId, parentConvDbId }, 'api.workflow_run_approve_interactive_loop_no_parent_conv');
return apiError(c, 500, 'Workflow approved but could not auto-resume: parent conversation not found. Send a message to continue the workflow.');
}
void dispatchToOrchestrator(parentConv.platform_conversation_id, comment).catch(err => {
getLog().error({ err, runId }, 'api.workflow_run_approve_interactive_loop_dispatch_failed');
});
return c.json({ success: true, message: `Workflow approved and resuming: ${run.workflow_name}.` });2.
|
| Issue | Location | Suggestion |
|---|---|---|
Fragile positional-index test assertion callArgs[10] |
orchestrator-agent.test.ts:1103-1105 |
Add expect(callArgs).toHaveLength(11) before index check |
c.req.json().catch(() => ({})) silently loses parse errors (pre-existing) |
api.ts:1860 |
Add getLog().warn(...) in catch; elevated risk now that comment is injected into $LOOP_USER_INPUT |
approval-nodes.md Design Notes incomplete for interactive loop path |
Lines 225-229 | Add: interactive loop keeps paused status and uses natural-language resume path |
✅ What's Good
- Core fix is correct and minimal —
conversation.idasparentConversationIdis exactly right, clearly commented - Branching is clean —
if (approval.type !== 'interactive_loop')early return keeps standard path untouched archon-gsd.yaml— Well-structured 1216-line default workflow; clear phase comments, parallel nodes with explicitdepends_on, sensiblemax_iterationscaps- E2E fixtures — Minimal and purposeful scaffolding; exactly what's needed
- Outer try/catch — Structured logging with
runId + err, consistent with the rest of the file - Mock infrastructure for missing tests already exists — no new mocks needed to add the suggested tests
📋 Suggested Follow-up Issue
"Refactor executeWorkflow to use options object instead of positional params" (P3) — would make the parentConversationId positional test assertion non-fragile.
Reviewed by Archon comprehensive-pr-review workflow
Full artifacts: ~/.archon/workspaces/coleam00/Archon/artifacts/runs/478f22b2bad36a0fdb3e5e352db9e16e/review/
…_loop approve tests - Return 500 (not silent success) when the parent conversation cannot be resolved during interactive_loop approval, per Fail Fast principle - Add .catch() to void dispatchToOrchestrator call to log dispatch errors - Add length guard to positional-index test assertion in orchestrator test - Add tests for the interactive_loop approve branch (status stays paused, loop_user_input stored, dispatch to parent conv, null-parent fallback, unresolvable conv returns 500) and assert updateWorkflowRun for standard approval path - Update docs: auto-resume on Web UI, stale "send a follow-up message" language removed; add Design Notes clarifying interactive loop path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix Report: PR #1259Date: 2026-04-16T00:30:00Z SummaryAll HIGH, MEDIUM, and LOW issues from the consolidated review were addressed. The silent-success bug on unresolvable parent conversation is now a 500 error with an actionable message. The Fixes Applied
Tests Added
Skipped
Validation
|
…ject literal The surrounding block comment already explains why status stays 'paused' for the interactive loop path; the duplicated inner comment adds no new information. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Archon PR Validation ReportVerdict: APPROVE SummaryAll three cascading bugs (missing Bug Confirmation
IssuesNo blocking issues found. Non-blocking: Pre-existing bug — resumable-run path ( Validated by archon-validate-pr workflow |
Summary
parentConversationIdtoexecuteWorkflow, soparent_conversation_idwas stored as NULL in the DB.findResumableRunByParentConversationqueries this column and never found a match, breaking the entire resume chain.status: 'failed'forinteractive_loopapproval types, causinggetPausedWorkflowRunto return null and killing the natural-language resume path.Changes
packages/core/src/orchestrator/orchestrator-agent.tsconversation.idasparentConversationId(11th param) to theexecuteWorkflowcall in the interactive workflow branchpackages/server/src/routes/api.tsinteractive_loop, keep statuspausedand auto-dispatch to orchestrator viadispatchToOrchestrator; for standard approvals, logic is unchangedpackages/core/src/orchestrator/orchestrator-agent.test.tsexecuteWorkflowreceivesconversation.idasparentConversationIdfor interactive web workflows.archon/workflows/e2e-*.yamlValidation
All checks pass (
bun run validate):How to Test
interactive: true) with anapprovalorloopnodeworkflow approvestill works (unchanged path)Fixes #1131