Skip to content

fix(stepfunctions): catch panics in spawned executions#658

Closed
vieiralucas with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-merge-pr-611-614
Closed

fix(stepfunctions): catch panics in spawned executions#658
vieiralucas with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-merge-pr-611-614

Conversation

Copilot AI commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

vieiralucas and others added 3 commits April 17, 2026 18:02
Step Functions e2e tests have been flaking on main with
ConnectionRefused mid-test inside wait_for_execution. The server
process is gone by the time the client hits describe_execution,
which means a panic in the async execution task was bubbling up
through the outer tokio::spawn and killing the task without
updating the execution record.

Two fixes:

1. Wrap run_states in an inner tokio::spawn inside
   execute_state_machine, await the JoinHandle, and on JoinError
   (panic or cancel) mark the execution as States.Runtime FAILED
   with the panic payload. Panics now fail the one execution
   instead of leaking to the default handler.

2. Install a panic hook in the fakecloud server binary that
   routes panics through tracing::error! with file:line and the
   payload string. This gives CI logs a clear breadcrumb if any
   other codepath panics in the future.

Also cleans up a latent unwrap() in validate_definition that
was redundant with the preceding is_none() check (now a single
ok_or_else flow).

Adds an e2e regression test that runs an execution whose shape
previously tripped the interpreter, then asserts the server is
still reachable afterwards.
Co-authored-by: vieiralucas <7764293+vieiralucas@users.noreply.github.com>
…#614)

Co-authored-by: vieiralucas <7764293+vieiralucas@users.noreply.github.com>
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