feat(client): resume + getScreen on the automation SDK surface (#3528)#3552
Merged
Conversation
A `type: 'screen'` flow suspends at its `screen` node — `execute()` returns
`{ status: 'paused', runId, screen }` and the run waits for input. The
dispatcher has served the other half of that contract since ADR-0019
(`POST /automation/:flow/runs/:runId/resume`, `GET .../screen`), but the client
SDK's automation surface stopped at getFlow / execute / listRuns / getRun. Any
consumer built on the SDK could therefore start a screen flow and never finish
it: the run stayed suspended and the only way out was hand-rolling the HTTP
call. That is what dead-ended the Console's developer "Flow Runs" test runner,
where every test run of a screen flow orphaned a `paused` row.
- `automation.resume(flowName, runId, signal?)` posts the collected screen
values as `inputs`, plus the approval-style `output` / `branchLabel` the
dispatcher already accepts, and returns either the next paused screen of a
multi-step wizard or the terminal AutomationResult.
- `automation.getScreen(flowName, runId)` returns the screen a paused run is
waiting on, so a client that did not launch the run (a reload, another tab,
an inbox) can render the pending step before resuming.
- Both land on the environment-scoped client as well as the unscoped one.
The two dispatcher routes had no test coverage at all; they now cover the
`inputs` / `variables` aliasing, approval-style output + branchLabel, the
pause-again envelope, the 501 when the service cannot resume, and the ordering
guard that keeps `/runs/:runId/screen` from being swallowed by the run lookup.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LX9ut3MK3KykE11S9bJmv5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 26 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…uide (#3528) The SDK page's automation example stopped at `trigger()`, which is exactly the gap the issue reports: a reader had no way to learn that `execute()` on a screen flow returns a paused run, or how to finish it. Adds the execute → paused → resume round-trip and `getScreen()` for a client that did not launch the run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LX9ut3MK3KykE11S9bJmv5
os-zhuang
marked this pull request as ready for review
July 27, 2026 04:51
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.
Closes the SDK half of #3528. The Console half is objectui#(companion PR on the same branch name).
What was actually wrong
The issue reports that Submit on a screen-flow step never calls the resume endpoint. I reproduced the whole path against a real server with the published
@objectstack/console16.1.0 build (dropped intopackages/console/dist,.objectui-sha cf2d56e), driving it in Chromium:showcase_bulk_reassign→ flat-field screen)record_section)crm_convert_lead_wizard(twoobject-formsteps, the lead-conversion shape)So the resume call does exist on the record/list surfaces, but the reporter's diagnosis — "
@objectstack/client's automation surface exposes getFlow, execute, listRuns, getRun but no resume … the SDK the Console builds on has no way to express the call" — is correct, and it is exactly what dead-ends the fourth row. Every test run of a screen flow there leaves apausedrow behind with no way to finish it.This PR
automation.resume(flowName, runId, signal?)— posts the collected screen values asinputs(applied as bare flow variables), plus the approval-styleoutput/branchLabelthe dispatcher already accepts. Returns the next{ status: 'paused', screen }of a multi-step wizard, or the terminalAutomationResult.automation.getScreen(flowName, runId)— the screen a paused run is waiting on, so a client that did not launch the run (a reload, another tab, an inbox) can render the pending step before resuming.client.project(id).automation.*) as well as the unscoped one.POST /:name/runs/:runId/resumeandGET /:name/runs/:runId/screenhad zero coverage. Now covered:inputs/variablesaliasing,output+branchLabel, the empty-signal body, the pause-again envelope, the 501 when the service cannot resume, the 404 when no screen is pending, and the ordering guard that keeps/runs/:runId/screenfrom being swallowed by the/runs/:runIdrun lookup.No route or engine changes — the server side of ADR-0019 already worked, confirmed by hand over HTTP before touching anything.
Test plan
pnpm --filter @objectstack/client test— 116 passed (11 new automation assertions incl. the scoped client's first automation tests).pnpm --filter @objectstack/runtime exec vitest run src/http-dispatcher.test.ts— 193 passed (9 new).examples/app-showcaseon a live dev server: trigger →status: paused→ resume →success: true, record updated.Not in this PR
Two adjacent gaps found while tracing every UI path that can dispatch a
type: 'flow'action — both are launch-side, not resume-side, and want their own change:DashboardRendererheader actions only branch onurl/modal/script; atype: 'flow'header action falls through toconsole.warn("Unknown header actionType")and never dispatches. It also has noActionProviderin its subtree, so even routed it would report "Flow handler not registered".<ActionProvider>(ConsoleShell) is mounted with nohandlersmap, so anyaction:buttonoutside ObjectView / RecordDetailView / PageView / DeclaredActionsBar binds to a runner with no flow handler.🤖 Generated with Claude Code
https://claude.ai/code/session_01LX9ut3MK3KykE11S9bJmv5
Generated by Claude Code