Skip to content

fix(agent): release invocation lock only in throw mode#2954

Open
chaynabors wants to merge 1 commit into
strands-agents:mainfrom
chaynabors:agent-tasks/2918-release-lock-throw-mode
Open

fix(agent): release invocation lock only in throw mode#2954
chaynabors wants to merge 1 commit into
strands-agents:mainfrom
chaynabors:agent-tasks/2918-release-lock-throw-mode

Conversation

@chaynabors

Copy link
Copy Markdown
Member

In UNSAFE_REENTRANT mode begin() never acquires the invocation lock, but stream_async's finally was calling release_lock() unconditionally and could release a lock owned by a concurrent direct tool call from _caller.py. Gating the release on ConcurrentInvocationMode.THROW makes the UNSAFE_REENTRANT path a no-op while leaving THROW behavior unchanged.

Fixes #2918.

@github-actions github-actions Bot added size/xs python Pull requests that update python code bug Something isn't working area-agent Related to the agent class or general agent questions area-async Related to asynchronous flows or multi-threading labels Jun 24, 2026
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-agent Related to the agent class or general agent questions area-async Related to asynchronous flows or multi-threading bug Something isn't working python Pull requests that update python code size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release_lock() can release a lock owned by a different invocation in UNSAFE_REENTRANT mode

1 participant