Commit e24ee8b
fix(runtime): synthesize ai_seat in resolveExecutionContext (scope-correct engine) (#2335)
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>1 parent e8a81f0 commit e24ee8b
3 files changed
Lines changed: 23 additions & 56 deletions
File tree
- packages/runtime/src
- security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
996 | 978 | | |
997 | 979 | | |
998 | 980 | | |
999 | 981 | | |
1000 | 982 | | |
1001 | 983 | | |
1002 | | - | |
| 984 | + | |
1003 | 985 | | |
1004 | 986 | | |
1005 | 987 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3217 | 3217 | | |
3218 | 3218 | | |
3219 | 3219 | | |
3220 | | - | |
3221 | | - | |
3222 | | - | |
3223 | | - | |
3224 | | - | |
3225 | | - | |
3226 | | - | |
3227 | | - | |
3228 | | - | |
3229 | | - | |
3230 | | - | |
3231 | | - | |
3232 | | - | |
3233 | | - | |
3234 | | - | |
3235 | | - | |
3236 | | - | |
3237 | | - | |
3238 | | - | |
3239 | | - | |
3240 | | - | |
3241 | | - | |
3242 | | - | |
3243 | | - | |
3244 | | - | |
3245 | | - | |
3246 | | - | |
3247 | | - | |
3248 | | - | |
3249 | | - | |
3250 | | - | |
3251 | | - | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
3252 | 3223 | | |
3253 | 3224 | | |
3254 | 3225 | | |
3255 | 3226 | | |
3256 | 3227 | | |
3257 | 3228 | | |
3258 | 3229 | | |
3259 | | - | |
| 3230 | + | |
3260 | 3231 | | |
3261 | 3232 | | |
3262 | 3233 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
408 | 422 | | |
409 | 423 | | |
410 | 424 | | |
| |||
0 commit comments