Skip to content

Workflow hooks: choosing Skip on an ask guard also skips the NEXT step (core engine + web runner) #21

Closed

Description

@falbany

Summary

When a workflow step carries an ask: guard and the user chooses Skip in the confirmation dialog, the step after the skipped one is skipped as well. Per the documented Choice Behavior, Skip must ignore only the current step and proceed to the next one.

Reproduction

hooks:
  entries:
    "*.mttl":
      - action: run
        command: "prepare.exe {{path}}"
        ask: "Prepare the file?"
      - action: run
        command: "validate.exe {{path}}"
        ask: "Validate before launch?"
      - action: run
        command: "log.exe {{filename}}"
  1. Launch a matching file in the web UI.
  2. On step 1's confirmation choose Skip Step.
  3. Observe step 2.

Actual: step 2 is marked skipped with the note "Skipped by previous step" and validate.exe never runs; the workflow jumps to step 3.

Expected: only step 1 is skipped; step 2 asks its own confirmation ("Validate before launch?") and executes on Yes.

Documented behavior — Confirmation Guards (ask) → Choice Behavior: Skip — Ignores current step — Proceeds to next step.

Root cause

The "user skipped" decision is propagated as a one-shot flag that silently swallows the following step, in both engines:

  • Core engine — src/profiles/core/environment/workflow.py (run_workflow):
    • skip_next = True after a user skip (~line 232)
    • loop-top handler if skip_next: (~lines 194–198) drops the next step
  • Web session runner — src/profiles/server/routes/workflow.py:
    • session.skip_next = True in the waiting_ask / skip branch (~line 434)
    • _advance_session handler if session.skip_next: (~lines 151–156) marks the next record skipped / "Skipped by previous step"

Fix direction

  • Remove the skip propagation in both engines: a skip answer marks only the answered step skipped and advances to the next step normally.
  • Keep the documented last-step rule: skipping the final step ends the workflow without OS launch (SKIP_LAUNCH / "Skipped launch on final step.").
  • Regression tests:
    • core: run_workflow with steps [run+ask, run] and user_choice="skip" must execute the second command. The existing test_workflow_skip_step_over only asserts outcome == CONTINUE, so it passes whether or not the second step runs — strengthen it to assert the second command actually executed.
    • web runner: same scenario through POST /api/workflow/{id}/respond with action: "skip".
  • While touching the docs: the "Example with Multiple Guards" scenario table ("Yes → Skip → Yes: Step 2 skipped…") is confusing and can be clarified to match the fixed behavior.

Activity

  1. added
    bug
    on Oct 29, 2026
  2. added this to the v1.0.0 milestone on Oct 29, 2026
  3. added a commit that references this issue on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions