fix: allow Agents access via user-level coast-access [FIX-416]#187
Merged
Conversation
liamg
approved these changes
Jul 15, 2026
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.
What
The CLI half of FIX-416. The dashboard
currentUserquery now returnsagentsEnabledat the user level as well as per-org (dashboard PR: infracost/dashboard#5248). This wires the CLI to honour it.The
coast-accessentitlement can target a user directly or their org. Previously the CLI only gated the Agents surfaces (findings / tasks / actions and their MCP tools) on the active org's flag, so a user with the entitlement whose org didn't have it was denied access.Now: if Agents is enabled for the user it is always-on regardless of the active org; otherwise we fall back to the active org's flag.
Changes
internal/api/dashboard/client.go: select the new user-levelagentsEnabledand addCurrentUser.AgentsEnabled.pkg/auth/user_cache.go: addUserCache.AgentsEnabled.internal/cmds/org.go:cacheUserpersists the user-level flag;applyActiveOrgcomputescfg.AgentsEnabled = org.AgentsEnabled || uc.AgentsEnabled;applyActiveOrg/applyActiveOrgByIDthread theUserCachethrough.internal/cmds/mcp.go:setOrgpasses theUserCachethrough so mid-session org switches keep the user-level grant.internal/config/config.go: doc update forAgentsEnabled.Tests
New
internal/cmds/org_agents_test.go:TestApplyActiveOrg_AgentsEnabled— the OR gate (neither / org-only / user-only always-on / both).TestApplyActiveOrgByID— user-level grant enables the gate even when the active org has it off; org-flag fallback; defensive unknown-id path.TestCacheUser_PersistsAgentsEnabled— the user-level flag round-trips from thecurrentUserresponse through the on-disk cache.go build ./...,go test ./internal/cmds/,gofmt -l, andgolangci-lintall clean.Ref: FIX-416