Skip to content

feat(langchain): manage Store-owned client lifecycle - #6968

Merged
qin-ctx merged 1 commit into
volcengine:mainfrom
stefanielizeth73-art:feat/oss-store-lifecycle
Nov 4, 2026
Merged

qin-ctx merged 1 commit into
volcengine:mainfrom
stefanielizeth73-art:feat/oss-store-lifecycle

Conversation

@stefanielizeth73-art

Copy link
Copy Markdown
Contributor

Description

OpenVikingStore(url=...) retained an internally created HTTP client without a public release method. Add close(), aclose(), and synchronous/asynchronous context managers, using the integration's existing client-ownership rule.

Cleanup is idempotent, releases only internally created clients, and preserves lazy creation for unused Stores. Async cleanup runs off the event loop. Closed Stores reject further operations, including directory queries that would otherwise hide the closed-state error as an empty result. Injected clients remain caller-owned.

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

Implementation, self-review, and local validation were completed with Codex assistance. Human code review is pending.

Related Issue

Closes #6964.

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Test update

Changes Made

  • Expose Store lifecycle methods and context managers through the owning class.
  • Cover owned/injected and unused/initialized clients through explicit and managed sync/async cleanup, repeated closure, and operations after closure.
  • Add cleanup instructions and examples in English and Chinese.

Testing

Windows / Python 3.13.9; LangGraph 1.2.15, langchain-core 1.6.10, LangChain 1.4.0; based on main 66e8ff0a.

  • Lifecycle contract: 16 fail / 119 pass before, 135 pass after.
  • Full integration/component suite: 807 pass / 2 fail. The same two Windows path fixtures fail on unchanged main (791 pass / 2 fail); failed test IDs are unchanged.
  • Related existing lifecycle/URI selection: 16 pass.
  • Package-wide Ruff and formatting checks pass; mypy passes for all 15 production modules.
  • Built the wheel, verified its Store source against the branch, and ran the Store contract against the installed wheel: 135 pass.

Commands:

python -m pytest -q --noconftest -o addopts='' integrations/frameworks/langchain/tests/test_store.py
python -m pytest -q --noconftest -o addopts='' integrations/frameworks/langchain/tests tests/unit/test_langchain_package_boundary.py
python -m ruff format --check integrations/frameworks/langchain/src integrations/frameworks/langchain/tests tests/unit/test_langchain_package_boundary.py
python -m ruff check integrations/frameworks/langchain/src integrations/frameworks/langchain/tests tests/unit/test_langchain_package_boundary.py
python -m mypy --config-file integrations/frameworks/langchain/pyproject.toml integrations/frameworks/langchain/src/langchain_openviking
python -m pip wheel --no-deps --wheel-dir <output> integrations/frameworks/langchain
git diff --check

Checklist

  • Code follows the project's style and includes public lifecycle contract coverage.
  • Corresponding English and Chinese documentation was updated.
  • Human self-review and personal test execution have been recorded.

Screenshots (if applicable)

Not applicable.

Additional Notes

This is an additive client-lifecycle API; persisted values and search/index semantics are unchanged. Cleanup reuses the existing owned handle's behavior. Validation uses controlled clients without live server or model calls. The unchanged full-suite failures are test_resolve_resource_source_handles_local_and_remote_sources and test_add_resource_keeps_explicit_local_clients_supported.

@qin-ctx
qin-ctx merged commit 02611de into volcengine:main Nov 4, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature]: Public lifecycle management for Store-owned HTTP clients

2 participants