Skip to content

fix(langchain): preserve Store reads and namespace discovery - #6342

Merged
t0saki merged 4 commits into
volcengine:mainfrom
ehz0ah:fix/langgraph-store-reads
Oct 21, 2026
Merged

t0saki merged 4 commits into
volcengine:mainfrom
ehz0ah:fix/langgraph-store-reads

Conversation

@ehz0ah

@ehz0ah ehz0ah commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Description

Make LangGraph Store reads and namespace discovery return reliable results through the existing OpenVikingStore owner:

  • get() and aget() previously returned None for every record-read failure, while put() attempted to create a record after the same failure. Only explicit missing-record errors now take those paths; permission, backend, malformed JSON and other read errors reach the caller before any write.
  • With a peer home-alias root such as viking://~/peers/support/memories/langgraph_store, writes and direct reads worked, but search and namespace listing discarded the server's canonical result URIs. Recognize the canonical peer path while preserving the peer ID, collection and complete store path when matching results.
  • list_namespaces(prefix=("users", "*")) previously treated * as a literal URI segment. Apply LangGraph's single-label wildcard semantics and every batched match condition before depth truncation, deduplication, sorting and pagination. Literal labels such as a* and ** remain literal.

Existing URI encoding, record format, write validation, deletion behavior and optional dependency boundaries are unchanged. No storage migration is needed. Glob/discovery request error handling is outside this change; the error fix concerns individual record reads.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Fixes #6041
Fixes #5766
Fixes #5815

Consolidates #6042, #5767 and #5816.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Reuse is_not_found_error() for record reads and the existing URI classifier for canonical peer results.
  • Replace the lossy prefix/suffix conversion with one namespace-listing path that retains every MatchCondition.
  • Keep contributed tests in existing package test modules. Extend coverage to sync, async, batch, ordinary/semantic search, and peer-alias wildcard listing. Compare namespace behavior with LangGraph's reference Store and retain current empty-namespace validation.
  • Document the corrected read and listing behavior in both integration guides.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows
python -m pytest -q -rs --noconftest -p no:cacheprovider -o addopts='' \
  integrations/frameworks/langchain/tests tests/unit/test_langchain_package_boundary.py
ruff check integrations/frameworks/langchain/src integrations/frameworks/langchain/tests \
  tests/unit/test_langchain_package_boundary.py
ruff format --check integrations/frameworks/langchain/src integrations/frameworks/langchain/tests \
  tests/unit/test_langchain_package_boundary.py
mypy --config-file integrations/frameworks/langchain/pyproject.toml \
  integrations/frameworks/langchain/src/langchain_openviking
uv build --offline --sdist --wheel integrations/frameworks/langchain --out-dir "$DIST"
python -m twine check "$DIST"/*
  • Python 3.12, LangChain 1.4.6 / core 1.6.12 / LangGraph 1.2.16: 684 passed, 1 skipped.
  • Python 3.10, LangChain / core / LangGraph 1.0.0: 683 passed, 2 skipped.
  • The focused 126-case regression subset produces 79 failures / 47 passes against main 7c12d3062; all cases pass here. Public Store entrypoints reproduce each bug.
  • Ruff lint/format, mypy for all 15 source modules, wheel/sdist builds, Twine and git diff --check pass.
  • Fresh base-only and LangGraph-extra wheel smoke tests and uv pip check pass. All 15 wheel Python modules byte-match the final source. The sdist's bundled suite against the installed wheel, outside the checkout: 679 passed, 1 skipped.
  • Real SDK calls through a controlled localhost HTTP fixture: 46 cases pass from source and the installed wheel. These cover canonical peer results, wildcard and contradictory namespace conditions, sync/async reads and writes, batch operations, HTTP 403/503, malformed stored JSON, missing records, and unchanged storage after read failures.

Skips are the optional SQLite checkpointer and, on Python 3.10, asyncio.timeout. Existing dependency deprecation warnings remain. The HTTP fixture uses deterministic backing storage; it does not validate a deployed backend, authorization policy, vector service or external model.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Not applicable.

Additional Notes

Original commits by @ktz03 were cherry-picked with -x, preserving their authorship:

Test relocation, combined regression coverage, correction of the contributed empty-namespace test to match current validation, and guide updates are a separate signed-off commit by Hao Zhe. Source PRs remain open until this combined fix lands.

ktz03 and others added 4 commits October 20, 2026 18:13
(cherry picked from commit 471ade9)
Signed-off-by: Hao Zhe <[email protected]>
(cherry picked from commit 91b5ada)
Signed-off-by: Hao Zhe <[email protected]>
(cherry picked from commit bd26425)
Signed-off-by: Hao Zhe <[email protected]>
Move namespace coverage into the existing package suite. Exercise read failures through sync, async, batch and search entrypoints, combine peer-alias discovery with wildcard listing, and retain the current empty-namespace validation. Document the corrected behavior in both integration guides.

Signed-off-by: Hao Zhe <[email protected]>
@ehz0ah
ehz0ah force-pushed the fix/langgraph-store-reads branch from aab37cd to 04d4c0b Compare October 20, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

3 participants