feat(workflow-executor): add guidance step type (PRD-272)#1532
Merged
Scra3 merged 1 commit intofeat/prd-214-setup-workflow-executor-packagefrom Apr 7, 2026
Merged
Conversation
5 new issues
|
df424c2 to
b6697ee
Compare
| * validates it against the step-type schema and merges it into the execution. | ||
| * Returns the (possibly updated) execution, or undefined if none exists. | ||
| */ | ||
| protected async patchAndReloadPendingData<TExec extends WithPendingData>( |
There was a problem hiding this comment.
🟡 Medium executors/base-step-executor.ts:127
patchAndReloadPendingData uses a non-null assertion (!) on patchBodySchemas[execution.type], but patchBodySchemas is a Partial that only includes schemas for specific step types. When the method is called with an execution whose type is not in that set (e.g., condition or read-record), schema becomes undefined and schema.safeParse(pendingData) throws a runtime error. Consider validating that the schema exists and throwing a StepStateError when the step type does not support pending data patches.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file packages/workflow-executor/src/executors/base-step-executor.ts around line 127:
`patchAndReloadPendingData` uses a non-null assertion (`!`) on `patchBodySchemas[execution.type]`, but `patchBodySchemas` is a `Partial` that only includes schemas for specific step types. When the method is called with an execution whose type is not in that set (e.g., `condition` or `read-record`), `schema` becomes `undefined` and `schema.safeParse(pendingData)` throws a runtime error. Consider validating that the schema exists and throwing a `StepStateError` when the step type does not support pending data patches.
Evidence trail:
- packages/workflow-executor/src/executors/base-step-executor.ts lines 127-140 (REVIEWED_COMMIT): `patchAndReloadPendingData` method with `patchBodySchemas[execution.type]!` at line 134
- packages/workflow-executor/src/pending-data-validators.ts lines 5-43 (REVIEWED_COMMIT): `patchBodySchemas` defined as `Partial<Record<StepExecutionData['type'], z.ZodTypeAny>>` with only 5 step types having schemas
- packages/workflow-executor/src/types/step-execution-data.ts lines 140-150 (REVIEWED_COMMIT): `StepExecutionData` union type includes 8 types, 3 of which (`condition`, `read-record`, `record`) have no schema in `patchBodySchemas`
- packages/workflow-executor/src/executors/guidance-step-executor.ts lines 17-20 (REVIEWED_COMMIT): Shows correct pattern with explicit `if (!schema)` check before use
Add a new "guidance" step type for manual user input. The frontend
triggers the executor directly with { pendingData: { userInput } }.
No AI, no polling — the executor saves the input and returns success.
Also refactor pendingData handling: move from Runner into executors.
Each executor manages its own pendingData via incomingPendingData
in the context. The Runner no longer patches or validates pendingData.
- Add StepType.Guidance + GuidanceStepExecutor
- Add incomingPendingData to ExecutionContext
- Add patchAndReloadPendingData helper in BaseStepExecutor
- 4 confirmation-flow executors use patchAndReloadPendingData
- Guidance executor validates and saves input directly
- Runner.patchPendingData removed entirely
- Step summary formatter for AI context in subsequent steps
fixes PRD-272
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b6697ee to
26b9c2f
Compare
1798709
into
feat/prd-214-setup-workflow-executor-package
30 checks passed
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.

Summary
Add a new "guidance" step type for manual user input without AI.
Flow
POST /runs/:runId/triggerwith{ pendingData: { userInput: "..." } }Changes
StepType.Guidance+GuidanceStepDefinitionGuidanceStepExecutor: readsuserInputfrom store, savesexecutionResult, returns successpatchPendingDataauto-creates execution for never-polled steps (scoped to Guidance only){ userInput: z.string().min(1) }Test plan
fixes PRD-272
🤖 Generated with Claude Code
Note
Add guidance step type to workflow executor
GuidanceStepExecutor, a new step type that records user-provideduserInputfromincomingPendingDataand returns a success outcome without any AI calls.Runner.patchPendingDatainto individual executors via a newBaseStepExecutor.patchAndReloadPendingDatamethod, giving each executor control over its own pending data schema.StepExecutorFactoryto constructGuidanceStepExecutorforStepType.Guidanceand passesincomingPendingDatathrough the execution context.formatGuidanceformatter toStepExecutionFormattersso guidance results render a summary line quoting the user input./runs/:runId/triggerendpoint no longer returns 400/404 for invalid or missing pending data; such errors are now handled inside executors and fall through to a 500 if unhandled.Macroscope summarized 26b9c2f.