feat(workflows): allow resume to accept workflow inputs#2815
Conversation
`workflow resume` now accepts `--input key=value` (the same flag and parsing as `workflow run`, via a shared `_parse_input_values` helper). Supplied values are merged over the run's persisted inputs and re-resolved through the existing typed-validation path (`_resolve_inputs`), so a resumed/re-run step sees the updated inputs and ill-typed values fail fast. Keys not supplied keep their persisted values; resuming without `--input` is unchanged. Reference docs updated. Distinct from github#2405 (file-reference inputs at run time): this is about supplying inputs at resume time, reusing the existing input model. Closes github#2812. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
129f698 to
27f1717
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the Spec Kit workflow system to support supplying updated workflow inputs at resume time, reusing the same typed input validation/coercion path as initial runs. This aligns specify workflow resume with specify workflow run by allowing --input key=value overrides to be merged into the persisted run inputs and then persisted back to the run state.
Changes:
- Add
--input/-itospecify workflow resume, sharing parsing logic withworkflow runvia a new_parse_input_values()helper. - Extend
WorkflowEngine.resume(run_id, inputs=None)to merge provided inputs over persisted inputs and re-run_resolve_inputs()for typed coercion/validation, persisting the updated inputs. - Add tests covering resume-time input override/merge/coercion/persistence and CLI invalid-format errors, plus reference doc updates.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/__init__.py |
Adds shared CLI --input parsing helper and wires --input/-i into workflow resume. |
src/specify_cli/workflows/engine.py |
Updates WorkflowEngine.resume() to accept/merge inputs and re-validate/coerce them via existing _resolve_inputs. |
tests/test_workflows.py |
Adds coverage for resume-time input overrides (engine + CLI) including persistence and type validation. |
docs/reference/workflows.md |
Documents workflow resume --input behavior and option table. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
|
@mnriem this one's ready for review. I also audited it against the two issues Copilot raised on the sibling PRs — non-string coercion of an |
Description
Closes #2812.
workflow runaccepts--input key=value, but a paused/failed run could only be resumed with the inputs captured at start time. This letsworkflow resumeaccept the same--inputflag, so a run can continue with information that became available after it paused (or with a corrected value after a failure).What changed
workflow resumegains--input/-i, parsed by a new shared_parse_input_values()helper now used by bothrunandresume(no duplicated parsing).WorkflowEngine.resume(run_id, inputs=None): supplied values are merged over the run's persisted inputs and re-resolved through the existing_resolve_inputstyped-validation path, then persisted. The resumed step (re-run from the pause/failure point) sees the updated inputs.docs/reference/workflows.md).Compatibility
--inputis unchanged; keys not supplied keep their persisted values; ill-typed values fail fast with the same error asrun; undeclared keys are ignored exactly asrundoes today.Testing
uv run specify --helpuv sync --extra test && uv run pytest— 3312 passed, 40 skipped;ruff check src/clean{{ inputs.cmd }}="exit 1" completes afterresume --input cmd="exit 0", withinputs.jsonupdated; invalid--inputformat rejected on bothrunandresumeTests in
tests/test_workflows.py::TestResumeWithInputscover: resume re-runs the step with the new value; resume without input preserves inputs; typed coercion + persistence on resume; invalid type raises; CLI--inputinvalid-format error.AI Disclosure
Used Claude to implement the flag/engine change, tests, and docs. Behaviour was verified locally and the diff reviewed before submission.
Per CONTRIBUTING.md (new CLI arguments should be agreed first), #2812 is the discussion issue and this is the concrete proposal — happy to adjust or hold. It touches
workflow resumelike #2814 does; trivial to rebase whichever lands first. @mnriem a quick steer on whether you want resume-time inputs would be appreciated.