[PR #5213] fix(checkpoint-sqlite): Handle TTL refresh correctly in AsyncSqliteStore.asearch #4305

Closed
opened 2026-02-20 17:49:59 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5213

State: closed
Merged: Yes


The original implementation for refresh_on_read=True in asearch for AsyncSqliteStore used a CTE with an UPDATE statement, which is not well-supported by SQLite in that specific construction, leading to a syntax error.

This commit changes the approach:

  1. _prepare_batch_search_queries in BaseSqliteStore no longer constructs a CTE-based UPDATE. Instead, it returns a flag indicating if TTL refresh is needed for the searched items.
  2. _batch_search_ops in both AsyncSqliteStore and SqliteStore now check this flag. If true, they perform a separate UPDATE statement after fetching the search results to refresh the TTL of those items.

Additionally, a new test case test_async_asearch_refresh_ttl was added and existing test logic was refined to accurately verify this behavior.

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5213 **State:** closed **Merged:** Yes --- The original implementation for `refresh_on_read=True` in `asearch` for AsyncSqliteStore used a CTE with an UPDATE statement, which is not well-supported by SQLite in that specific construction, leading to a syntax error. This commit changes the approach: 1. `_prepare_batch_search_queries` in `BaseSqliteStore` no longer constructs a CTE-based UPDATE. Instead, it returns a flag indicating if TTL refresh is needed for the searched items. 2. `_batch_search_ops` in both `AsyncSqliteStore` and `SqliteStore` now check this flag. If true, they perform a separate UPDATE statement after fetching the search results to refresh the TTL of those items. Additionally, a new test case `test_async_asearch_refresh_ttl` was added and existing test logic was refined to accurately verify this behavior.
yindo added the pull-request label 2026-02-20 17:49:59 -05:00
yindo closed this issue 2026-02-20 17:49:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4305