Skip to content

feat(workflows): allow resume to accept workflow inputs#2815

Open
doquanghuy wants to merge 1 commit into
github:mainfrom
doquanghuy:feat/2812-resume-inputs
Open

feat(workflows): allow resume to accept workflow inputs#2815
doquanghuy wants to merge 1 commit into
github:mainfrom
doquanghuy:feat/2812-resume-inputs

Conversation

@doquanghuy
Copy link
Copy Markdown
Contributor

@doquanghuy doquanghuy commented Jun 2, 2026

Description

Closes #2812.

workflow run accepts --input key=value, but a paused/failed run could only be resumed with the inputs captured at start time. This lets workflow resume accept the same --input flag, so a run can continue with information that became available after it paused (or with a corrected value after a failure).

specify workflow run wf.yml          # pauses/fails needing a value
specify workflow resume <run_id> --input cmd="exit 0"   # resumes with it

What changed

  • workflow resume gains --input/-i, parsed by a new shared _parse_input_values() helper now used by both run and resume (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_inputs typed-validation path, then persisted. The resumed step (re-run from the pause/failure point) sees the updated inputs.
  • Reference docs updated (docs/reference/workflows.md).

Compatibility

Testing

  • Tested locally with uv run specify --help
  • uv sync --extra test && uv run pytest — 3312 passed, 40 skipped; ruff check src/ clean
  • Manually verified: a run that fails on {{ inputs.cmd }}="exit 1" completes after resume --input cmd="exit 0", with inputs.json updated; invalid --input format rejected on both run and resume

Tests in tests/test_workflows.py::TestResumeWithInputs cover: resume re-runs the step with the new value; resume without input preserves inputs; typed coercion + persistence on resume; invalid type raises; CLI --input invalid-format error.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

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 resume like #2814 does; trivial to rebase whichever lands first. @mnriem a quick steer on whether you want resume-time inputs would be appreciated.

@doquanghuy doquanghuy requested a review from mnriem as a code owner June 2, 2026 10:44
`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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/-i to specify workflow resume, sharing parsing logic with workflow run via 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

@doquanghuy
Copy link
Copy Markdown
Contributor Author

@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 evaluate_expression result (#2810) and a doc example not matching real CLI output (#2814). Neither applies here: this PR doesn't evaluate any templates, and the docs show only a command invocation (no sample output), so no changes were needed.

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.

[Feature]: Allow workflow resume to accept updated workflow inputs

3 participants