Skip to content

Add durable waiting steps for external workflow input - #163

Merged
softmarshmallow merged 1 commit into
mainfrom
chore/fx-waiting-steps
Nov 21, 2026
Merged

softmarshmallow merged 1 commit into
mainfrom
chore/fx-waiting-steps

Conversation

@softmarshmallow

Copy link
Copy Markdown
Member

User problem

Asset workflows need to wait for an external value before dependent steps can run. Today a project has to invent its own way to pass a build value, approve a step, or choose among generated images. The workflow should record which value it used and keep that decision when the runner exits.

Closes #62.

Resulting behavior

  • fx/await@1 uses with.schema to declare the required JSON value. A request can include a message and artifacts for human review. The workflow receives the value through outputs.answer. A keyed candidate mapping also exposes the original value through outputs.selected.

  • The CLI, both SDKs, and the local viewer use the same request IDs, validation, and recorded receipts. The first valid submission wins. Retrying it returns the original receipt.

  • A parked run exits incomplete and can resume after submission. --wait-for-answers keeps a runner attached. An optional deadline can fail the step or let the workflow run its own fallback.

  • Awaiting cards offer a Review action that opens the form on the right. They show a countdown when a deadline exists and a semantic outcome after resolution.

  • Added an Unreleased entry to CHANGELOG.md.

Affected scenarios

  • A build script supplies a promptless revision through the SDK while a person chooses one of three generated images. The same run delivers the image and a manifest pairing its digest with the revision.
  • A person and an external agent submit different choices through the viewer and CLI. The second client gets the recorded winner. A schema or candidate validation error leaves the request open.
  • Several steps can wait in the same run. Repeated steps honor their configured concurrency, and independent work can continue. Expiry can fail a review or release an authored fallback. Resuming a parked run preserves its deadline and recorded decisions.

Before and after

Run both transcripts from fresh copies of fixtures/waiting/ with Grida installed. The first uses the released 0.11.0 engine. The second uses this branch's build through the same grida fx launcher. Invocation IDs are elided below.

A. Before

$ grida fx run workflow.yaml --run out --no-view --max-usd 0
review-variants  ·  1 phase
phase 1   3 steps   0 provider calls   $0.00
cached    0 of 2 known steps
estimate  $0.00   ceiling $0.00
refused   revision: no built-in node type fx/await@1; see grida-fx nodes
refused   choose: no built-in node type fx/await@1; see grida-fx nodes
$ echo $?
1
$ grida fx inspect ./out --requests --json
error: unexpected argument '--requests' found

  tip: to pass '--requests' as a value, use '-- --requests'

Usage: grida fx inspect <RUN>

For more information, try '--help'.
$ grida fx respond ./out REQUEST_ID --json '{"variant":"b"}'
error: unrecognized subcommand 'respond'

  tip: a similar subcommand exists: 'expand'

Usage: grida fx <COMMAND>

For more information, try '--help'.

B. After

$ grida fx run workflow.yaml --run out --no-view --max-usd 0
review-variants  ·  1 phase
phase 1   6 steps   0 provider calls   $0.00
cached    0 of 2 known steps
estimate  $0.00   ceiling $0.00
run       out
invocation [id]
control   available
result    incomplete   booked $0.00
stopped   awaiting external answers for revision#1, choose#1
requests  grida fx inspect out --requests --json
$ echo $?
1
$ grida fx inspect ./out --requests --json | jq -r '.requests[] | [.step, .state.status] | @tsv'
revision#1	pending
choose#1	pending
$ python - <<'PY'
from grida import fx

run = "./out"
revision = next(r for r in fx.list_requests(run) if r["step"] == "revision#1")
print("message" in revision, revision["schema"])
receipt = fx.respond(run, revision["id"], "rev-42")
print(receipt["state"]["status"], receipt["state"]["answer"])
PY
False {'type': 'string'}
answered rev-42
$ REQUEST_ID=$(grida fx inspect ./out --requests --json | jq -r '.requests[] | select(.step == "choose#1") | .id')
$ grida fx respond ./out "$REQUEST_ID" --json '{"variant":"missing"}' | jq -r '.code'
invalid_answer
$ grida fx respond ./out "$REQUEST_ID" --json '{"variant":"b"}' | jq -c '.request.state.answer'
{"variant":"b"}
$ grida fx respond ./out "$REQUEST_ID" --json '{"variant":"c"}' | jq -c '{code, winner: .request.state.answer}'
{"code":"answer_conflict","winner":{"variant":"b"}}
$ grida fx run workflow.yaml --run out --no-view --max-usd 0
review-variants  ·  1 phase
phase 1   6 steps   0 provider calls   $0.00
cached    1 of 2 known steps
estimate  $0.00   ceiling $0.00
run       out
invocation [id]
control   available
result    ok   booked $0.00
$ jq -cS . out/outputs/manifest.json
{"image_digest":"a46d45edad6873423148f76a3d7b85d9e114a9d1389507d381d82c6a64f82a92","revision":"rev-42"}

Demo and evidence

The recording shows the same run through the viewer. The SDK supplies the revision, Review opens three image candidates, and submitting B changes the card to Selected. The review receipt shows the image and original submission channel. The paper finish screenshot shows a schema enum rendered as a picker.

  • Included provider-free browser evidence.

How to test

  1. Copy fixtures/waiting/ to a fresh project with the checkout engine and Grida Python SDK installed.
  2. Run grida fx start --background and grida fx run workflow.yaml --name review --wait-for-answers --max-usd 0 --open.
  3. Supply rev-42 through the Python SDK using review-variants/review as the run selector. Open Review on the choose card, select B, and submit.
  4. Check that the run succeeds and that outputs/manifest.json contains the supplied revision and the digest of outputs/image.png. The fixture README also explains how to exercise the form showcase and timeout paths.

Verified with the Rust workspace suite, 1,738 Python tests, 569 JavaScript SDK tests, 309 viewer unit tests, all five waiting-step Chromium scenarios, and all 70 CLI conformance cases. The combined CLI and Python SDK journey also verifies a missing file inside a selected object.

Caveats

V1 uses the local viewer and requires no sign-in. A detached submission records the input immediately. Workflow execution continues on explicit resume. Each request can select one candidate, either as the whole value or by key in one top-level object field.

fx62-pr-review.mp4

Choose an image in the waiting-step review

Receipt for the recorded image selection

Paper finish picker from a schema enum

@vercel

vercel Bot commented Nov 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fx Ready Ready Preview Nov 21, 2026 7:31pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 124 files, which is 24 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

CodeRabbit couldn't verify your organization's usage billing state, so no usage-priced review was started. Retry after the billing service recovers.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 83d004cc-70f1-4497-9554-60464d6e630f
Commits

Reviewing files that changed from the base of the PR and between e295da7 and b5ff090.

Files ignored due to path filters: 1

  • web/viewer/public/favicon-awaiting.svg is excluded by !**/*.svg
Files selected for processing: 124

  • .github/workflows/ci.yml
  • AGENT_READINESS.md
  • CHANGELOG.md
  • crates/grida-fx-core/src/builtins/catalog.json
  • crates/grida-fx-core/src/builtins/mod.rs
  • crates/grida-fx-core/src/builtins/waiting.rs
  • crates/grida-fx-core/src/expand/node.rs
  • crates/grida-fx-core/src/plan/mod.rs
  • crates/grida-fx-core/src/registry.rs
  • crates/grida-fx-core/src/spec.rs
  • crates/grida-fx-core/tests/expand_semantics.rs
  • crates/grida-fx-core/tests/planning.rs
  • crates/grida-fx-core/tests/routes_spec.rs
  • crates/grida-fx-runtime/src/control.rs
  • crates/grida-fx-runtime/src/events.rs
  • crates/grida-fx-runtime/src/executor/mod.rs
  • crates/grida-fx-runtime/src/folder.rs
  • crates/grida-fx-runtime/src/lib.rs
  • crates/grida-fx-runtime/src/runner/awaiting.rs
  • crates/grida-fx-runtime/src/runner/mod.rs
  • crates/grida-fx-runtime/src/runner/replay.rs
  • crates/grida-fx-runtime/src/runner/schedule.rs
  • crates/grida-fx-runtime/src/waiting.rs
  • crates/grida-fx-runtime/tests/events.rs
  • crates/grida-fx-runtime/tests/runner.rs
  • crates/grida-fx-viewer/src/export.rs
  • crates/grida-fx-viewer/src/export/tests.rs
  • crates/grida-fx-viewer/src/lib.rs
  • crates/grida-fx-viewer/src/read.rs
  • crates/grida-fx-viewer/src/service.rs
  • crates/grida-fx-viewer/src/tests.rs
  • crates/grida-fx-viewer/src/waiting.rs
  • crates/grida-fx/src/args.rs
  • crates/grida-fx/src/cli.rs
  • crates/grida-fx/src/verbs/cache.rs
  • crates/grida-fx/src/verbs/control.rs
  • crates/grida-fx/src/verbs/inspect.rs
  • crates/grida-fx/src/verbs/mod.rs
  • crates/grida-fx/src/verbs/project.rs
  • crates/grida-fx/src/verbs/run.rs
  • crates/grida-fx/src/verbs/run_set.rs
  • crates/grida-fx/src/verbs/runs.rs
  • crates/grida-fx/src/verbs/service.rs
  • crates/grida-fx/src/verbs/waiting.rs
  • crates/grida-fx/tests/cli.rs
  • crates/grida-fx/tests/runs.rs
  • docs/guide/02-workflow-file.md
  • docs/guide/05-running.md
  • docs/guide/07-viewing.md
  • docs/guide/README.md
  • fixtures/waiting/README.md
  • fixtures/waiting/fx.yaml
  • fixtures/waiting/nodes.py
  • fixtures/waiting/showcase.yaml
  • fixtures/waiting/workflow.yaml
  • js/fx/README.md
  • js/fx/src/api.ts
  • js/fx/src/control.ts
  • js/fx/src/documents.ts
  • js/fx/src/engine.ts
  • js/fx/src/index.ts
  • js/fx/src/request.ts
  • js/fx/src/runs.ts
  • js/fx/src/waiting.ts
  • js/fx/test/control.test.ts
  • js/fx/test/waiting.test.ts
  • llms.txt
  • package.json
  • python/README.md
  • python/src/grida/fx/__init__.py
  • python/src/grida/fx/_api.py
  • python/src/grida/fx/_control.py
  • python/src/grida/fx/_runs.py
  • python/src/grida/fx/_waiting.py
  • python/tests/test_api.py
  • python/tests/test_import.py
  • spec/README.md
  • spec/control.md
  • spec/exports.md
  • spec/identity.md
  • spec/observation.md
  • spec/protocol.md
  • spec/schemas/fx-await-request-v1.schema.json
  • spec/schemas/fx-graph-v1.schema.json
  • spec/schemas/fx-graph-v2.schema.json
  • spec/schemas/fx-run-control-v1.schema.json
  • spec/schemas/fx-run-events-v1.schema.json
  • spec/schemas/fx-run-export-v1.schema.json
  • spec/schemas/fx-run-list-v1.schema.json
  • spec/schemas/fx-run-removal-v1.schema.json
  • spec/schemas/fx-viewer-run-v1.schema.json
  • spec/sdk.md
  • spec/service.md
  • spec/store.md
  • spec/viewer.md
  • spec/waiting.md
  • tools/check_viewer_browser.mjs
  • tools/check_waiting.py
  • tools/check_waiting_browser.mjs
  • web/fx-react/src/canvas.tsx
  • web/fx-react/src/index.tsx
  • web/fx-web/src/answer-draft.ts
  • web/fx-web/src/canvas.css
  • web/fx-web/src/canvas.ts
  • web/fx-web/src/card.ts
  • web/fx-web/src/deck.ts
  • web/fx-web/src/graph.ts
  • web/fx-web/src/index.ts
  • web/fx-web/src/layout.ts
  • web/fx-web/src/port-values.ts
  • web/fx-web/src/ports.ts
  • web/fx-web/src/scope-state.ts
  • web/fx-web/src/service.ts
  • web/fx-web/src/waiting.ts
  • web/fx-web/tests/canvas.test.ts
  • web/fx-web/tests/ports.test.ts
  • web/fx-web/tests/state-icon.test.ts
  • web/fx-web/tests/waiting.test.ts
  • web/viewer/src/main.tsx
  • web/viewer/src/run-favicon.ts
  • web/viewer/src/style.css
  • web/viewer/src/waiting-answer-fields.tsx
  • web/viewer/src/waiting-answer-summary.tsx
  • web/viewer/src/waiting-reviews.tsx

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@softmarshmallow
softmarshmallow merged commit f92e703 into main Nov 21, 2026
14 checks passed

This branch was successfully deployed

1 active deployment
Preview — b5ff0909 Deployed Nov 21, 2026 by vercel[bot]
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.

Waiting steps for durable external input

1 participant