feat(automation): implement the wait node executor (durable timer/signal pause)#1469
Merged
Conversation
…ignal pause)
The designer offered a `wait` node but the engine had no executor, so flows
using it couldn't run. Implement it as a built-in:
- Suspends the run on entry (ADR-0019 durable pause — same suspend/resume
machinery as screen/approval; reads `$runId` like the approval node).
- timer → schedules a one-shot job (IJobService `{type:'once', at}`) that calls
`engine.resume(runId)` after the ISO-8601 `timerDuration`. No job service →
still suspends, resumable via external resume(runId) (logged, never no-ops).
- signal/webhook/manual/condition → suspends with the signal name as the
correlation key; an external producer resumes.
- Adds `parseIsoDuration` (PT1H/P3D/PT90M/P1DT12H/bare-ms).
A bare AutomationServicePlugin now ships 13 executors incl. `wait`.
Tests: wait-node.test.ts (parsing, suspend→resume traversal, one-shot
job-driven resume, signal suspend) — service-automation 113 passing.
Worked example: showcase_task_follow_up (wait → notify).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 free
to 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.
What
The flow designer offered a
waitnode, but the engine had no executor for it — so a flow usingwaitcouldn't actually run (it would hit "no executor for type 'wait'"). This implements it as a built-in node.waitsuspends the run on entry (ADR-0019 durable pause — the same suspend/resume machinery asscreen/approval, reading the engine-injected$runId), and resumes by one of two paths perwaitEventConfig.eventType:IJobService,{ type: 'once', at }) that callsengine.resume(runId)when the ISO-8601timerDurationelapses. With no job service, the run still suspends and is resumable via an externalresume(runId)(logged) — it never silently no-ops or fails the flow (matches the platform's degrade-don't-crash convention).Adds a
parseIsoDurationhelper (PT1H,P3D,PT90M,P1DT12H, bare ms). A bareAutomationServicePluginnow installs 13 executors includingwait.Why
First of the "designer can draw it, engine can't run it" gaps (the others:
subflow,boundary_event,parallel_gateway/join_gateway). Implementing the executors makes the designer's node palette honest and the showcase examples runnable + testable.waitis the highest-value + most tractable (reuses existing suspend/resume).Tests
builtin/wait-node.test.ts:parseIsoDuration(ISO durations, bare ms, unparseable/non-positive → undefined)resume(runId)continues traversal downstream{ type: 'once' }job ~duration out; firing its handler resumes the run + cancels the one-shot@objectstack/service-automation113 passing. Worked exampleshowcase_task_follow_up(wait → notify) added to the showcase; showcase suite green.🤖 Generated with Claude Code