Skip to content

feat(workflows): add durable human input backend - #2471

Open
JustYannicc wants to merge 7 commits into
UsefulSoftwareCo:v2from
JustYannicc:feat/durable-workflow-input
Open

JustYannicc wants to merge 7 commits into
UsefulSoftwareCo:v2from
JustYannicc:feat/durable-workflow-input

Conversation

@JustYannicc

@JustYannicc JustYannicc commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflows cannot currently pause for a person without losing the continuation when the live invocation ends. This adds a durable form request and wait API so a saved answer resumes the original workflow after a restart.

This PR contains the backend and public author API. The Approvals interface will follow separately.

Review guide

Start with workflow-input.ts and the authoring example, then the SDK input store/lifecycle and the hosted/local handlers. The runtime bridges carry the same typed messages through both native workflow implementations. Review the saved actor and current-access checks alongside the answer/wake transaction.

What changed

step.requestInput commits a question before returning its ticket and review link; step.waitForInput waits durably for an answer, withdrawal or expiry. The first valid response wins. Answers and pending wake receipts commit together, and reconciliation retries undelivered wakes.

Questions and answers are encrypted. Product browser APIs retain the original actor and recheck current app and account access; hosted requests also recheck membership. A form response does not grant permission to a later protected tool. Pending questions support keyset pagination and bounded evidence updates without changing the original form or deadline.

The additive storage migration (4.0.18) preserves existing tables. Protocol 15 adds the workflow messages while protocol 14 remains frozen. The app package advances to 0.0.1-beta.149. The local workerd host also forwards input commands and wakes the waiting run.

apps/marketing now sets exactOptionalPropertyTypes like the root tsconfig.json; without it, the marketing project rejected two unchanged shared apps files once these contracts were added.

Validation

After merging v2 7ba4d515 (bbac3ba8):

  • bun run apps:protocols --write records protocol 15 and confirms protocols 1 through 14 are unchanged.
  • bun run check passes all 19 checks, and bun run typecheck all nine projects.
  • bun run e2e:self-host --test-name 'durable workflow input' --workers 1: all four scenarios pass. They cover restart, concurrent and invalid answers, pagination through inaccessible questions, access and membership revocation, withdrawal, expiry and downstream tool consent.
  • The named local scenario passes. Managed Cloud passes three scenarios; the restart scenario is self-host only.
  • bun run format completed.
workflow-inputs.spec.ts
local-workflow-inputs.spec.ts
app-package.spec.ts

Model: gpt-6.1-sol. Harness: Codex.

Move durable workflow input to protocol 15 and storage migration 4.0.18, after v2 protocol 14 and migration 4.0.17. Preserve v2 event-subscription selection and host retry behavior.

Release-note: Feature: Workflows can request durable input and resume after a person responds.
The Astro strict config left exactOptionalPropertyTypes disabled. Match the root compiler setting so JSON-schema object unions use the same optional-property semantics across projects.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant