Skip to content

fix(checkpoint): coerce non-str store keys in AsyncBatchedBaseStore - #9624

Closed
manasa1508 wants to merge 1 commit into
langchain-ai:mainfrom
manasa1508:fix/async-batched-store-str-key
Closed

manasa1508 wants to merge 1 commit into
langchain-ai:mainfrom
manasa1508:fix/async-batched-store-str-key

Conversation

@manasa1508

@manasa1508 manasa1508 commented Nov 7, 2026 •

Copy link
Copy Markdown

Fixes #9521

AsyncBatchedBaseStore.aget/aput/adelete now coerce non-str keys with str(), as BaseStore has done since #3739, so AsyncSqliteStore/AsyncPostgresStore find items by the same key as the sync stores and InMemoryStore. str subclasses (e.g. class Key(str, Enum)) are passed through unchanged, because str() on them gives "Key.A" and would make keys already written through the async stores unreachable.

No JS change needed.

How I verified

  • New test_async_batch_store_coerces_key_to_str in libs/checkpoint/tests/test_store.py checks the keys passed to abatch for an int key and a (str, Enum) key. It fails on main and passes with the fix.
  • make format, make lint, and the libs/checkpoint suite pass. The libs/checkpoint-sqlite suite also passes against this change, and the repro from the issue now finds the item through AsyncSqliteStore.

`BaseStore` builds its get/put/delete ops with `str(key)`, but
`AsyncBatchedBaseStore` overrides `aget`/`aput`/`adelete` and passed
the key through unchanged. With `AsyncSqliteStore`, `aput(ns, 42, ...)`
stored the item under "42" while `aget(ns, 42)` returned `None`; the
sync stores and `InMemoryStore` find it. Coerce non-str keys the same
way. str subclasses (e.g. `class Key(str, Enum)`) are passed through
unchanged so keys already written through the async stores stay
reachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

This PR has been automatically closed because you are not assigned to the linked issue.

External contributors must be assigned to an issue before opening a PR for it. Please:

  1. Comment on the linked issue to request assignment from a maintainer
  2. Once assigned, your PR will be reopened automatically

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

@github-actions github-actions Bot closed this Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AsyncBatchedBaseStore skips the str(key) coercion BaseStore applies, so AsyncSqliteStore.aget(ns, 42) misses an item written with aput(ns, 42, ...)

1 participant