fix(langchain): forward session properties to the engine - #2692
Conversation
WrenToolkit.query/dry_plan/dry_run never accepted or forwarded session properties, even though WrenEngine already threads them through its planning path. A model guarded by row-level access control needs the session property its rule declares required, so every call through the SDK failed with a missing-property planning error, with no way to supply one. wren-pydantic has the identical gap open on the same issue (Canner#2638). Closes Canner#2691 Refs Canner#2638
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. Walkthrough
ChangesLangChain session properties
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The direct toolkit APIs now forward per-call session properties to the engine, enabling guarded queries without changing the LangChain tool interfaces. No actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What changes
WrenToolkit.query(),dry_plan()anddry_run()now acceptpropertiesand forward it to the engine, so a caller can supply MDL session properties
per call, the same fix already needed on the
wren-pydanticside (#2684).WrenEngine.query/dry_plan/dry_runalready acceptproperties(
core/wren/src/wren/engine.py); the langchain toolkit simply never passedit through, so a model guarded by row-level access control could not be
read through this SDK at all: planning fails when a required session
property is missing, and there was no way to supply one.
Fixes #2691 (companion issue for wren-langchain; see #2638 for the identical wren-pydantic gap)
Why the LangChain tools are unchanged
wren_query/wren_dry_plankeep their current signatures on purpose.Turning a session property into a model-fillable tool argument would let the
LLM choose the identity that RLAC is keyed on, which is a separate design
question (toolkit- or run-scoped binding), so this PR only opens the direct
Python API.
How this was verified
propertiesreachesWrenEngine.query/dry_plan/dry_run.properties=Nonedefaultcall contract.
pass with the fix (6 passed), same Docker image both times.
pytest -von Python 3.11 and 3.12 (this module's CI matrix),119 passed / 2 deselected (the
slowmarker) on both.ruff check .andruff format --check .clean on both.behavior is the existing, already-tested path; this PR only closes the gap
in what the toolkit forwards to it.
Summary by CodeRabbit
New Features
Tests