Skip to content

wren-langchain: session properties are not forwarded, same gap as #2638 #2691

Description

@AmirF194

wren-langchain: session properties are not forwarded, same gap as #2638

Summary

WrenToolkit.query() / dry_plan() / dry_run() in sdk/wren-langchain never
accept or forward session properties to the engine. wren.engine.WrenEngine
already threads properties through its whole planning path, so any project
with row-level access control (RLAC) enabled cannot be queried through this
SDK at all: planning fails with a missing-session-property error, and there
is no parameter to supply one.

This is the same defect reported in #2638 for wren-pydantic; the two
toolkits share the same method signatures and the gap is identical in both.

Root cause

  • core/wren/src/wren/engine.py
    • dry_plan(self, sql, properties=None)
    • query(self, sql, limit=None, properties=None) calls self.dry_plan(sql, properties)
    • dry_run(self, sql, properties=None) same shape
  • sdk/wren-langchain/src/wren_langchain/_toolkit.py
    • query(self, sql, limit=None) calls engine.query(sql, limit=limit), no properties
    • dry_plan(self, sql) calls engine.dry_plan(sql), same gap
    • dry_run(self, sql) same

Repro

toolkit = WrenToolkit.from_project("./my_project")
toolkit.query("SELECT * FROM orders")   # no `properties` kwarg available

With an RLAC rule requiring session_user_id, this always fails with a
missing-session-property planning error, and there is no way to pass one
through the toolkit.

Fix

Opening a PR now that adds the properties kwarg to all three methods and
forwards it to the engine, mirroring the fix shape already proposed for
wren-pydantic in #2684.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions