Skip to content

fix: abort timed-out flow action requests - #241

Merged
paulkr merged 7 commits into
withoneai:mainfrom
RachitSrivastava12:fix/flow-action-timeout-cancellation
Nov 20, 2026
Merged

paulkr merged 7 commits into
withoneai:mainfrom
RachitSrivastava12:fix/flow-action-timeout-cancellation

Conversation

@RachitSrivastava12

Copy link
Copy Markdown
Contributor

Flow action steps could report a timeout while the underlying request was still running. A slow preflight could also finish after the timeout and dispatch a write.

This change propagates an AbortSignal through connection lookup, action-details resolution, and passthrough requests, so timed-out actions can be cancelled before further work is dispatched.

It also preserves the existing retry/backoff behavior and carries the signal across same-origin redirects.

Added regression tests for in-flight cancellation, late preflight responses, stale-cache fallback, retries, and redirect handling.

Tested

  • npm run typecheck
  • npm run build
  • npm test — 891 passed, 6 existing config test failures on macOS
  • git diff --cached --check

Aborting a request doesn't guarantee a remote write was rolled back. Retries can still overlap an earlier request that hasn't settled, particularly with zero retry delay.

paulkr and others added 6 commits November 19, 2026 21:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A paginate step sends its page requests the same way an action step
does, but got no abort signal, so after reporting its timeout it kept
fetching pages in the background. It now shares the action step's
controller: a timeout aborts the in-flight page and no further page is
requested or reported, even when a page resolves late.

Docs: the step-type reference said a timed-out step's API call is never
cancelled. That is now wrong for action and paginate steps; it says
which step types abort and which keep running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two tests wait for an abort to reject a request against a local server.
If the signal ever stops reaching fetch, they waited forever and hung
the whole run (CI would sit until its 6-hour limit). A test-level
timeout does not help: the timed-out body never reaches its finally, so
the server stays open and keeps the process alive. Bound the waits in
the body instead, so the test fails in 5s and still closes its server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main took 2.16.1 (withoneai#244) while this PR was open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulkr
paulkr merged commit 6227eaf into withoneai:main Nov 20, 2026
8 checks passed
@paulkr

paulkr commented Nov 20, 2026

Copy link
Copy Markdown
Member

Thanks @RachitSrivastava12, this is a real bug and a careful fix. I reproduced it on main with one flow execute against a mock API. A slow preflight still sent the write about 1s after the step reported its timeout, and a slow write ran to completion in the background. Your branch stops both, and reverting the engine change fails 7 of your 12 new flow tests.

I pushed a few changes to your branch so we can ship it:

  • Paginate steps: they send requests the same way action steps do but got no abort signal, so a timed-out paginate kept fetching pages. They now share the action step's controller. A timeout aborts the page in flight, and no further page is fetched, even if a page comes back late. Added two tests for this.
  • Docs: docs: sync README, skill, guide and help text with the CLI (v2.15.2) #242 had added a line to flows.md saying a timed-out step's API call is never cancelled, which this PR makes wrong. It now says which step types abort and which keep running. I updated the timeoutMs schema description to match.
  • Tests: the two api-redirect abort tests that use a local server would hang the whole run if the signal ever stopped reaching fetch. A test-level timeout wasn't enough, because the server stays open when the test times out. So I bounded the waits inside the tests. They now fail in about 5s and still close their server.
  • Version: merged main and bumped to 2.16.2.

CI is green on Ubuntu and Windows for Node 22, 24 and 26. Loop, parallel, while and sub-flow steps still keep running the steps inside them after a timeout. That problem predates this PR, so we'll fix it separately. Thanks again!

@RachitSrivastava12

Copy link
Copy Markdown
Contributor Author

Thanks @RachitSrivastava12, this is a real bug and a careful fix. I reproduced it on main with one flow execute against a mock API. A slow preflight still sent the write about 1s after the step reported its timeout, and a slow write ran to completion in the background. Your branch stops both, and reverting the engine change fails 7 of your 12 new flow tests.

I pushed a few changes to your branch so we can ship it:

  • Paginate steps: they send requests the same way action steps do but got no abort signal, so a timed-out paginate kept fetching pages. They now share the action step's controller. A timeout aborts the page in flight, and no further page is fetched, even if a page comes back late. Added two tests for this.
  • Docs: docs: sync README, skill, guide and help text with the CLI (v2.15.2) #242 had added a line to flows.md saying a timed-out step's API call is never cancelled, which this PR makes wrong. It now says which step types abort and which keep running. I updated the timeoutMs schema description to match.
  • Tests: the two api-redirect abort tests that use a local server would hang the whole run if the signal ever stopped reaching fetch. A test-level timeout wasn't enough, because the server stays open when the test times out. So I bounded the waits inside the tests. They now fail in about 5s and still close their server.
  • Version: merged main and bumped to 2.16.2.

CI is green on Ubuntu and Windows for Node 22, 24 and 26. Loop, parallel, while and sub-flow steps still keep running the steps inside them after a timeout. That problem predates this PR, so we'll fix it separately. Thanks again!

Appreciate it @paulkr

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.

2 participants