Uh oh!
There was an error while loading. Please reload this page.
feat(automation): approval as a durable-pause flow node (ADR-0019 P1–P3) - #1407
Merged
Conversation
Collapse approval onto the one flow engine: an Approval node suspends the
run on entry and resumes on a human decision, instead of a parallel
approval engine. Additive and non-breaking — the standalone process
engine is left intact for the migration window (A4/A5 deletions follow up).
P1 — engine durable suspend/resume
- FlowSuspendSignal thrown from executeNode, caught in execute()/resume(),
persisted to an in-memory suspendedRuns map.
- AutomationResult gains status ('completed'|'paused'|'failed') + runId;
IAutomationService gains optional resume(runId, signal?) and
listSuspendedRuns(). Resume selects the out-edge whose label matches
ResumeSignal.branchLabel. $runId injected into flow variables.
- screen node opts into pause via config.waitForInput.
P2 — Approval node contract (spec)
- APPROVAL_NODE_TYPE, ApprovalDecision, APPROVAL_BRANCH_LABELS,
ApprovalNodeConfigSchema (approvers / behavior / lockRecord /
escalation / approvalStatusField lowered into node config).
- Deprecate ApprovalProcessSchema + ApprovalActionType via JSDoc.
P3 — plugin-approvals node provider (additive bridge)
- Register the `approval` node (supportsPause, category:human) via the
ADR-0018 registry: on entry open a sys_approval_request (reusing
approver resolution / audit / lock / status mirror) and suspend;
decideApprovalNode finalizes and resumes down approve/reject edge.
- sys_approval_request gains flow_run_id / flow_node_id / node_config_json.
Tests: spec 6605, service-automation 79, plugin-approvals 41 — all green.The latest updates on your projects. Learn more about Vercel for GitHub.
|
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Realizes the core of ADR-0019 — collapse approval into the one flow engine, approval as a durable-pause node. This lands the additive, non-breaking foundation (phases A1–A3): the Approval node suspends a flow run on entry and resumes it on a human decision, riding the same engine as every other node. The standalone process-driven approval engine is left fully intact for the migration window; the destructive removal (A4/A5) is a deliberate follow-up PR.
What's in this PR
P1 — engine durable suspend/resume (
service-automation)FlowSuspendSignalthrown fromexecuteNode, caught inexecute()/resume(), persisted to an in-memorysuspendedRunsmap.AutomationResultgainsstatus: 'completed' | 'paused' | 'failed'+runId;IAutomationServicegains optionalresume(runId, signal?)andlistSuspendedRuns().labelmatchesResumeSignal.branchLabel.$runIdis injected into flow variables.screennode opts into pause viaconfig.waitForInput.P2 — Approval node contract (
spec)APPROVAL_NODE_TYPE,ApprovalDecision,APPROVAL_BRANCH_LABELS,ApprovalNodeConfigSchema— lowersapprovers/behavior/lockRecord/escalation/approvalStatusFieldinto node config.ApprovalProcessSchema+ApprovalActionTypedeprecated via JSDoc (not removed).P3 — node provider bridge (
plugin-approvals, additive)approvalnode (supportsPause,category: 'human') via the ADR-0018 registry. On entry it opens asys_approval_request(reusing approver resolution / audit / record lock / status mirror verbatim) and suspends;decideApprovalNodefinalizes the decision and resumes the run down the matchingapprove/rejectedge.sys_approval_requestgains correlation fields:flow_run_id/flow_node_id/node_config_json.Deferred to a follow-up PR (A4/A5)
Deleting
action-executor.ts,ApprovalActionType, top-levelApprovalProcessSchema+approval.form.ts, retiringprocess_hashpinning, and removingconnector_actionremnants. Held back because these are a destructive removal of a still-functioning subsystem with active consumers (metadata-form-registry.ts,stack.zod.ts, CRM examples/seeders, and the constrainedmetadata-type-schemas.ts). The ADR itself frames the process model as "retained for the migration window."Test plan
spec— 6605 passservice-automation— 79 pass (incl. 6 new durable suspend/resume tests + screenwaitForInput)plugin-approvals— 41 pass (incl. 6 new node-bridge tests: suspend-on-entry, approve/reject resume, unanimous hold-then-resume, non-approver FORBIDDEN)