Context
Part of closing the "app/tenant-based routing" third of MVP 1 (multi-cluster routing: model-based, app-based, standard). Model-based and standard routing are covered today (grid-glb-demo, grid-workload-inference, grid-combined-site). Tenant/app-based routing has zero demoable evidence at the Grid (multi-cluster) layer today.
The tenant-identification and cost-metering work is tracked on the ai side:
ai#130 — tenant-ID extraction (open, unassigned)
ai#104 — per-tenant routing wiring at the single-gateway layer (open, unassigned)
ai#191 — budget-enforcement engine, cascading org→team→user→agent limits (open, unassigned)
ai#577 / ai-pr-581 — per-request cost-metering / balance-check filter (open PR, assigned to @noyitz)
ai#301 — parent epic, "Multi-Tenancy Support"
None of that work extends the budget/tenant concept across cluster boundaries. This issue tracks the Grid-side plumbing needed to make a per-tenant budget cap demoable at the multi-cluster layer.
Scope
- CRD field for a per-tenant budget on the routing overlay / policy resource
- Per-tenant-keyed GCounter (today's
grid GCounter CRDT is a single global counter — needs to become tenant-keyed)
- SWIM broadcast wiring so tenant spend state propagates across sites
- A budget-aware scoring gate that degrades routing (e.g. cheaper backend) as spend approaches the cap, and hard-stops at 100%
Open design question
GCounter is monotonic by construction — it can't natively express a rate-based budget ("$X per hour") without a reset/windowing design. This needs a design call before implementation, not after.
Estimate
Grid-side plumbing alone is well-precedented (~7-8 days) once the design call above is made; the full MVP 1b close (including the ai-side work above) is a 2-3 week cross-repo effort.
Context
Part of closing the "app/tenant-based routing" third of MVP 1 (multi-cluster routing: model-based, app-based, standard). Model-based and standard routing are covered today (
grid-glb-demo,grid-workload-inference,grid-combined-site). Tenant/app-based routing has zero demoable evidence at the Grid (multi-cluster) layer today.The tenant-identification and cost-metering work is tracked on the
aiside:ai#130— tenant-ID extraction (open, unassigned)ai#104— per-tenant routing wiring at the single-gateway layer (open, unassigned)ai#191— budget-enforcement engine, cascading org→team→user→agent limits (open, unassigned)ai#577/ai-pr-581— per-request cost-metering / balance-check filter (open PR, assigned to @noyitz)ai#301— parent epic, "Multi-Tenancy Support"None of that work extends the budget/tenant concept across cluster boundaries. This issue tracks the Grid-side plumbing needed to make a per-tenant budget cap demoable at the multi-cluster layer.
Scope
gridGCounter CRDT is a single global counter — needs to become tenant-keyed)Open design question
GCounter is monotonic by construction — it can't natively express a rate-based budget ("$X per hour") without a reset/windowing design. This needs a design call before implementation, not after.
Estimate
Grid-side plumbing alone is well-precedented (~7-8 days) once the design call above is made; the full MVP 1b close (including the
ai-side work above) is a 2-3 week cross-repo effort.