OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

LangChain remote clients can become stale in async hosts

Open ehz0ah opened this issue 6 months ago • 0 comments

Problem

The LangChain/LangGraph integration caches an OpenViking client for the lifetime of a runnable, retriever, or chat history object. In long-running async hosts, the HTTP client's underlying async resources can become stale after host reloads, event-loop changes, reconnects, or temporary server unavailability. Recoverable reads can then keep failing until the process recreates the integration object.

Expected behavior

  • Safe read/retrieval calls should be able to rebuild a stale remote client once.
  • Mutating calls should not be automatically retried, because duplicate writes would be worse than a visible failure.
  • Calls from other async runtimes should still use the sync client's shared background loop, so stateful async clients stay bound to one loop.

Notes

This mainly affects adapter users embedding OpenViking in async frameworks or long-running applications. A fix should keep local embedded clients direct, avoid retrying writes, and add regression coverage for remote recovery.

The separate local-client batch_add_messages contract gap is tracked in #2249.

ehz0ah avatar May 26 '26 11:05 ehz0ah