Repository navigation
Python: scope the todo mutation lock to the store and session - #9870
Closed
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Closed
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Conversation
The lock lived on the provider instance, so two providers sharing a todo store could both load the same state before either saved, silently dropping one write, and a session reused across event loops could raise from the loop bound lock. The lock registry is now keyed by store, session, and event loop, mirroring the file access write lock. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Manohar Paturi (ManoharPaturi)
temporarily deployed
to
github-app-auth
October 30, 2026 04:25 — with
GitHub Actions
Inactive
Manohar Paturi (ManoharPaturi)
requested review from
Darren Cohen (dargilco) and
sophia-ramsey
as code owners
October 30, 2026 04:25
Manohar Paturi (ManoharPaturi)
temporarily deployed
to
github-app-auth
October 30, 2026 04:25 — with
GitHub Actions
Inactive
Contributor
Author
|
Understood, and sorry. #9868 now follows the bug report template with the race reproduction, and this PR stays closed until the team agrees with the locking direction. |
This branch was previously deployed
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.
Motivation & Context
TodoProviderserialized its read-modify-write todo operations with a lock that belonged to the provider instance. Todo stores are deliberately shareable, so two providers over one store serialized against nothing: both could load the same state before either saved, reuse the same item id, and the last save silently dropped the other write while both tool calls reported success. The lock was also keyed by session only, so a session reused acrossasyncio.runboundaries could raise from the loop bound lock, the exact hazard the file access layer documents and guards against.Description & Review Guide
_store_write_lockin the file access layer.asyncio.runsession working. The outer map stays weak, so locks for garbage collected sessions are still evicted, and the default in memory store keeps its zero await point fast path.before_runitself loads todo state to inject it into the run, and the eviction test now asserting against the module registry.Related Issue
Fixes #9868
AI Assistance
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.