diff --git a/src/workbench/extensions/agent/AgentPanelRoot.test.ts b/src/workbench/extensions/agent/AgentPanelRoot.test.ts index d37f7033bc6..2a45143b023 100644 --- a/src/workbench/extensions/agent/AgentPanelRoot.test.ts +++ b/src/workbench/extensions/agent/AgentPanelRoot.test.ts @@ -1588,6 +1588,16 @@ describe('AgentPanelRoot standing credits-exhausted paywall', () => { expect(telemetry.trackAgentPaywallShown).not.toHaveBeenCalled() }) + it('stays hidden before Agent consent is accepted', async () => { + Object.assign(useAgentConsentStore(), { accepted: false }) + paywallHasFunds.value = false + render(AgentPanelRoot, { global: { plugins: [i18n] } }) + await screen.findByRole('textbox') + + expect(screen.queryByTestId(STANDING)).not.toBeInTheDocument() + expect(telemetry.trackAgentPaywallShown).not.toHaveBeenCalled() + }) + it('stays hidden on the legacy rail whose unloaded balance reads as false', async () => { paywallHasFunds.value = false paywallBilling.type = 'legacy' diff --git a/src/workbench/extensions/agent/AgentPanelRoot.vue b/src/workbench/extensions/agent/AgentPanelRoot.vue index 365980f5460..13de08dd967 100644 --- a/src/workbench/extensions/agent/AgentPanelRoot.vue +++ b/src/workbench/extensions/agent/AgentPanelRoot.vue @@ -146,6 +146,7 @@ const { fetchStatus: refreshBillingStatus } = useBillingContext() const conversationStore = useAgentConversationStore() +const { accepted: consentAccepted } = storeToRefs(useAgentConsentStore()) watch( subscription, (currentSubscription) => { @@ -263,6 +264,7 @@ watch( */ const agentHasFunds = computed(() => subscription.value?.agentHasFunds) const creditsExhausted = computed(() => { + if (!consentAccepted.value) return false if (billingType.value !== 'workspace') return false // Same gate as the impression report above: an unsettled read cannot say // which presentation is right, and a card naming the wrong remediation is @@ -460,7 +462,6 @@ onBeforeUnmount(() => } }) ) -const { accepted: consentAccepted } = storeToRefs(useAgentConsentStore()) const { withConsent } = useAgentConsent() const workspaceStore = useTeamWorkspaceStore() const onboardingKey = computed(() =>