feat(service-ai): access-aware agent catalog so the UI hides agents you can't chat#2320
Merged
Conversation
…ou can't chat GET /api/v1/ai/agents (and listAgents) returned EVERY active agent regardless of the caller's per-agent access (`permissions`/`access`). The console keys its "Build with AI" / "Ask AI" surfaces off this catalog, so a user without the required permission still saw the buttons and only hit a 403 on click (dead-end UX) — notably with the per-user AI-seat gate (ADR-0068), where build/ask carry `permissions:['ai_seat']`. listAgents now takes an optional caller context and, when present, drops agents the caller can't access (same evaluateAgentAccess the chat route enforces, ADR- 0049). The list route passes req.user. No caller (internal default-agent resolution) → unfiltered, so existing behavior is unchanged. Ungated agents (no `permissions`) stay visible to everyone, so this is a no-op until an agent is actually gated — e.g. the AI-seat kill-switch is off. Net effect: the existing frontend "no build/ask in catalog → no AI surface" logic now hides AI for seat-less users with ZERO objectui changes; the signal is the catalog itself. +5 unit tests (no-caller unfiltered / seat-less hidden / seated-by-permission / seated-by-role / ungated-visible). service-ai suite green (408). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GET /api/v1/ai/agents(andlistAgents) returned every active agent regardless of the caller's per-agent access (permissions/access). The console keys its "Build with AI" / "Ask AI" surfaces off this catalog, so a user without the required permission still saw the buttons and only hit a 403 on click (dead-end UX) — notably with the per-user AI-seat gate (ADR-0068), wherebuild/askcarrypermissions:['ai_seat'].listAgentsnow takes an optional caller context and, when present, drops agents the caller can't access (the sameevaluateAgentAccessthe chat route enforces, ADR-0049). The list route passesreq.user. No caller → unfiltered (internal default-agent resolution unchanged). Ungated agents (nopermissions) stay visible to everyone → no-op until an agent is actually gated.Net effect: the existing frontend "no build/ask in catalog → no AI surface" logic now hides AI for seat-less users with ZERO objectui code changes.
+5 unit tests; service-ai suite green (408). Part of the per-user AI-seat gate (ADR-0068).
🤖 Generated with Claude Code