Executing action for 2 times if the action gets timed out in st2 v3.1.0

My issue is for examaple if I am using “core.remote” action to connect with end device for running command. In that case if the device is not return any code action will get timedout as it’s status at the case can we rerun that perticular action and is it possible to handle within the workflow. I am using stackstorm version 3.1.0 can handling through the orquesta code
Thanks in advance

You want to use Orquesta retry feature, which is available since st2 v3.2.0
https://docs.stackstorm.com/orquesta/languages/orquesta.html#task-retry-model

Can we handle timeout action within the workflow by rerunning timeout action by calling action with the attribute “do” in st2 v3.1.0.
I am using below code

version: 1.0
vars:
  - ActionReTry: 0
  - MaxActionReTry: 1
tasks:
  task1:
    action: core.local
    input:
      cmd: ping 127.2.14.34
      timeout: 10
    next:
      - when: <% result().return_code=-9 and ctx(ActionReTry)=0%>
        publish: 
          - data2: "Yes"
          - ActioncountStr: "{% set count = ctx('ActionReTry')+1 %}{{count}}"
          - ActionReTry: "{{ ctx('ActioncountStr') | int }}"
        do: 
          - task1
      - when: <% result().return_code=-9 and ctx(ActionReTry) = ctx(MaxActionReTry) %>
        publish:
          - data2: "Reached Max and timedout"
        do: 
          - task3
  task3:
    action: core.echo
    input:
      message: 'stop'

In this case it is not taking task1 to run when the condition satisfied.
the same logic is working if I add a another action before task1 and make the present task1 as task2 it is working for rerunning the action when action get timeout i.e by using attribute “do” I am able to run from task2 but can’t able to run as task1 don’t know why that is happening. May I know why is that behaviour?

@armab can you please let me know why I am unable to execute the above script while running it is giving giving following lines in log file.
can we call the task like this ?

2020-07-07 17:19:34,427 140497650797296 INFO workflows [-] [5f04614db55eb7205f2503a4] Processing request for workflow execution.
2020-07-07 17:19:34,449 140497650797296 INFO workflows [-] [5f04614db55eb7205f2503a4] Requesting conductor to start running workflow execution.
2020-07-07 17:19:34,449 140497650797296 INFO workflows [-] [5f04614db55eb7205f2503a4] Identifying next set (0) of tasks for workflow execution in status "running".
2020-07-07 17:19:34,450 140497650797296 INFO workflows [-] [5f04614db55eb7205f2503a4] No tasks identified to execute next.
2020-07-07 17:19:34,450 140497650797296 INFO workflows [-] [5f04614db55eb7205f2503a4] Updating workflow execution from status "requested" to "running".