feat: bind gate verdict to workflow input via verdict_input#3725
Open
markuswondrak wants to merge 4 commits into
Open
feat: bind gate verdict to workflow input via verdict_input#3725markuswondrak wants to merge 4 commits into
markuswondrak wants to merge 4 commits into
Conversation
Add an optional `verdict_input` field to gate steps that lets an external system supply a verdict through a declared workflow input instead of an interactive TTY prompt. When the referenced input carries a non-empty string value that matches one of the gate's `options` (case-insensitive), the gate auto-decides, records the matched spelling in `output.choice`, and applies the existing `on_reject` / abort / skip / retry semantics. If the value is present but does not match an option, or is a non-string, the gate fails immediately with a clear error message. When the input is absent, null, or empty, the gate falls back to today's TTY-prompt-or-pause behaviour unchanged. The engine now persists `result.error` alongside each step's status and output so that failed-step error messages survive across runs. The CLI (`workflow run` and `workflow resume`) surfaces these persisted errors after a failed or aborted run. `validate_workflow` cross-references `verdict_input` against the workflow's declared inputs block and reports an error for undeclared names, consistent with the existing `wait_for` id cross-check. Closes discussion: github#3717 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Assisted-by: GitHub Copilot (model: claude-sonnet-4.6, autonomous)
Contributor
There was a problem hiding this comment.
Pull request overview
Adds workflow-input-driven gate verdicts for non-interactive approval flows.
Changes:
- Resolves gate verdicts from declared workflow inputs.
- Validates bindings, persists step errors, and surfaces errors in human CLI output.
- Adds documentation and comprehensive tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/workflows/steps/gate/__init__.py |
Implements verdict input resolution and retry consumption. |
src/specify_cli/workflows/engine.py |
Validates bindings and persists step errors. |
src/specify_cli/workflows/_commands.py |
Displays persisted errors in human output. |
docs/reference/workflows.md |
Documents gate verdict inputs. |
tests/test_workflows.py |
Covers resolution, validation, persistence, retry, and CLI behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mnriem
requested changes
Jul 24, 2026
mnriem
left a comment
Collaborator
There was a problem hiding this comment.
Please address Copilot feedback
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/specify_cli/workflows/_commands.py:907
- The
--jsonbranches return_workflow_run_payload(state)before this helper is called, so the external systems this feature targets receive onlystatus: "failed"for an invalid verdict and lose the promised explanatory error. Include_failed_step_error(state)in the shared run/resume payload (and cover both JSON commands) so machine-readable runs surface the persisted error too.
return str(sd["error"])
Include persisted step errors in _workflow_run_payload so workflow run/resume/status --json all surface failure reasons consistently. Add JSON-path tests for failed and successful runs. Assisted-by: GitHub Copilot (model: gpt-5.3-codex, autonomous) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
Adds an optional
verdict_inputfield to gate steps, letting an external system supply a verdict through a declared workflow input instead of requiring an interactive TTY prompt. This enables non-interactive approval flows (web UIs, Slack, APIs) without a gate-specific CLI flag or a parallelswitchworkaround.Closes / implements the approach proposed in discussion #3717.
What changed
GateStep(steps/gate/__init__.py)verdict_input: names a declared workflow input that may carry the gate's verdict.optionsentry (case-insensitive), the gate auto-decides and records the canonical spelling inoutput.choice. A present-but-non-matching value fails immediately with a clear error. An absent/empty value falls back to today's TTY-prompt-or-pause behaviour unchanged.on_reject: retryinteraction: a bound reject verdict is consumed (the stored input is reset to"") before the gate pauses, so the next resume prompts or pauses again unless another verdict is supplied.GateStep.validate()) rejects a non-string or emptyverdict_inputvalue.Engine (
engine.py)validate_workflownow threads the set of declared input names through_validate_stepsand reports an error when a gate'sverdict_inputreferences an undeclared input (mirrors the existingwait_forid cross-check).WorkflowEnginepersistsresult.errorin each step's state record so failed-step error messages survive across runs.CLI (
_commands.py)workflow runandworkflow resumesurface the first persisted step error after a failed or aborted run via a new_failed_step_errorhelper.Docs (
docs/reference/workflows.md)on_reject: retryreset behaviour.Usage
Manual test results
Agent: GitHub Copilot CLI (claude-sonnet-4.6) | OS/Shell: Linux/bash
specify workflow runspecify workflow resume--inputis consumed and gate applieson_rejectsemanticsspecify workflow validateverdict_inputreference is reported as a validation errorAI disclosure
This PR was written by GitHub Copilot CLI (model: claude-sonnet-4.6) and human-reviewed.