You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(runtime): expose organizationId to action-body ctx (user + session) — follow-up to #3280 (#3288)
Hooks now teach `ctx.user.organizationId` / `ctx.session.organizationId` as the
blessed name for the caller's active org (#3280). Action bodies — the sibling
authoring surface sharing the same sandbox runner — were left behind: the REST
dispatch path exposed only `ctx.user.tenantId` (deprecated) and no `ctx.session`,
and the MCP `run_action` path exposed neither.
Both action-dispatch sites (`handleActions`, MCP `runAction`) now populate:
- `ctx.user.organizationId` — blessed name (matches the organization_id column
and current_user.organizationId in RLS); `ctx.user.tenantId` kept as a
deprecated alias on the REST path.
- `ctx.session` (`{ userId, organizationId, tenantId, roles? }`) via a shared
`buildActionSession(ec)` helper, mirroring the hook session shape; undefined
for a context-less / self-invoked call.
Action bodies execute trusted (engine/api facade bypasses RLS/FLS), so a body
that scopes by org must read it from ctx — now under the same name a hook
author uses. objectstack-ui skill documents the action-body ctx + org read.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
**Extend the blessed `organizationId` org name to the action-body surface (follow-up to #3280).** Hooks now teach `ctx.user.organizationId` / `ctx.session.organizationId` as the blessed name for the caller's active org; action bodies — the sibling authoring surface that shares the same sandbox runner — were left behind: the REST dispatch path exposed only `ctx.user.tenantId` (the deprecated name) and no `ctx.session` at all, and the MCP `run_action` path exposed neither.
6
+
7
+
Both action-dispatch sites (`handleActions`, MCP `runAction`) now populate:
8
+
9
+
-**`ctx.user.organizationId`** — the blessed name (matches the `organization_id` column and `current_user.organizationId` in RLS); `ctx.user.tenantId` is kept as a deprecated alias with the identical value on the REST path.
10
+
-**`ctx.session`** (`{ userId, organizationId, tenantId, roles? }`) — mirrors the hook `ctx.session` shape, `undefined` for a context-less / self-invoked call.
11
+
12
+
Action bodies execute trusted (the `ctx.engine` / `ctx.api` facade bypasses RLS/FLS), so a body that must scope by org has to read it from `ctx` — now under the same name a hook author uses. Additive and behavior-preserving; the objectstack-ui skill documents the action-body `ctx` and the `organizationId` read.
0 commit comments