Skip to main content
← Back to list
01Issue
BugClosedSwamp Club
AssigneesNone

workflow run does not evaluate expressions or pass task.inputs without --last-evaluated

Opened by swampadmin · 1/8/2025

Description

swamp workflow run does not resolve ${{ inputs.* }} expressions at runtime. Expressions in modelIdOrName and task.inputs are passed as literal strings (e.g. the model runner receives the string ${{ inputs.deviceModel }} instead of the resolved model name).

Additionally, when using the evaluaterun --last-evaluated workaround, task.inputs that were resolved and baked into the evaluated YAML are silently dropped — model methods receive undefined for all input fields.

Steps to Reproduce

Bug A: workflow run doesn't evaluate expressions

  1. Create a workflow with parameterized model name:
    inputs:
      properties:
        deviceModel:
          type: string
      required: [deviceModel]
    jobs:
      - name: main
        steps:
          - name: list
            task:
              type: model_method
              modelIdOrName: ${{ inputs.deviceModel }}
              methodName: list
  2. Run: swamp workflow run <name> --input '{"deviceModel":"my-devices"}' --json
  3. Step fails with: Model not found: ${{ inputs.deviceModel }}

Bug B: --last-evaluated drops task.inputs

  1. Create a workflow with parameterized task inputs:
    inputs:
      properties:
        deviceModel:
          type: string
        deviceId:
          type: string
      required: [deviceModel, deviceId]
    jobs:
      - name: main
        steps:
          - name: authorize
            task:
              type: model_method
              modelIdOrName: ${{ inputs.deviceModel }}
              methodName: authorize
              inputs:
                deviceId: ${{ inputs.deviceId }}
                authorized: false
  2. Evaluate: swamp workflow evaluate <name> --input '{"deviceModel":"my-devices","deviceId":"test-123"}' --json
    • Evaluated YAML correctly shows modelIdOrName: my-devices and deviceId: test-123
  3. Run: swamp workflow run <name> --last-evaluated --json
  4. Model IS found (Bug A workaround works), but method fails with: Method arguments validation failed: Invalid input: expected string, received undefined at "deviceId"
  5. Even passing --input alongside --last-evaluated doesn't help

Proof that it's not an auth/config issue

  • swamp workflow run succeeds for workflows where methods take NO inputs (e.g. settings.get, dns.getNameservers)
  • swamp model method run my-devices list --json works perfectly via direct method calls
  • swamp workflow evaluate resolves all expressions correctly

Expected Behavior

  • workflow run should evaluate ${{ inputs.* }} expressions at runtime (like workflow evaluate does), OR
  • workflow run --last-evaluated should pass the resolved task.inputs from the evaluated YAML to model methods

Actual Behavior

  • Without --last-evaluated: expressions are passed as literal strings
  • With --last-evaluated: model is found but task.inputs are silently dropped

Environment

  • swamp version: 20260227.225234.0-sha.2b2b28be
  • OS: macOS Darwin 22.6.0

Summary

This affects the workflow execution service's expression resolution and input forwarding. The workflow evaluate command correctly resolves all expressions, but workflow run does not perform this resolution at runtime. When using the --last-evaluated path, the runner reads the evaluated workflow YAML for modelIdOrName but ignores the task.inputs section, so model methods receive undefined arguments. The fix would involve either: (a) adding expression evaluation to the workflow run path, or (b) ensuring --last-evaluated reads and forwards task.inputs from the evaluated YAML to model method calls.

02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED

Closed

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.