Repository navigation
Description
Summary
In the web session runner, the {{output}} token is not substituted in an ask: prompt or in a step's non-blocking notice message — it resolves to an empty string even when the previous blocking command step captured output. The same configuration works in the native/headless engine, where {{output}} is documented to work "in message:, command:, ask: — anywhere tokens are accepted" (see Command Output Capture → The {{output}} token).
Reproduction
hooks:
entries:
"*.mttl":
- action: check
command: "probe_env.exe --verify {{dir}}"
on_failure: warn
- action: run
command: "prepare.exe {{path}}"
message: "**Probe result:**\n`{{output}}`"
ask: "Probe returned the result above. Run preparation?"- Launch a matching file in the web UI.
- Step 1 (
check) runs and captures output —session.last_outputholds it. - Step 2 pauses on its ask guard.
Actual: the dialog's message shows an empty probe result, and the ask prompt text contains nothing where {{output}} was.
Expected: both texts carry the captured output of step 1 (as they do with the same config in headless mode).
Root cause
src/profiles/server/routes/workflow.py (_advance_session) resolves the interactive texts without the captured output, while the core engine passes it:
- Ask branch (~lines 161–180):
workflow._resolve_step_texts(...)and_substitute_variables(step.ask, ...)are called withusername/hostnameonly — nolast_output. - Notice branch (~lines 185–200): same for the
waiting_noticemessage. - Core engine, for reference:
_resolve_ask_choice(src/profiles/core/environment/workflow.py:103-139) passeslast_outputinto both_resolve_step_textsand_substitute_variables(output=last_output).
The data is already there — the session maintains session.last_output (updated after every blocking command step, ~line 241) — it is just never fed into these substitutions.
Related (display-only)
StepRecord.command / message are pre-substituted once at /start time (~lines 304–331), when the output is empty by definition; the sidebar and detail panel therefore also show {{output}}-based commands/messages in their unresolved (empty) form. Lower priority than the interactive gates, but the same fix discussion applies if records are ever re-resolved on demand.
Fix direction
- Pass
last_output=session.last_outputinto the_resolve_step_texts/_substitute_variablescalls of the ask and notice branches of the web session runner. - Regression test: a session whose first step captures output, followed by a step with
ask: "…{{output}}…", must surface anask_promptcontaining the captured output after the first response.
Activity
Merge pull request #52 from falbany/fix/workflow-issues-20-21-23