Skip to content

feat(den): centralize AI Gateway access and usage management - #5139

Merged
benjaminshafii merged 13 commits into
devfrom
cleanup-ai-gateway-models-replacement
Sep 23, 2026
Merged

benjaminshafii merged 13 commits into
devfrom
cleanup-ai-gateway-models-replacement

Conversation

@OmarMcAdam

@OmarMcAdam OmarMcAdam commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Make AI Gateway a normal top-level sidebar page with Overview, AI Providers, Limits, Users & Teams, and the full OpenWork Models subscription/usage/model-lineup content. Retain legacy BYOK pages and access from AI Providers, not the sidebar.
  • Keep provider detail/new/edit flows inside the Gateway shell. Remove Old Gateway routes/helpers/navigation; old list/new/detail/edit URLs return 404. BYOK migration uses the new detail route. Older /dashboard/inference links forward to the Models tab with repeated query parameters preserved.
  • Centralize provider/model-group grants and usage-limit assignments in Users & Teams using shared pickers, colored organization/user/team cards, inherited-team filtering, and safe reauthentication/uncertain-write handling.
  • Reorganize Limits into increase requests, a collapsing user-usage inspector, and compact policy rows. Reuse Den primitives (DESIGN P5) and progressive disclosure (P3).
  • Add isolated synthetic demo fixtures and regression coverage.

General availability

Retire the organization-level gatewayDashboard rollout flag in dashboard/migration gates, client capability types, admin toggle/write semantics, organization creation metadata, fixtures, and operational docs. Stored missing/false/malformed flag values cannot block Gateway. No organization opt-in/backfill is needed.

A deprecated, always-true API compatibility response remains for older clients; validated boolean/null admin inputs are ignored. These are not mutable feature controls. New clients do not consult the field. API/SDK contracts were regenerated.

Admin/membership/reauthentication rules, provider/model/credential grants, usage enforcement, subscription/DPA rules, and deployment configuration are unchanged. GATEWAY_ENABLED and deploymentCapabilities.aiGateway remain installation/configuration controls for deployments without a configured Gateway service. GA does not authorize inference without configuration and credentials.

Database migration and rollout

One migration relative to dev: 0108_gateway_usage_organization_assignments.sql, plus snapshot/journal. Flag retirement adds no migration.

  • Adds an organization-wide usage-policy target; preserves member/team assignments, exclusive-target validation, and organization/policy uniqueness.
  • Everyone covers current and future members with independent usage buckets.
  • Apply migration before updated readers/writers; upgrade API/Gateway instances before creating Everyone assignments. Old readers do not enforce them.
  • No existing data is deleted. Rollback must account for Everyone assignments already created.

Rebase

Rebased onto dev 7799582. PR head: 437d8b6.

Preserved the initial merge commit's Gateway diff as a linear commit, retaining the six intended Gateway commits and omitting inherited unrelated SCIM commits. The only conflict was generated OpenAPI; regeneration preserved all 435 upstream operations and upstream SCIM documentation changes. Updated the branch with an explicit force-with-lease after confirming its previous remote head.

Post-rebase verification

  • 228 frontend regression tests passed across access guards, navigation, migration exposure, Models independence and organization switching.
  • 55 API unit tests passed across capability, organization metadata/auth and deployment guards.
  • 8 den-db unit/schema tests passed.
  • Den-web and Den API non-incremental TypeScript passed. SDK generation/check passed. API lint: 0 errors, 39 warnings.
  • Cold-boot E2E passed on the rebased head: pnpm evals:e2e gateway-usage-policy --local — 1 passed, 0 failed, 0 skipped, local placement in an isolated checkout. The ordinary organization has no Gateway opt-in metadata. Covers management, centralized assignment, nested forms, Models redirect/query preservation, removed routes, member authorization denials, quota blocking, 25% approval and native Desktop recovery, using mocked inference.
  • Initial post-rebase E2E attempt stopped before any steps because local Redis was stopped. After restarting the owned loopback-only test Redis, the full journey passed. Failure receipt retained.

Earlier isolated DB/API integration and migration upgrade checks passed before rebase; those separate DB suites were not rerun in this rebase pass. This is focused verification, not the entire repository matrix.

Screenshots and evidence

Current rebased-head screenshots below are synthetic-only 1440×1200 captures. The recorder has 19 passed assertion claims and 13 reference screenshots without recorded automated visual validation. Formal visual evidence completeness remains Incomplete. Screenshots do not substitute for the behavioral assertions.

Rebased Users and Teams

Rebased Limits

Rebased OpenWork Models

@OmarMcAdam
OmarMcAdam requested a review from a team September 18, 2026 16:18
@vercel

vercel Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Ignored Ignored Preview Sep 23, 2026 12:47am UTC
openwork-den Ignored Ignored Preview Sep 23, 2026 12:47am UTC
openwork-diagnostics Ignored Ignored Preview Sep 23, 2026 12:47am UTC
openwork-landing Ignored Ignored Preview Sep 23, 2026 12:47am UTC

@mintlify

mintlify Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
differentai 🟢 Ready View Preview Sep 22, 2026, 11:13 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@OmarMcAdam

OmarMcAdam commented Sep 22, 2026 •

Copy link
Copy Markdown
Member Author

Selected evidence: Passed · 2/2 tests · 39/39 assertions · 20 images

Commit bc75c8cf5bb9b07dc4da066b5d859f53aeddc964 · selected evidence
Required verification is reported separately by the current-head Required verification check.

Open review report

Benjamin Shafii added 2 commits September 22, 2026 15:20
MySQL returned the active buckets without ORDER BY, so /v1/inference could
list five_hour, weekly and monthly in any order between identical reads.
…f lane

- cdp: role targets can locate progressbar (the usage meter checks never matched).
- fixture: store the fixture key with its hash so Den self-heal does not rotate it.
- world: allow the loopback upstream through the Gateway egress guard.
- behaviors/spec: track replies by message id; the windowed transcript unmounts
  older messages, so mounted counts stall.
- spec: move the Langfuse export journey out; Den only exports to public HTTPS,
  which the local lane cannot provide. It moves to a Daytona-only spec.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9b76cb6
Status: ✅  Deploy successful!
Preview URL: https://ccae096a.openwork.pages.dev
Branch Preview URL: https://cleanup-ai-gateway-models-re.openwork.pages.dev

View logs

@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 22, 2026 23:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 22, 2026 23:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 22, 2026 23:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 22, 2026 23:19 Inactive
@benjaminshafii

Copy link
Copy Markdown
Member

Made the models-analytics-upgrade proof pass in the local proof lane. Commits 2bcb23da4, 92833a9b1, 291f77557, plus a merge of dev:

Still red: prewarm (acme-web). The workflow pins the old controller, which still warms /dashboard/gateway-providers. Someone with workflow scope needs to move the pin in .github/workflows/freestyle-prewarm.yml to 291f77557e1957f4ea6361e76ff79066b5721913. The only controller change from the old pin is that warmup path.

Benjamin Shafii added 3 commits September 22, 2026 17:41
The previous controller warmed /dashboard/gateway-providers, which this branch
removes, so the ACME snapshot build failed. The only controller change from the
old pin is that warmup path.
…els-replacement

# Conflicts:
#	.github/workflows/freestyle-prewarm.yml
Same controller as dev's pin (853c4ca) except the warmup path: the old path,
/dashboard/gateway-providers, is removed by this branch and 404s.
@benjaminshafii

Copy link
Copy Markdown
Member

Update: prewarm (acme-web) is green now. I merged dev again, which had moved the controller pin forward (#5233) and conflicted with this PR. I then pinned the controller to 4d2ac5afa. It matches dev's pin 853c4ca8 except for one line: the warmup path is /dashboard/ai-gateway instead of the removed /dashboard/gateway-providers.

@benjaminshafii
benjaminshafii merged commit 5ef6a3f into dev Sep 23, 2026
29 checks passed
reachjalil added a commit that referenced this pull request Sep 30, 2026
Brings in centralized Gateway usage management (#5139), per-member Google
Vertex sign-in (#5236) and Mistral providers (#5264). Our migration moves to
0111 on top of dev's 0108-0110 with an unchanged table set; the DB test now
upgrades from the 0110 snapshot. dev's shared session-cache helper replaces
our local copy in the management-boundary test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants