Skip to content

fix(langchain): support separator-containing store keys - #4335

Open
Mchenr wants to merge 2 commits into
volcengine:mainfrom
Mchenr:fix/langchain-store-absolute-paths
Open

fix(langchain): support separator-containing store keys#4335
Mchenr wants to merge 2 commits into
volcengine:mainfrom
Mchenr:fix/langchain-store-absolute-paths

Conversation

@Mchenr

@Mchenr Mchenr commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

Support slash- and backslash-containing LangGraph store keys without sending encoded path separators that OpenViking rejects.

The adapter keeps each BaseStore key as exactly one URI segment. It first applies the existing percent encoding, then translates encoded separators into adapter-level escape tokens:

/AGENTS.md       -> !sAGENTS.md
notes/todo.md    -> notes!stodo.md
docs\guide.md    -> docs!bguide.md
!sAGENTS.md      -> %21sAGENTS.md

Because quote(..., safe="") encodes a literal ! as %21 before !s and !b are introduced, separator escapes remain distinct from literal marker text. Keys without separators retain their existing URI layout.

This preserves LangGraph's (namespace, key) boundary: namespace labels remain URI hierarchy, while the complete opaque key remains the final segment.

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 #4334

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 not to work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Preserve ordinary key URI layouts.
  • Encode / as !s and \ as !b after percent encoding.
  • Decode only the final key segment; namespace parsing remains unchanged.
  • Support leading, trailing, and repeated separators, backslashes, Unicode, dot segments, percent text, and literal !s/!b.
  • Remove the earlier versioned hierarchy and path-normalization restrictions.
  • Add regression coverage for the namespace/key identity collision identified during review.

Testing

  • I have added tests that prove the fix is effective
  • New and existing integration tests pass locally
  • Tested on:
    • Linux
    • macOS
    • Windows

Validation performed:

  • 72 passed in tests/unit/test_langchain_integration.py
  • Ruff lint and format checks
  • mypy for all 15 langchain_openviking source files
  • git diff --check
  • End-to-end against OpenViking 0.4.16: put/get, listing, semantic search, namespace listing, and isolated deletion
  • Confirmed /AGENTS.md and literal !sAGENTS.md remain separate records through write/read/list/glob/search
  • Exhaustive local round-trip check over 66,430 generated keys found no collisions

Checklist

  • My code follows the project's coding style
  • I have performed a self-review
  • I have commented the non-obvious encoding invariant
  • I have made corresponding documentation changes
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

This revision adopts the single-segment encoding suggested in the issue discussion. It avoids changing namespace semantics or introducing an internal URI hierarchy.

@Mchenr Mchenr changed the title fix(langchain): support hierarchical store keys fix(langchain): support separator-containing store keys Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenVikingStore rejects slash-containing LangGraph keys

1 participant