Skip to content

Native stores retain contributor authority per invocation - #865

Merged
zlareb1 merged 16 commits into
mainfrom
feat/langgraph-store-session-protection
Nov 18, 2026
Merged

zlareb1 merged 16 commits into
mainfrom
feat/langgraph-store-session-protection

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #859

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Native stores retain their contributing conversation protection across client rebinding. Existing automatic SDK contexts apply per invocation; direct calls and model-selected tools retain explicit behavior.

Why

A store can outlive the context that created it, and its Loom client can be rebound before a later batch. Observing only the current client loses earlier response contributors. The generic store protocol also serves explicit tools, so making every store call automatic would suppress legitimate selected operations.

Scope and risk

The LangGraph adapter retains constructor, ambient and callback contributors through the existing private helper. Each batch captures its entry contributors before consuming a lazy operation iterable. An existing automatic context selects automatic handling for that invocation; other calls retain observation only. Automatic classification does not latch for the store's lifetime.

Marked and malformed responses protect retained contributors before returning or refusing. Protected automatic invocations refuse before dispatch, including after a credential wait. Explicit calls remain usable on the same store after automatic work ends. Native namespaces, keys and user or thread ids select no protection authority.

Use one protected store per logical conversation family and reopen its existing application-owned capsule on restore. The sender inventory renews only this adapter's reviewed source hash; all six literal SDK call ASTs and all sender exception categories and reasons stay intact. No wire, backend, host binding or capability is added.

The native-history dependency is published. This four-path change targets main. Full CI passed on the final pushed head, and fresh independent whole-diff review found no findings or nits.

Compatibility, rollout and rollback

  • Wire: no operation, payload, header or public method signature changes.
  • Storage: no schema or capsule-format change.
  • Operators: none. Applications supply complete contributor authority before construction and preserve its capsule on restore.
  • Rollback: no migration. Preserve durable protection records; an older adapter cannot declare session protection support.

Tests

  • The corrected focused harness reproduces nine protection failures while four explicit and ordinary controls pass on the unchanged adapter.
  • The same 13 cases passed after the fix in 2.78 seconds, using real SDK clients, HTTPX MockTransport and temporary durable protection capsules. The adapter, tests and SDK dependency sources are unchanged in the main-targeted composition; this focused check was not rerun. No service or provider starts.
  • Cases cover constructor and ambient roots, previous callbacks, rebinding, lazy batches, credential waits, malformed replies, and explicit get/put after an automatic invocation on the same store. Existing CRUD and batch ordering controls pass.
  • Reproduce with pytest -q -n0 tests/unit/test_sdk_langgraph_store.py -k "protection_store or test_put_get_delete_round_trip_with_tags_ttl_and_index_false or test_batch_executes_ops_in_order_and_aligns_results".
  • These are adapter/protocol unit checks using the module's existing structural operation twins; they do not qualify an installed native framework.
  • The prior scoped source mypy and changed-page Prettier checks are retained for unchanged files. Scoped Ruff, prose and diff checks pass for this composition. All 44 sender source hashes match. No broad local suite ran. Final-head GitHub CI passed: 43 successful checks, two expected publication skips and four successful workflows.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated: Codex wrote the change. Fresh independent whole-diff review found no findings or nits, and final-head CI passed.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Main-targeted final-head CI passes.
  • Fresh whole-diff review has no findings or nits.
  • Documentation states invocation classification, ownership and restore requirements.
  • No generated operation, migration, plugin or frontend changes.
  • Public text follows repository copy rules.
  • Commits are signed off.

Observe the native response body before releasing marked frames and keep every contributing handle across buffered automatic work. Explicit actions retain observation without becoming automatic capture.

Signed-off-by: zlareb1 <[email protected]>
A shared monotonic patch could expire a freshly loaded model-call policy before the bearer test reached its first request. Exercise the same attributed token rotation at two clock epochs without changing the policy clock.

Signed-off-by: zlareb1 <[email protected]>
Keep constructor and callback contributors across client rebinding. Treat history reads and additions as automatic work while preserving observed explicit pop and clear operations.

Signed-off-by: zlareb1 <[email protected]>
Keep the reviewed adapter and test source unchanged while using published session protection as the base.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 changed the base branch from feat/native-history-session-protection to main November 18, 2026 13:55
@zlareb1 zlareb1 closed this Nov 18, 2026
@zlareb1 zlareb1 reopened this Nov 18, 2026
@zlareb1
zlareb1 merged commit c430b92 into main Nov 18, 2026
45 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 18, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant