Skip to content

Workflow hooks: {{output}} token resolves to empty in web ask prompts and notices (web session runner) #23

Closed

Description

@falbany

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?"
  1. Launch a matching file in the web UI.
  2. Step 1 (check) runs and captures output — session.last_output holds it.
  3. 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 with username/hostname only — no last_output.
  • Notice branch (~lines 185–200): same for the waiting_notice message.
  • Core engine, for reference: _resolve_ask_choice (src/profiles/core/environment/workflow.py:103-139) passes last_output into both _resolve_step_texts and _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_output into the _resolve_step_texts / _substitute_variables calls 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 an ask_prompt containing the captured output after the first response.

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