
[email protected]andClaude Opus 4.6
8f1e0df0cd
feat: add TenantCtx for compile-time tenant isolation
Implements zmanian's architectural proposal from #1614 review:
two-tier scoped database access (TenantScope/AdminScope) so handler
code cannot accidentally bypass tenant scoping.
TenantScope (default): wraps user_id + Arc<dyn Database>, auto-binds
user_id on every operation. ID-based lookups return None for cross-
tenant resources. No escape hatch — forgetting to scope is a compile
error.
AdminScope (explicit opt-in): cross-tenant access for system-level
components (heartbeat, routine engine, self-repair, scheduler, worker).
TenantCtx bundles TenantScope + workspace + cost guard + per-user
rate limiting. Constructed once per request in handle_message, threaded
through all command handlers and ChatDelegate.
Key changes:
- New src/tenant.rs (~920 lines): TenantScope, AdminScope, TenantCtx,
TenantRateState, TenantRateRegistry
- All command handlers: user_id: &str → ctx: &TenantCtx
- ChatDelegate: cost check/record/settings via self.tenant
- System components: store field changed to AdminScope
- Config: TENANT_MAX_LLM_CONCURRENT, TENANT_MAX_JOBS_CONCURRENT env vars
- Fixes bug: /status <job_id> cross-tenant leak (now auto-filtered)
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-25 16:36:11 -07:00
..
2026-03-23 10:08:24 +01:00
2026-03-23 11:01:26 -07:00
2026-03-25 16:36:11 -07:00
2026-03-11 20:28:38 -07:00
2026-03-24 10:41:33 +01:00
2026-03-14 13:06:59 -07:00
2026-03-21 00:02:00 -07:00
2026-03-20 10:12:32 -07:00
2026-03-23 20:50:05 -07:00
2026-03-07 18:01:40 +00:00
2026-03-23 11:01:26 -07:00
2026-03-11 03:36:25 +00:00
2026-03-06 00:49:10 +00:00
2026-03-25 16:36:11 -07:00
2026-03-05 09:13:09 +00:00
2026-03-07 09:15:00 +00:00
2026-03-05 09:13:09 +00:00
2026-03-25 16:36:11 -07:00
2026-03-11 16:52:31 -07:00
2026-03-06 08:12:56 +00:00
2026-03-07 09:15:00 +00:00
2026-03-21 12:41:46 -07:00
2026-03-05 09:13:09 +00:00
2026-03-07 09:15:00 +00:00
2026-03-05 09:13:09 +00:00
2026-03-21 12:41:46 -07:00
2026-03-07 09:15:00 +00:00
2026-03-06 08:12:56 +00:00
2026-03-20 10:12:32 -07:00
2026-03-21 22:41:44 -07:00
2026-03-09 07:10:25 +00:00
2026-02-22 08:09:56 +00:00
2026-03-22 22:56:26 -07:00
2026-03-11 11:48:24 -07:00
2026-03-11 11:48:24 -07:00
2026-03-11 11:48:24 -07:00
2026-03-11 11:48:24 -07:00
2026-03-11 11:48:24 -07:00
2026-03-10 18:37:10 -07:00
2026-03-20 22:15:29 -07:00
2026-03-23 20:50:05 -07:00
2026-03-22 22:56:26 -07:00
2026-03-23 20:50:05 -07:00
2026-03-23 20:50:05 -07:00
2026-03-23 20:50:05 -07:00
2026-02-12 12:25:36 +01:00
2026-03-07 09:10:05 +00:00
2026-03-19 11:53:46 -07:00
2026-03-21 22:05:18 -07:00
2026-03-10 08:11:21 -07:00
2026-03-08 13:32:42 -07:00
2026-03-16 16:10:20 -07:00
2026-03-06 04:39:04 +00:00
2026-03-05 09:13:09 +00:00
2026-03-05 09:13:09 +00:00
2026-03-16 13:31:03 -07:00
2026-03-07 18:01:40 +00:00
2026-03-22 22:56:26 -07:00
2026-03-23 20:50:05 -07:00