Skip to content

flow_run fails an agent step that targets the session running it, instead of waiting until the step times out (1.7.1) - #63

Merged
pallaoro merged 1 commit into
mainfrom
flow-run-refuses-step-in-own-session
Nov 4, 2026
Merged

pallaoro merged 1 commit into
mainfrom
flow-run-refuses-step-in-own-session

Conversation

@pallaoro

@pallaoro pallaoro commented Nov 4, 2026

Copy link
Copy Markdown
Member

Why

flow_run keeps the calling session's turn busy until the flow ends. An agent step that targets that same session (for example a step that replies in the chat the flow was started from) queues its turn behind the running one, so it can never start. The run sat there until the step's timeout and then failed with only "timed out after N ms".

What changes

  • flow_run is registered as a tool factory, so it receives the calling session (sessionKey, sessionId) from the tool context and hands it to the runner.
  • The runner fails an agent step that targets that session at once, with a message saying why and how to test the flow instead (fire its real trigger while the session is idle, or point the step at another session).
  • Keys are compared the way OpenClaw canonicalises them: lower-cased, and a key without the agent: prefix is scoped by the step's agent. A step that names only an agent runs in that agent's default session, which is not resolved here, so it is not caught.
  • Runs started any other way (triggers, the flow server) are unaffected.
  • SKILL.md: one line telling agents not to flow_run such a flow from the session it targets.
  • Version 1.7.1.

Checks

  • npm test: 250 of 250 pass, 3 of them new (the refusal, the unaffected paths, key matching). The tests stub the openclaw CLI; the guard was not run against a live gateway.
  • tsc --noEmit and npm run build are clean.

…tead of waiting until the step times out (1.7.1)

flow_run keeps the calling session's turn busy until the flow ends. An
agent step that targets that same session queues its turn behind it, so
the step could never start, and both waited until the step's timeout.

- flow_run is registered as a tool factory, so it gets the calling
  session (sessionKey, sessionId) from the tool context and hands it to
  the runner.
- The runner fails such a step at once, with a message saying why and how
  to test the flow instead. Keys are compared the way OpenClaw
  canonicalises them: lower-cased, and a key without the agent: prefix is
  scoped by the step's agent. A step that names only an agent is not
  caught.
- Runs started any other way (triggers, the flow server) are unaffected.
- SKILL.md: do not flow_run such a flow from the session it targets.
- Tests: the refusal, the unaffected paths, and key matching.
@pallaoro
pallaoro merged commit c4f3c41 into main Nov 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant