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
{{ message }}
Repository navigation
Team mode M10: Usage per member and role model allowlists #4148
M10 wire contract (agreed before parallel work; Claude = UI, Codex = logic)
Based on main after M1 (#4163) and M3 (#4164). M2 (#4166), M4, M9 (#4167) are open in parallel; whichever lands later reconciles migrations and member-methods.ts.
Usage attribution
Usage receipts gain a Human ID: the Human whose message started the Session's root turn when known (Channel message author, Human DM, Tob), else the Bot's owner Human (M2 owner; Owner for Host Bots and Bots without an owner). Background work (schedules, Assignments, idle compaction) is attributed to the Human that created it when recorded, else the Bot owner.
Existing rows are attributed to the Owner (legacy: true on the period when any legacy rows fall inside it). No row is ever dropped or double-counted.
usageByMember { period: 'today'|'week'|'month'|'quarter' } → { period, start, end, timezone, members: [{ humanId, displayName, deleted?: true, totals, bots: [{ slug, displayName, totals }] }], legacy: boolean } where totals is the existing UsageOverviewBuckets. Requires usage.view (Owner always). Refusal permission-required (details.permission: 'usage.view'). Sum of member totals equals overviewUsage totals for the same period (regression test).
Members keep seeing only their own Bots' rows in overviewUsage (no other members' Bots).
Role model allowlists
Each Host Role gains models: { kind: 'all' } | { kind: 'only', routes: string[] } where a route key is <provider>/<model> (effort is not restricted). Default all for every existing and new Role. Set through roleUpdate { roleId, models } (needs roles.manage, ceilings unchanged; the built-in Admin role stays all).
A member's allowed set is the union of their Roles (any all → all). The Owner is unrestricted.
modelsAllowed → { all: true } | { all: false, routes: string[] } for the caller (also returned on teamMode.viewer.models).
Enforcement at model selection for any Bot owned by a member (Bot model plan, Assignment default, subagent route, per-Session model switch, Tob): a disallowed route is refused with model-not-allowed (details.route). A Bot whose current route became disallowed keeps its setting but its next turn is refused with the same code and a Human-visible notice; get/list mark it modelAllowed: false.
Provider keys and credential readiness details are never returned to members: member-methods.ts excludes every credentials/provider-key method, and a regression proves a member call is refused.
CLI: usage members --period week, roles update <roleId> --models all|<provider/model,…>, models allowed; --as for all.
Client (Claude): Settings › Team › Usage (per-member table with per-Bot breakdown, period picker; shown with usage.view), Role editor › Models (All models / Only these with a model checklist), model pickers hide disallowed routes for members and mark a Bot whose route is disallowed; en + zh.
Tests: per-member totals reconcile with overviewUsage; attribution of a member's DM turn to that member; legacy rows to Owner; disallowed model refused through every selection path and at turn start; Owner unrestricted; member cannot read provider keys; CLI --as parity.
Merged in #4186 (migrations 148 and 149, after Environment E4's 147). Usage is attributed to the Human who started each turn (own Bots, shared-Channel mentions, subagents and Assignment turns), with legacy rows under the Owner; the Owner and usage.view holders see it per member and per Bot. Roles limit model routes (union across roles, grants capped by the actor's own allowlist); members get a filtered catalog with no credential details; a Bot on a disallowed route fails its turn with a plain explanation. Verified with real model turns on an isolated Host; CI green; all review findings fixed.
Activity
DoodleBears commentedon Nov 14, 2026
Agent work claim
claude/local/74a5ee4a-f6fe-4aab-870f-5e465b0b8474(not a DSH Session)claude/4148-usage-models(frommainafter Team mode M3: Host roles, permission catalog, member and device management #4164; Codex sub-branchcodex/4148-logic)M10 wire contract (agreed before parallel work; Claude = UI, Codex = logic)
Based on
mainafter M1 (#4163) and M3 (#4164). M2 (#4166), M4, M9 (#4167) are open in parallel; whichever lands later reconciles migrations andmember-methods.ts.Usage attribution
legacy: trueon the period when any legacy rows fall inside it). No row is ever dropped or double-counted.usageByMember { period: 'today'|'week'|'month'|'quarter' }→{ period, start, end, timezone, members: [{ humanId, displayName, deleted?: true, totals, bots: [{ slug, displayName, totals }] }], legacy: boolean }wheretotalsis the existingUsageOverviewBuckets. Requiresusage.view(Owner always). Refusalpermission-required(details.permission: 'usage.view'). Sum of member totals equalsoverviewUsagetotals for the same period (regression test).overviewUsage(no other members' Bots).Role model allowlists
models: { kind: 'all' } | { kind: 'only', routes: string[] }where a route key is<provider>/<model>(effort is not restricted). Defaultallfor every existing and new Role. Set throughroleUpdate { roleId, models }(needsroles.manage, ceilings unchanged; the built-in Admin role staysall).all→ all). The Owner is unrestricted.modelsAllowed→{ all: true } | { all: false, routes: string[] }for the caller (also returned onteamMode.viewer.models).model-not-allowed(details.route). A Bot whose current route became disallowed keeps its setting but its next turn is refused with the same code and a Human-visible notice;get/listmark itmodelAllowed: false.member-methods.tsexcludes every credentials/provider-key method, and a regression proves a member call is refused.CLI:
usage members --period week,roles update <roleId> --models all|<provider/model,…>,models allowed;--asfor all.Client (Claude): Settings › Team › Usage (per-member table with per-Bot breakdown, period picker; shown with
usage.view), Role editor › Models (All models / Only these with a model checklist), model pickers hide disallowed routes for members and mark a Bot whose route is disallowed; en + zh.Tests: per-member totals reconcile with
overviewUsage; attribution of a member's DM turn to that member; legacy rows to Owner; disallowed model refused through every selection path and at turn start; Owner unrestricted; member cannot read provider keys; CLI--asparity.Merge origin/main and reconcile M10 migrations with Environment E4
Fix M10 role model creation and initiating-turn usage attribution
Fix M10 model-grant ceilings and child activation continuation attrib…
DoodleBears commentedon Nov 14, 2026
Outcome
Merged in #4186 (migrations 148 and 149, after Environment E4's 147). Usage is attributed to the Human who started each turn (own Bots, shared-Channel mentions, subagents and Assignment turns), with legacy rows under the Owner; the Owner and
usage.viewholders see it per member and per Bot. Roles limit model routes (union across roles, grants capped by the actor's own allowlist); members get a filtered catalog with no credential details; a Bot on a disallowed route fails its turn with a plain explanation. Verified with real model turns on an isolated Host; CI green; all review findings fixed.State: done. Claim released.