fix(runtime): synthesize ai_seat in resolveExecutionContext (works on sharded runtime)#2335
Merged
Merged
Conversation
…rrect engine) The per-user AI-seat gate (fw#2334) synthesized `ai_seat` from sys_user.ai_access in the AI-route dispatch via getObjectQLService() (no-arg). That resolves the env engine on single-env local but NOT on the SHARDED multi-tenant runtime (OS_OBJECTOS_SHARDS>1), where only the per-request scope selects the right engine -> the lookup returned empty -> a SEATED user (ai_access=true) was denied (/ai/agents=[]). Caught live on staging enforce. Move the synthesis into resolveExecutionContext, which is already handed the scope-correct `ql` engine (the same one that resolves permission sets) -> works on local AND sharded staging/prod. ec.permissions now carries `ai_seat`, which flows to req.user via the existing dispatch path. Drop the two earlier heuristic spots (http-dispatcher wildcard + dispatcher-plugin resolveRequestUser) so there is a single, correct source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 17 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
| // sharded multi-tenant runtime, where only the per-request scope selects the | ||
| // right engine (a no-arg / wrong-scope lookup returns empty and loses the seat). | ||
| // Guarded (tryFind swallows errors) → can only ever ADD access, never break auth. | ||
| if (userId && !ctx.permissions!.includes('ai_seat')) { |
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.
Follow-up to fw#2334. The gate's
ai_seatsynthesis usedgetObjectQLService()(no-arg), which resolves the env engine on single-env local but not on the sharded multi-tenant runtime (OS_OBJECTOS_SHARDS>1) — a SEATED user got/ai/agents=[]. Caught live on staging enforce. Fix: synthesize inresolveExecutionContext, which already has the scope-correctql(used for permission sets), so it works everywhere; drop the two heuristic spots for a single source. 🤖 Generated with Claude Code