Skip to content

Sub-flow exit does not return to parent flow — session gets stuck #9

Description

@nullhack

Problem

When a sub-flow reaches an exit (e.g. complete, cancelled), the session stays stuck at that exit. The parent flow never advances to its next state.

Reproduction

  1. Define a parent flow with a state that delegates to a sub-flow:
# main-flow.yamlstates:
- id: architectureflow: architecture-flownext:
complete: feature-development # should advance here
  1. The sub-flow has exits defined:
# architecture-flow.yamlexits:
- completestates:
- id: review-signoffnext:
approved: complete
  1. Transition to the exit:
python -m flowr transition approved --session
  1. Session now looks like:
flow: architecture-flowstate: completestack: []
  1. All subsequent commands fail:
$ python -m flowr check --session
error: State 'complete' not found
$ python -m flowr next --session
error: State 'complete' not found

complete is an exit, not a state, so flowr can't resolve it.

Expected Behavior

When a sub-flow transition targets an exit, flowr should:

  1. Resolve the exit against the parent flow's next mapping
  2. Update the session to the parent flow + target state
  3. Pop the call stack

Workaround

Manually edit .flowr/sessions/<name>.yaml to set flow to the parent flow and state to the correct next state.

Environment

  • flowr >= 0.4
  • Python 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions