Repository navigation
feat(#456): show "Set up" badge on Agent nav item when Anthropic key is missing - #472
Merged
Merged
Conversation
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.
PR Description
Problem
On cloud, the Agent sidebar entry works only after an admin saves the org's Anthropic API key in Settings. Until then, clicking it lands on the "Add your Anthropic API key" CTA — the item reads as a broken/dead entry rather than a feature awaiting one-time setup.
Closes #456
Solution
Show a small "Set up" badge on the Agent nav item while the org has no Anthropic key configured (cloud only — self-host uses an env var and doesn't need this).
The key status is probed via
GET /api/settings/anthropic-key— the same endpoint the agent page already uses. A module-level cache ensures at most one network request per page load regardless of how many components consume the hook (sidebar + mobile nav mount simultaneously on resize boundaries).Changes
web/src/hooks/use-agent-key-status.ts(new)/api/settings/anthropic-keyonce per session via a module-level promise + result cacheuseAgentKeyStatus(false)(self-host) returns'configured'immediately — zero network callsweb/src/components/layout/sidebar.tsxuseAgentKeyStatus(isCloud)and derivesagentKeyMissingeffectiveBadge:'Set up'on the Agent item when key is missing, otherwise falls back toitem.badge(no change for any other nav item)<Badge variant="secondary">after the label(Set up)to the icon tooltip so the hint is still accessibleweb/src/components/layout/mobile-nav.tsxuseAgentKeyStatus+effectiveBadgepatternflex-1on the label span, matching the existing locked-item layoutAcceptance Criteria
Testing
CI checks from
web/: