(null)
// Focus lands on Cancel when the delete arms, so a stray second press backs out.
@@ -110,7 +113,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient
const saveMut = useMutation({
mutationFn: (body: ConnectionOAuthClientSave) => api.connectionsOAuthClientSave(client.slug, body),
- onSuccess: () => {
+ onSuccess: (r) => {
+ setNotApplied(agentSpecNotRewritten(r))
setSecret('')
setSecretClear(false)
setFormKey(k => k + 1)
@@ -123,7 +127,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient
})
const deleteMut = useMutation({
mutationFn: () => api.connectionsOAuthClientDelete(client.slug),
- onSuccess: () => {
+ onSuccess: (r) => {
+ setNotApplied(agentSpecNotRewritten(r))
setClientId('')
setSecret('')
setSecretClear(false)
@@ -233,6 +238,8 @@ function ClientCard({ client, index, readOnly }: { client: ConnectionOAuthClient
destroying the client id and secret the operator has typed but not
yet saved (a save failure is exactly when those drafts still exist). */}
{error && }
+ {/* Same reason, no hand-off: it would unmount the card's unsaved drafts. */}
+ {notApplied && }
{!readOnly && (
diff --git a/website/src/test/ConnectionsPage.coverage.test.tsx b/website/src/test/ConnectionsPage.coverage.test.tsx
index aff3237c15e5..da3eab873316 100644
--- a/website/src/test/ConnectionsPage.coverage.test.tsx
+++ b/website/src/test/ConnectionsPage.coverage.test.tsx
@@ -911,6 +911,47 @@ describe('a connected provider', () => {
expect(within(slot as HTMLElement).getByRole('link', { name: /Revoke at Notion/ })).toBeInTheDocument()
})
+ it('alerts when the Disconnect did not reach the agent spec', async () => {
+ mcpServers.mockResolvedValue(connected)
+ connectionsDisconnect.mockResolvedValue({
+ ok: true,
+ grantRemoved: true,
+ grantSurviving: [],
+ entryRemoved: true,
+ grantSharedWith: [],
+ grantCensusIncomplete: false,
+ agentSpecRewritten: false,
+ })
+ mount()
+
+ fireEvent.click(await waitFor(() => within(card('notion')).getByRole('button', { name: /Disconnect/ })))
+
+ // The entry left the config, but new sessions may still load it: a failed
+ // step, so an alert rather than a green success.
+ const alert = await screen.findByRole('alert')
+ expect(alert).toHaveTextContent('Disconnected locally.')
+ expect(alert).toHaveTextContent('new chats still load this connection')
+ })
+
+ it('does not blame the agent spec when the Disconnect removed no entry', async () => {
+ mcpServers.mockResolvedValue(connected)
+ connectionsDisconnect.mockResolvedValue({
+ ok: true,
+ grantRemoved: false,
+ grantSurviving: [],
+ entryRemoved: false,
+ grantSharedWith: [],
+ grantCensusIncomplete: false,
+ agentSpecRewritten: false,
+ })
+ mount()
+
+ fireEvent.click(await waitFor(() => within(card('notion')).getByRole('button', { name: /Disconnect/ })))
+
+ await screen.findByText(/server configuration was left unchanged/i)
+ expect(screen.queryByText(/new chats still load this connection/i)).not.toBeInTheDocument()
+ })
+
it('says the grant was kept when another entry shares the endpoint', async () => {
mcpServers.mockResolvedValue(connected)
connectionsDisconnect.mockResolvedValue({
diff --git a/website/src/types/index.ts b/website/src/types/index.ts
index 01a96c00341a..312f42892755 100644
--- a/website/src/types/index.ts
+++ b/website/src/types/index.ts
@@ -824,6 +824,8 @@ export interface McpDiscoverInstallResult {
method: string
/** False when the entry was written disabled (required env unset). Absent for capability installs. */
enabled?: boolean
+ /** False when the install was saved but the agent spec was not rewritten. */
+ agent_spec_rewritten?: boolean
}
/** A raw mcp.json server spec (stdio command/args/env OR remote url). */