StackStorm / StackStorm/st2

core.ask not working with join?

Open
#6,213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Does core.ask work with join?

STACKSTORM VERSION

Paste the output of st2 --version:
st2 3.8.1, on Python 3.8.10

OS, environment, install method

VM Ubuntu 20.04

Steps to reproduce the problem

version: 1.0

description: Test approval.

vars:
  - count_approve: 0
  - count_reject: 0

tasks:
  start:
    action: core.echo message="Approval started."
    next:
      - when: <% succeeded() %>
        do:
          - ask_1
          - ask_2
          - ask_3

  ask_1:
    action: core.ask
    input:
      users:
        - cab_user1
      ttl: 10
      route: "cab_user1"
      schema:
        type: object
        properties:
          approved:
            type: boolean
            description: "Apply?"
            required: True
    next:
      - when: <% succeeded() %>
        publish:
          - count_approve: "{{ count_approve + 1 }}"
        do:
          - finish
      - when: <% failed() %>
        do: stop

  ask_2:
    action: core.ask
    input:
      users:
        - cab_user1
      ttl: 10
      route: "cab_user1"
      schema:
        type: object
        properties:
          approved:
            type: boolean
            description: "Apply?"
            required: True
    next:
      - when: <% succeeded() %> or <% ctx().count_approve %> = 
        do: finish
      - when: <% failed() %>
        do: stop

  ask_3:
    action: core.ask

    input:
      users:
        - cab_user1
      ttl: 10
      route: "cab_user1"
      schema:
        type: object
        properties:
          approved:
            type: boolean
            description: "Apply?"
            required: True
    next:
      - when: <% succeeded() %>
        do: finish
      - when: <% failed() %>
        do: stop

  finish:
    join: 2
    action: core.echo message="Approved! (<% ctx().count_approve %>)"

  stop:
    join: 2
    action: core.echo message="Rejected!"
    next:
      - do: fail

Expected Results

If 2 core.ask tasks are applied/rejected the others should be ignored.

Actual Results

Only if TTL is reached or all inquiries are answered the workflow will continue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied workflow with three core.ask tasks and a join threshold of 2, then trace the core.ask and join execution paths. The fix is complete when two responses allow the workflow to continue while the remaining inquiry is ignored, matching the expected finish or stop behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.