fix(local): show durable execution ARN as soon as the execution starts - #9205
Open
ParidelPooya wants to merge 1 commit into
Open
fix(local): show durable execution ARN as soon as the execution starts#9205ParidelPooya wants to merge 1 commit into
ParidelPooya wants to merge 1 commit into
Conversation
sam local invoke printed the durable execution ARN only after the execution reached a terminal state, and otherwise logged it at DEBUG. That ARN is the only identifier sam local execution get, history and stop accept, so an execution that was still running -- suspended on a callback, waiting out a context.wait, or interrupted with Ctrl-C -- could not be inspected without re-running the invoke under --debug and reading it out of the log. --durable-execution-name is not a way around it. The emulator builds the ARN from a pair of generated UUIDs and keeps the name only as metadata, so the execution commands answer "Execution <name> not found" when given a name. Nothing else about a running execution is missing: GetDurableExecution and GetDurableExecutionHistory both return data mid-flight, so the ARN was the only gap. The ARN is now printed as soon as start_durable_execution returns, before the wait begins, together with the get/history/stop commands that work from another terminal while the execution runs. That mirrors the service, which returns the ARN in the X-Amz-Durable-Execution-Arn response header of Invoke -- the same header this code already builds for start-lambda and start-api callers, which is why the message is gated to the CLI path by the existing _is_cli_context() check. The completion summary is unchanged, so a short execution now names its ARN twice: at the start, where it is needed in order to poll, and at the end alongside the result. The suggested commands are left unquoted, matching the existing completion output. Once the emulator emits service-shaped ARNs containing $LATEST, both call sites will need quoting, and that belongs with the ARN format change rather than here. assert_invoke_output in the integration base used to find the summary's ARN by taking the first "ARN:" match in stdout; the banner now precedes it. The value is the same either way, so nothing failed, but the helper had stopped proving that the summary carries the ARN. The lookup is now anchored to the summary section, and the banner is asserted separately, so both halves of the user-visible output are covered. This covers the first of the three options aws#9200 offers. Listing local executions and accepting --durable-execution-name in the execution commands are not addressed here. Testing: 86 unit tests pass across tests/unit/lib/utils/test_durable_formatters.py and tests/unit/local/docker/test_durable_lambda_container.py, five of them new -- the formatter, _show_execution_started in CLI context, in HTTP context and with no ARN, and an ordering test that asserts through a get_durable_execution side effect that the ARN was already printed by the time the execution was first polled. The existing sync wait_for_result test now expects both secho calls, in order. The durable integration tests need Docker and were not run; the reworked assertions in assert_invoke_output were checked against a reconstruction of a full invoke stdout, confirming the anchored lookup returns the summary ARN and that the banner assertions hold. black, ruff and mypy clean.
ParidelPooya
force-pushed
the
fix/show-durable-execution-arn-at-start
branch
from
August 27, 2026 19:00
d194dd6 to
2babdb7
Compare
ParidelPooya
marked this pull request as ready for review
August 27, 2026 20:44
bchampp
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sam local invoke printed the durable execution ARN only after the execution reached a terminal state, and otherwise logged it at DEBUG. That ARN is the only identifier sam local execution get, history and stop accept, so an execution that was still running -- suspended on a callback, waiting out a context.wait, or interrupted with Ctrl-C -- could not be inspected without re-running the invoke under --debug and reading it out of the log.
--durable-execution-name is not a way around it. The emulator builds the ARN from a pair of generated UUIDs and keeps the name only as metadata, so the execution commands answer "Execution not found" when given a name. Nothing else about a running execution is missing: GetDurableExecution and GetDurableExecutionHistory both return data mid-flight, so the ARN was the only gap.
The ARN is now printed as soon as start_durable_execution returns, before the wait begins, together with the get/history/stop commands that work from another terminal while the execution runs. That mirrors the service, which returns the ARN in the X-Amz-Durable-Execution-Arn response header of Invoke -- the same header this code already builds for start-lambda and start-api callers, which is why the message is gated to the CLI path by the existing _is_cli_context() check. The completion summary is unchanged, so a short execution now names its ARN twice: at the start, where it is needed in order to poll, and at the end alongside the result.
The suggested commands are left unquoted, matching the existing completion output. Once the emulator emits service-shaped ARNs containing $LATEST, both call sites will need quoting, and that belongs with the ARN format change rather than here.
This covers the first of the three options #9200 offers. Listing local executions and accepting --durable-execution-name in the execution commands are not addressed here.
Testing: 86 unit tests pass across tests/unit/lib/utils/test_durable_formatters.py and tests/unit/local/docker/test_durable_lambda_container.py, five of them new -- the formatter, _show_execution_started in CLI context, in HTTP context and with no ARN, and an ordering test that asserts through a get_durable_execution side effect that the ARN was already printed by the time the execution was first polled. The existing sync wait_for_result test now expects both secho calls, in order. black, ruff and mypy clean.
Which issue(s) does this change fix?
Why is this change necessary?
How does it address the issue?
What side effects does this change have?
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.