[mason] Per-user memory/session isolation + agent.toml store bindings - #533
Merged
Merged
Conversation
elainemwang
force-pushed
the
mason-per-user-actor
branch
2 times, most recently
from
September 3, 2026 20:15
2cd7b8d to
6ea9742
Compare
elainewang-db
enabled auto-merge (squash)
September 3, 2026 20:23
qinxinw-db
approved these changes
Sep 3, 2026
auto-merge was automatically disabled
September 3, 2026 20:58
Head branch was pushed to by a user without write access
elainemwang
force-pushed
the
mason-per-user-actor
branch
from
September 3, 2026 20:58
9eefbd4 to
94578d1
Compare
elainewang-db
enabled auto-merge (squash)
September 3, 2026 21:00
Long-term memory and the durable session store were keyed by a single static actor (AGENT_*_ACTOR_ID env, default "agent"), so every user of a deployed agent shared one memory/session namespace — a privacy and relevance problem for multi-user apps. Make the actor the request's signed-in user instead: - The SDK adapters take actor as an explicit parameter — memory_tools(actor), session_store(session_id, actor), thread_config(session_id, actor). The memory tools close over the actor (it is NOT a tool argument the model can set/spoof). - The templates resolve the actor per request from the forwarded-identity header (X-Forwarded-Email) in runtime.py and pass it through agent.py's _actor(); it falls back to "agent" locally. The demo UI's state routes use the same actor so its memory/session panels show the signed-in user's own data. - Drop the now-dead AGENT_*_ACTOR_ID env vars and `mason deploy --actor-id` (the actor is no longer a static deploy-time value). The low-level `mason memory entries` / `mason sessions` --actor-id args are unchanged (direct store access). Both templates (openai + langgraph). Tests + docs updated; per-user actor is invisible to agent authors — they call the same memory_tools()/session_store(). Co-authored-by: Isaac <no-reply@databricks.com>
Store bindings become part of the agent manifest instead of only living as app.yaml env. `mason memory bind <store>` / `mason sessions bind <store>` (+ unbind) declare a `[memory_store]` / `[session_store]` table in agent.toml, creating the managed store if it doesn't exist. The runtime resolves the store name explicit-arg > AGENT_*_STORE env > agent.toml binding > none — the conventional precedence (env overrides the committed default), read via a new runtime.tool_manifest.store_binding() so a bind takes effect with no env plumbing. Co-authored-by: Isaac <no-reply@databricks.com>
Store create/resolve is a network round-trip that can stall (the agents/v1 create endpoint is slow and occasionally drops the response), so `mason memory/sessions bind` and `stores create` looked hung. Add a `render.status()` spinner around those calls. Co-authored-by: Isaac <no-reply@databricks.com>
The scaffolds need the per-user-actor + agent.toml store-binding runtime (memory_tools(actor), resolve_*_store, thread_config(actor)), which ships in 0.1.3.dev0. Bump both template pins so a scaffold resolves a package new enough to read its bindings. The package version bump itself lands separately. Co-authored-by: Isaac <no-reply@databricks.com>
auto-merge was automatically disabled
September 3, 2026 21:13
Head branch was pushed to by a user without write access
elainemwang
force-pushed
the
mason-per-user-actor
branch
from
September 3, 2026 21:13
94578d1 to
c8ff60e
Compare
elainewang-db
enabled auto-merge (squash)
September 3, 2026 21:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related changes to how a mason agent resolves its memory/session config.
Per-user isolation (
e2b044d): managed memory and session data now partition by the signed-in user (X-Forwarded-Email) instead of one shared"agent"actor, so a deployed multi-user agent no longer pools everyone's memory/transcripts. The actor is a factory parameter closed over in the tools — not a tool argument — so the model can't set or spoof it. Falls back to"agent"locally.Store bindings in agent.toml (
56b5113):mason memory bind <store>/mason sessions bind <store>(+unbind) declare a[memory_store]/[session_store]table in agent.toml, creating the store if needed. The runtime resolves the store name explicit arg →AGENT_*_STOREenv →agent.tomlbinding → none (conventional precedence; env overrides the committed default). A bind takes effect with no env plumbing.Both templates + adapters updated; app.yaml unchanged. Tests: 231 unit, 21 openai + 25 langgraph scaffold; ruff + ty clean.
Tested e2e dev on
e2-dogfood.