Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-7450 fix(settings): report revoked IM channels as disconnected (#8516)
Bohan Jiangedcd38f9c440
diff --git a/packages/views/settings/components/integrations-tab.test.tsx b/packages/views/settings/components/integrations-tab.test.tsxindex cef16dac6b..204264bcf1 100644--- a/packages/views/settings/components/integrations-tab.test.tsx+++ b/packages/views/settings/components/integrations-tab.test.tsx@@ -10,6 +10,9 @@ const state = vi.hoisted(() => ({error: null as Error | null,connectionError: false,pending: false,+ // The IM channels keep revoked rows for audit, so the fixture carries a real+ // status — a row without one is not evidence of a live connection (#8496).+ installationStatus: "active" as string,calls: [] as { queryKey: readonly unknown[]; enabled?: boolean }[],push: vi.fn(),}));@@ -39,7 +42,10 @@ vi.mock("@tanstack/react-query", () => ({const data =opts.queryKey[0] === "composio"? [{ status: "active" }]- : { installations: [{ id: "one" }], connections: [] };+ : {+ installations: [{ id: "one", status: state.installationStatus }],+ connections: [],+ };return {data: opts.select?.(data),isPending: state.pending,@@ -69,6 +75,7 @@ beforeEach(() => {state.error = null;state.connectionError = false;state.pending = false;+ state.installationStatus = "active";state.calls = [];state.push.mockClear();configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: true });@@ -156,6 +163,22 @@ describe("Integration directory", () => {renderWithI18n(<IntegrationsTab />);expect(screen.getByText("VCS detail")).toBeInTheDocument();});+ it("reports revoked IM channels as disconnected while GitHub keeps counting rows", () => {+ // Revoking an IM bot flips status and KEEPS the row, so counting rows would+ // leave a torn-down bot showing a green "Connected" here forever (#8496).+ // GitHub hard-deletes instead, so its count-based read stays correct and a+ // row that is still present really does mean connected.+ state.installationStatus = "revoked";+ renderWithI18n(<IntegrationsTab />);+ expect(+ screen.getByRole("link", { name: /GitHub Connected/ }),+ ).toBeInTheDocument();+ for (const channel of ["Lark", "Slack", "DingTalk", "WeCom", "Telegram"]) {+ expect(+ screen.getByRole("link", { name: new RegExp(`${channel} Not connected`) }),+ ).toBeInTheDocument();+ }+ });it("does not report failed status reads as disconnected", () => {state.connectionError = true;renderWithI18n(<IntegrationsTab />);diff --git a/packages/views/settings/components/integrations-tab.tsx b/packages/views/settings/components/integrations-tab.tsxindex a2e2230b31..a160ae95e6 100644--- a/packages/views/settings/components/integrations-tab.tsx+++ b/packages/views/settings/components/integrations-tab.tsx@@ -50,6 +50,14 @@ interface IntegrationEntry {state: ConnectionState;}+// The IM channels soft-revoke: the row survives with status 'revoked', so a row+// count never falls back to zero and would report a torn-down bot as connected+// forever. GitHub and VCS hard-delete instead, so their count-based reads below+// are correct and deliberately left as they are (#8496).+const hasActiveInstallation = (data: {+ installations?: { status: string }[];+}) => data.installations?.some((inst) => inst.status === "active") ?? false;+export function IntegrationsTab() {const { t } = useT("settings");const navigation = useNavigation();@@ -77,27 +85,27 @@ export function IntegrationsTab() {const lark = useQuery({...larkInstallationsOptions(wsId),enabled: canView,- select: (data) => (data.installations?.length ?? 0) > 0,+ select: hasActiveInstallation,});const slack = useQuery({...slackInstallationsOptions(wsId),enabled: canView,- select: (data) => (data.installations?.length ?? 0) > 0,+ select: hasActiveInstallation,});const dingtalk = useQuery({...dingtalkInstallationsOptions(wsId),enabled: canView,- select: (data) => (data.installations?.length ?? 0) > 0,+ select: hasActiveInstallation,});const wecom = useQuery({...wecomInstallationsOptions(wsId),enabled: canView,- select: (data) => (data.installations?.length ?? 0) > 0,+ select: hasActiveInstallation,});const telegram = useQuery({...telegramInstallationsOptions(wsId),enabled: canView,- select: (data) => (data.installations?.length ?? 0) > 0,+ select: hasActiveInstallation,});const vcs = useQuery({...vcsConnectionsOptions(wsId),