You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: BedrockAgentFunctionResolver keeps app.context when a tool raises #8873
app.context is cleared at the end of every invocation, including when the tool raises. The next invocation in the same execution environment starts with an empty context. ApiGatewayResolver (#8538) and AppSyncResolver (#8584) already work this way.
Current Behaviour
BedrockAgentFunctionResolver._resolve() calls clear_context() only after the tool returns. If the tool raises, the except Exception branch returns the Error: ... response without clearing the context. The next warm invocation then sees the data the failed invocation appended, which can belong to another caller.
The same happens when resolve() raises ValueError("Missing required field: ...") for an invalid event: context appended before resolve() is never cleared.
Clear the context in a finally block in resolve(), the same fix used in #8539 for ApiGatewayResolver and in #8629 for AppSyncResolver, and remove the success-only clear_context() call in _resolve().
Steps to Reproduce
Register a tool that calls app.append_context(...) and then raises.
Invoke it through app.resolve(...).
Invoke any other tool on the same resolver instance and read app.context.
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
Activity
boring-cyborg commentedon Nov 19, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
powertools-for-aws-oss-automation commentedon Nov 19, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation