VIP-56: Durable waits: timers, signals and human answers
Status: accepted by Will, 2026-11-23. Will: "56 I accept". Built 2026-11-23: runtime (Experimental.Durable.sleep, until, signal, race, raceSteps, DeadlineExceeded, declared-workflow targets on send/answer/run/spawn/start, Experimental.Human) and compiler (binding-resolved wait recognition, EK5504 fiber-wait messages, EK5601 wait-outside-workflow, try.race/try.any workflow lowering, static readonly deadline). (Previously reopened 2026-11-11 awaiting Will's review.)
Will's words
Vibelang is meant to have most of the features of durable execution agents etc. built into it. What is that status? Are the VIP open or are VIP missing for things like adding llm calls or jev calls to language sandboxing durable execution etc?
Summary
One sentence. Inside a workflow a wait parks the run instead of holding a fiber, and the compiler turns three library calls into plan nodes: Experimental.Durable.sleep for time, a signal's wait() for a typed value from outside, and Experimental.Human for a person.
One paragraph. A workflow that waits a week for an approval must not keep a process alive for a week. The reference engine (an existing Effect durable-execution framework these built-ins are modelled on) records the wait in the journal and releases the run; a timer, a token or an answer wakes it later, on any machine. This VIP gives those waits Vibe forms and adds no keyword. It is a language VIP because the compiler must recognize each call, by the binding it resolves to, and lower it to a node in the workflow's plan (durable-tasks-workflows). It must also refuse a fiber wait in a workflow body, where sleep would hold a process and vanish on a restart.
Release("build-42")
│
├─ Human.confirm("ship", …) park: approval no process held ◄── Human.answer(Release, run, "ship", true)
├─ Durable.sleep("1 minute") park: timer wake time is in the journal
└─ Deploy("build-42") runs onceDecision
// proposed
task Deploy {
static readonly tier = "irreversible"
static readonly idempotencyKey = (build: string) => `deploy:${build}`
effect call(build: string): string
}
export workflow Release {
effect call(build: string) {
const approved = try Experimental.Human.confirm("ship", `Ship ${build}?`, { timeout: "6 hours" })
if (!approved) return "held"
try Experimental.Durable.sleep("1 minute")
return try Deploy(build)
}
}
export effect function approve(run: string) {
try Experimental.Human.answer(Release, run, "ship", true)
}A signal carries a typed value into a run. Both ends import one value:
// proposed
schema Paid { amount: number }
export const paid = Experimental.Durable.signal("paid", Paid)
export workflow Checkout {
effect call(order: string) {
const payment = try.race [paid.wait(), Experimental.Durable.sleep("1 day")]
return payment ? try Ship(order, payment.amount) : try Cancel(order)
}
}
export effect function onWebhook(run: string, amount: number) {
try paid.send(Checkout, run, { amount })
}Signals
Experimental.Durable.signal(name, schema)declares a wait point. The schema is a durable boundary (VIP-44), and the value crosses in its JSON form.- Clarified 2026-11-11: "its JSON form" is VIP-44's default, not a second rule. The value crosses through its schema as VIP-44 rules: its identity comes from canonical JSON, and its stored and sent bytes come from the injected
RpcSerialization, whose default isRpcSerialization.layerJson. The journal holds the schema's encoded form and the waiting run receives the decoded type, so aDatefield is journaled as its ISO string and arrives as aDate. VIP-29's "encoding is not JSON serialization" says the same from the other side: the schema gives the encoded value, and the serializer turns it into bytes. nameis local to a run. The address of a wait is the workflow, the run and the name, so two workflows may both use"paid".try paid.wait()in a workflow body waits for the value.try paid.wait("second")names a second wait point on the same signal in one run.try paid.send(W, run, value)in Effect code delivers a value to runrunof workflowW.try handle.send(paid, value)does the same through aRunhandle.- The first delivery wins. A later one does not replace it (
flow/docs/guides/wait-for-an-external-signal.md). - An address is not a credential. Anyone who knows the workflow and the run id can rebuild it, so the endpoint that calls
sendauthorizes the caller first. - A parked run decodes with the schema it parked under. Change a signal's schema and you change its name.
Timers
| Call | Meaning | Reference engine |
|---|---|---|
try Experimental.Durable.sleep("7 days") | Park for a duration | Sleep.action.call({ millis }) |
try Experimental.Durable.until(date) | Park until an instant | Sleep.action.call({ until }) |
static readonly deadline = "1 hour" on a workflow | Bound the whole run, across restarts | Flow.make's deadline |
try.race [Step(), Experimental.Durable.sleep("30 seconds")] | Bound one step; the winner is recorded | Node.race |
- A timer writes its absolute wake time before it parks, so a restart does not restart the delay.
- A deadline that has already passed settles the node at once.
- Two sleeps of the same length are two waits.
Experimental.Human
| Call | The person supplies | Result type |
|---|---|---|
Human.confirm(name, prompt, options?) | Yes or no | boolean |
Human.ask(name, prompt, options?) | Prose | string |
Human.select(name, prompt, choices, options?) | One of choices | The union of choices |
Human.json(name, prompt, Schema, options?) | A value the schema accepts | The schema's type |
optionsis{ timeout?, maxAttempts? }.maxAttemptsdefaults to 10, the reference engine'sHumanTask.defaultMaxAttempts.- A refused answer is recorded, and the run parks on the next attempt. Refusing is an answer; it is not a failure of the transport.
- The call fails with
Human.Failed, whosecodeisrequest_invalid,rejectedortimeout. Human.answer(W, run, name, value)records an answer. It reads the current attempt from the engine's waiting row.Human.validate(value, request)checks an answer before it is sent.Human.jsontakes one schema. The reference engine takes two descriptions of the answer, a JSON Schema for the question and an Effect Schema forHumanTask.decode, and "a disagreement surfaces as a defect" (flow/docs/guides/ask-a-person.md). The library derives the first from the second.- An answer approves the workflow's question and nothing else. It grants no file, network or process permission. A permission prompt is the kernel's, in capabilities.
What a wait is in the plan
| Wait | Waiting reason | Wakes on |
|---|---|---|
Durable.sleep, Durable.until | timer, with wakeAt | The clock |
a signal's wait() | event, with the token | send |
Human.* | approval, with the attempt's token | Human.answer |
The reasons are the reference engine's WaitingAnnotation (flow/docs/concepts/suspension-and-replay.md). An operator reads them off a parked run.
What the compiler emits
The compiler recognizes a wait by the declaration its callee resolves to. An alias keeps the meaning, and a local function named sleep gains none.
| In a workflow body | Emitted |
|---|---|
try Experimental.Durable.sleep(d) | Sleep.action.call({ millis }) |
try paid.wait() | WaitFor.action.call({ name: "paid" }), then Node.map with the schema's decoder |
try Experimental.Human.confirm(name, prompt, { timeout }) | HumanTask.action.call({ name, kind: "confirm", prompt, timeoutMs }) |
| In Effect code | Emitted |
|---|---|
paid.send(Checkout, run, v) | DurableDeferred.succeed(gate, { token, value }), with gate = WaitFor.deferred("paid") and token = DurableDeferred.tokenFromExecutionId(gate, { flow: Checkout, executionId: run }) |
Experimental.Human.answer(W, run, name, v) | HumanTask.answer({ token, value }), the token built from HumanTask.deferred(name, attempt) |
The signal value and Human are thin library code over WaitFor, DurableDeferred and HumanTask. The compiler adds Sleep.layer, WaitFor.layer and HumanTask.layer to W.layer for a workflow that uses them, because the reference engine's system actions "push no layer obligation onto callers" and fail at run time when the layer is missing.
Diagnostics
| Code | Slug | When | The message names |
|---|---|---|---|
EK5504 | workflow-try | try sleep(…), timeout(…) or another fiber wait in a workflow body | Experimental.Durable.sleep, or try.race with it |
EK5601 | wait-outside-workflow | A signal's wait(), a Human question or Durable.sleep in Effect code that is not a workflow body | sleep, or moving the wait into a workflow |
Maintainers' decisions
This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.
- A signal carries a typed value into a run. Design · Review.
- Both ends import one value: Design · Review.
Experimental.Durable.signal(name, schema)declares a wait point. Design · Review.- The schema is a durable boundary (VIP-44), and the value crosses in its JSON form. Design · Review.
nameis local to a run. Design · Review.- The address of a wait is the workflow, the run and the name, so two workflows may both use
"paid". Design · Review. try paid.wait()in a workflow body waits for the value. Design · Review.try paid.wait("second")names a second wait point on the same signal in one run. Design · Review.try paid.send(W, run, value)in Effect code delivers a value to runrunof workflowW. Design · Review.try handle.send(paid, value)does the same through aRunhandle. Design · Review.- The first delivery wins. A later one does not replace it (
flow/docs/guides/wait-for-an-external-signal.md). Design · Review. - An address is not a credential. Anyone who knows the workflow and the run id can rebuild it, so the endpoint that calls
sendauthorizes the caller first. Design · Review. - A parked run decodes with the schema it parked under. Design · Review.
- Change a signal's schema and you change its name. Design · Review.
- Call
try Experimental.Durable.sleep("7 days"): Meaning: Park for a duration; Reference engine:Sleep.action.call({ millis }). Design · Review. - Call
try Experimental.Durable.until(date): Meaning: Park until an instant; Reference engine:Sleep.action.call({ until }). Design · Review. - Call
static readonly deadline = "1 hour"on a workflow: Meaning: Bound the whole run, across restarts; Reference engine:Flow.make'sdeadline. Design · Review. - Call
try.race [Step(), Experimental.Durable.sleep("30 seconds")]: Meaning: Bound one step; the winner is recorded; Reference engine:Node.race. Design · Review. - A timer writes its absolute wake time before it parks, so a restart does not restart the delay. Design · Review.
- A deadline that has already passed settles the node at once. Design · Review.
- Two sleeps of the same length are two waits. Design · Review.
- Call
Human.confirm(name, prompt, options?): The person supplies: Yes or no; Result type:boolean. Design · Review. - Call
Human.ask(name, prompt, options?): The person supplies: Prose; Result type:string. Design · Review. - Call
Human.select(name, prompt, choices, options?): The person supplies: One ofchoices; Result type: The union ofchoices. Design · Review. - Call
Human.json(name, prompt, Schema, options?): The person supplies: A value the schema accepts; Result type: The schema's type. Design · Review. optionsis{ timeout?, maxAttempts? }. Design · Review.maxAttemptsdefaults to 10, the reference engine'sHumanTask.defaultMaxAttempts. Design · Review.- A refused answer is recorded, and the run parks on the next attempt. Design · Review.
- Refusing is an answer; it is not a failure of the transport. Design · Review.
- The call fails with
Human.Failed, whosecodeisrequest_invalid,rejectedortimeout. Design · Review. Human.answer(W, run, name, value)records an answer. Design · Review.- It reads the current attempt from the engine's waiting row. Design · Review.
Human.validate(value, request)checks an answer before it is sent. Design · Review.Human.jsontakes one schema. Design · Review.- The reference engine takes two descriptions of the answer, a JSON Schema for the question and an Effect Schema for
HumanTask.decode, and "a disagreement surfaces as a defect" (flow/docs/guides/ask-a-person.md). Design · Review. - The library derives the first from the second. Design · Review.
- An answer approves the workflow's question and nothing else. It grants no file, network or process permission. Design · Review.
- A permission prompt is the kernel's, in capabilities. Design · Review.
- Wait
Durable.sleep,Durable.until: Waiting reason:timer, withwakeAt; Wakes on: The clock. Design · Review. - Wait a signal's
wait(): Waiting reason:event, with the token; Wakes on:send. Design · Review. - Wait
Human.*: Waiting reason:approval, with the attempt's token; Wakes on:Human.answer. Design · Review. - The reasons are the reference engine's
WaitingAnnotation(flow/docs/concepts/suspension-and-replay.md). Design · Review. - An operator reads them off a parked run. Design · Review.
- The compiler recognizes a wait by the declaration its callee resolves to. Design · Review.
- An alias keeps the meaning, and a local function named
sleepgains none. Design · Review. - In a workflow body
try Experimental.Durable.sleep(d): Emitted:Sleep.action.call({ millis }). Design · Review. - In a workflow body
try paid.wait(): Emitted:WaitFor.action.call({ name: "paid" }), thenNode.mapwith the schema's decoder. Design · Review. - In a workflow body
try Experimental.Human.confirm(name, prompt, { timeout }): Emitted:HumanTask.action.call({ name, kind: "confirm", prompt, timeoutMs }). Design · Review. - In Effect code
paid.send(Checkout, run, v): Emitted:DurableDeferred.succeed(gate, { token, value }), withgate = WaitFor.deferred("paid")andtoken = DurableDeferred.tokenFromExecutionId(gate, { flow: Checkout, executionId: run }). Design · Review. - In Effect code
Experimental.Human.answer(W, run, name, v): Emitted:HumanTask.answer({ token, value }), the token built fromHumanTask.deferred(name, attempt). Design · Review. - The signal value and
Humanare thin library code overWaitFor,DurableDeferredandHumanTask. Design · Review. - The compiler adds
Sleep.layer,WaitFor.layerandHumanTask.layertoW.layerfor a workflow that uses them, because the reference engine's system actions "push no layer obligation onto callers" and fail at run time when the layer is missing. Design · Review. - Codes are assigned when this VIP is built. Design · Review.
- Slug
workflow-try: When:try sleep(…),timeout(…)or another fiber wait in a workflow body; The message names:Experimental.Durable.sleep, ortry.racewith it. Design · Review. - Slug
wait-outside-workflow: When: A signal'swait(), aHumanquestion orDurable.sleepin Effect code that is not a workflow body; The message names:sleep, or moving the wait into a workflow. Design · Review.
Adopted review answers
- Keep
Experimental.Xnames under VIP-33. Promotion to a bare module name requires a later decision. Review question 1. - Signals are library values recognized by the compiler; there is no signal keyword. Review decision.
Decisions made while building
The implementation settled these points, which the design above left open or stated in the reference engine's terms. The maintainers decided each one on 2026-11-10. Will has not reviewed them.
- The waits run on Effect's
DurableClockandDurableDeferredunder theExperimental.Durableengine (VIP-60), not on the reference engine'sSleep,WaitForandHumanTaskactions, because that engine is Effect'sWorkflowEngine. A wait needs no layer, so the compiler adds none toW.layer. - Each wait is one recorded step whose start carries its waiting reason.
Experimental.Durable.waiting(run)reads a run's open waits from its journal:{ reason, name, seq, since, wakeAt?, token?, attempt?, request? }. This is the waiting rowHuman.answerreads the attempt from. - A wait point is the optional last argument of both ends:
try paid.wait("second")andtry paid.send(W, run, value, "second"). - A delivery made before the run reaches the wait is kept and returned when it does. The run must exist:
sendto an unknown run is a defect. sendandHuman.answerresume the run after they record, so an engine started after a crash wakes it.Experimental.Durable.sleepanduntiltake{ name }. A named timer's identity does not depend on which concurrent branch reaches it first; an unnamed timer is numbered in the order its run reaches it.Experimental.Durable.untiltakes aDateor epoch milliseconds. A wake time that is not an instant, such asNaN, dies withExperimental.Durable.TimerInvalid.Human.answerfails withHuman.AnswerInvalid, whosecodeisanswer_invalid(the value is not JSON, or is larger than 256 KiB) oranswer_not_open(the run is not parked on that question). These are the reference engine'sHumanAnswerInvalidcodes.Human.answerrecords the value as it is, and the run validates it.Human.validate(value, request)takes{ kind, choices?, schema? }, whereschemais the question's own schema. The JSON Schema derived from it is published for display and validates nothing.Human.Failedcarriescode,question,attempts,rejectionsandmessage.questionis the reference engine'staskfield under the name of the call's first argument.- A race over waits is
Experimental.Durable.race({ name, success, error?, effects }): Effect'sDurableDeferred.raceAllwith a scope of its own, which is whattry.racein a workflow body lowers to. The winner is journaled undername, and task calls and unnamed timers inside the race are numbered within it. A task call or an unnamed timer inside Effect's ownDurableDeferred.raceAllorintodies withExperimental.Durable.UnstableStep, because a recorded race skips its body on a replay and the numbers after it would shift. Human.answercan be sent again after a crash: an equal answer already in the journal is not recorded twice, and the run is woken.- A question's deadline is journaled once, when it is first asked. An answer already recorded wins over a deadline that passed while the run was down.
Compared
The first example for the reference engine 1.x. It type-checks against the reference engine's flow and plan packages at 1.0.0-rc.16.
import { Action, DurableDeferred, Flow, HumanTask, Sleep } from "@smthrs/flow"
import { Node } from "@smthrs/plan"
import { Schema } from "effect"
export const Deploy = Action.make("release/Deploy", {
payload: { build: Schema.String },
success: Schema.String,
tier: "irreversible",
idempotencyKey: ({ build }) => `deploy:${build}`
})
export const Release = Flow.make("release/Release", {
payload: { build: Schema.String },
success: Schema.String,
error: Schema.Union([HumanTask.HumanTaskFailed, Sleep.SleepRequestInvalid]),
body: ({ build }) =>
HumanTask.action.call({ name: "ship", kind: "confirm", prompt: `Ship ${build}?`, timeoutMs: 6 * 60 * 60 * 1000 }).pipe(
Node.branch({
if: (approved) => approved === true,
then: () => Sleep.action.call({ millis: 60_000 }).pipe(Node.andThen(Deploy.call({ build }))),
else: () => Node.succeed("held")
})
)
})
export const approve = (executionId: string, attempt: number) =>
HumanTask.answer({
token: DurableDeferred.tokenFromExecutionId(HumanTask.deferred("ship", attempt), { flow: Release, executionId }),
value: true
})| Program | Tokens (o200k_base) | Lines |
|---|---|---|
| Vibe, proposed | 133 | 18 |
| Reference engine 1.x | 299 | 30 |
The signal example is 97 tokens in 13 lines.
Checked. The reference-engine program type-checks as shown. The three calls, Human.confirm, Durable.sleep and a signal's wait and send, compile under vibelang 0.0.13 in an effect function against a declaration of the proposed module. task and workflow are new. Effect's own DurableClock.sleep({ name: "cooldown", duration: "1 minute" }) compiles today, which is the name clash the Principles section describes.
Principles
- TypeScript-first. No new syntax. Three plain calls and one exported value.
- Effect-second. Bends with durable-tasks-workflows. Effect's
DurableClockandDurableDeferredare in scope and belong to Effect's replay engine. The reference engine has modules with the same names for its own engine. A Vibe program writes neither name. - Optimized for agentic programs. An agent's run stops for a person and costs nothing while it waits.
- Highly forkable. The recognized calls are one table. A fork that wants Temporal's per-workflow signals changes one row.
- Factory-first. The factory's own approvals are
Human.confirmcalls in its workflows. - One meaning per form.
sleepstaysEffect.sleepeverywhere. A durable timer has its own name, and a workflow refuses the fiber one. - Hand-written Effect. Each form lowers to the reference engine's call in the table.
What this changes
- The workflow lowering table gains three rows. The grammar does not change.
vibelang-runtime/experimental/Durableexportssleep,untilandsignal.Experimental.Humanis new.- The proposals page's
sleepandwaitSignal<T>spellings are replaced.waitSignal<T>derived a schema from a type argument at a call, which no TypeScript form does.
Alternatives
- A
signal Paid { amount: number }declaration. It saves about 13 tokens a signal (8 against 20 to declare one, 3 against 4 to wait) and derives a tag. The tag is not needed: a wait's address already holds the workflow and the run. The keyword would also sit on TC39's Signals proposal, which givesSignala different meaning. waitSignal<T>("name"), the earlier design. The sender has no value to import, so nothing ties its payload to the waiter's type.- Let
sleepmean a durable timer inside a workflow. Fewer names, and one form with two behaviors. Refused by principle 6. - A human question as a signal with a prompt.
HumanTaskadds validation, re-asking and a rejection record. It is its own call. - Every approval inside an opaque task. The plan would no longer show where a run can stop.
Follow-up questions
- Waits inside a task body. This VIP allows waits in workflow bodies only. The reference engine offers
DurableClock.sleepandDurableDeferred.awaitto an implementation. Decide with question 3 of durable-tasks-workflows. - Who may answer. The reference engine leaves authorization to the endpoint. Should
Human.answerandsendrequire a capability, such ashuman:answer:<name>? Recommendation: yes, in a later revision. It adds two actions to a closed list in capabilities. - Notifications. The reference engine's notifications package tells a run's launcher, by email or a chat message, that someone is waiting. It is a product surface, and a notification is never the answer. This VIP leaves it out.
Depends on
- durable-tasks-workflows: workflow bodies, the plan,
Run. - std-durable: the engine that parks and wakes a run.
- VIP-44, accepted.