Skip to content

Fix workflow skip propagation, {{output}} in web prompts, and message ordering (#20, #21, #23) - #52

Merged
falbany merged 6 commits into
mainfrom
fix/workflow-issues-20-21-23
Oct 31, 2026
Merged

falbany merged 6 commits into
mainfrom
fix/workflow-issues-20-21-23

Conversation

@falbany

@falbany falbany commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes #20, Fixes #21, Fixes #22, Fixes #23, Fixes #24

#21 — Skip no longer swallows the next step

The skip_next one-shot flag propagated a user's Skip answer to the following step in both engines. Removed in:

  • src/profiles/core/environment/workflow.py (run_workflow): a skip marks only the answered step and continues; the documented last-step rule (skip final step → SKIP_LAUNCH, no OS launch) is unchanged.
  • src/profiles/server/routes/workflow.py: session.skip_next removed entirely; the "Skipped by previous step" record note can no longer occur.

#23 — {{output}} resolves in web ask prompts and notices

_advance_session resolved interactive texts without the captured output while the core engine passes it. session.last_output is now fed into the _resolve_step_texts / _substitute_variables calls of the ask, notice and notify branches, matching headless behavior.

#20 — Message before command in the runner modal

WorkflowRunnerModal.tsx: the generic step detail panel renders MESSAGE (Markdown, for every user) ahead of COMMAND (monospace, for engineers), matching the message-first precedence of the interactive prompt panels. The sidebar step list shows the step's first message line as the primary line when present; the command stays available via the tooltip. The command box is also rendered inside the three interactive (waiting_*) panels — previously it was suppressed there entirely, so a message-only step never revealed which command would run.

#22 — notify + ask is a single interaction

A notify step carrying an ask: guard used to gate the user twice: the composed ask dialog, then the same message again as a blocking "Continue Workflow" notification. Per the canonical rule, the composed ask dialog is the notification display:

  • Core: _execute_step gained ask_displayed (set when the choice was resolved through the 3-way dialog or an ask_callback; an explicit user_choice still shows the message, preserving test-override semantics).
  • Web: _advance_session completes a notify step whose ask was answered instead of pausing again in waiting_notify.

#24 — abort-on-close + session hygiene

  • New POST /api/workflow/{session_id}/abort: marks a still-interactive session aborted ("Aborted by user (modal closed)."), flags the interrupted step record, is idempotent for terminal sessions and 404s on unknown ids.
  • The modal calls it fire-and-forget (errors suppressed) from the Escape handler, the ✕ button, and unmount — only when the session is not terminal.
  • Terminal sessions are purged from the in-memory store after a 1-hour TTL on the next /start, so a long-lived desktop process does not accumulate them.

Docs

  • The "Example with Multiple Guards" scenario tables (en/fr) match the fixed skip behavior.
  • Message Display Rules state the notify+ask single-interaction rule (en/fr).

Tests

… in web prompts (#21, #23)

- Remove the skip_next propagation in both engines: choosing Skip on an
  ask guard now marks only the answered step skipped and advances to the
  next step, which still runs (and asks its own guard). The documented
  last-step rule (skip final step -> SKIP_LAUNCH, no OS launch) is kept.
- Feed session.last_output into the web session runner's ask / notice /
  notify text substitutions so {{output}} resolves like in the native
  engine (it previously resolved to an empty string).
- Clarify the "Example with Multiple Guards" scenario table in both
  hooks guides; strengthen test_workflow_skip_step_over to assert the
  second command actually executes and add web runner regression tests
  for skip-through and {{output}} resolution.
The step detail panel renders MESSAGE (rendered Markdown, aimed at every
user) ahead of COMMAND (monospace, aimed at engineers), matching the
message-first precedence of the interactive prompt panels. The sidebar
step list shows the step's first message line as the primary line when
one exists, keeping the command available via the tooltip. dist/ rebuilt.
The replace completion message was built from the raw step.command, so
it surfaced unsubstituted {{path}}-style tokens to the user. Resolve the
command with the same substitution used for execution before reporting
it. Regression test added; .gitignore regains a lost newline before the
new local demo/ rule (workflow demo launch targets).
While the session waits on the current step (waiting_ask / waiting_notice
/ waiting_notify), the generic detail panel — and with it the Command
box — is suppressed, so a message-only step showed its notice without
ever revealing which command would run. Render the current step's
command box inside the three interactive panels as well, after the
human-readable message to keep the message-first ordering.
…se (#22, #24)

#22 — notify steps with an ask guard no longer gate the user twice:
the composed ask dialog IS the notification display, and answering Yes
completes the step. Core: _execute_step gains ask_displayed (set when the
choice was resolved through the dialog or an ask_callback; an explicit
user_choice still shows the message). Web: _advance_session completes a
notify step whose ask was answered instead of pausing in waiting_notify.

#24 — closing the runner modal mid-workflow no longer strands the
session: new POST /api/workflow/{id}/abort marks it aborted ("Aborted by
user (modal closed)."), failed note on the interrupted step, idempotent
for terminal sessions, 404 on unknown ids. The modal calls it
fire-and-forget from the Escape handler, the close button and unmount.
Terminal sessions are purged from the in-memory store after a 1h TTL on
the next /start.

Docs: message display rules state the single-interaction rule (en/fr).
The actions integration test that asserted the old double-dialog
behavior was updated to the fixed semantics.
The runner modal now aborts its still-interactive session when closed
via Escape, the close button, or unmount (fire-and-forget, errors
suppressed); terminal sessions are left untouched. dist/ rebuilt.
@falbany
falbany merged commit aeb8892 into main Oct 31, 2026
1 check passed
@falbany
falbany deleted the fix/workflow-issues-20-21-23 branch October 31, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment