From a3686d5eba9ec12a7c505788cfb905282769a5dd Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Sat, 19 Sep 2026 01:14:23 +0800 Subject: [PATCH] fix(linear): sync status when reconnecting saved installations --- .../linear/tests/webui/LinearPanel.test.tsx | 17 +++++++++++++++++ .../settings/channels/ChannelQrConnectFlow.tsx | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/nanobot/channels/linear/tests/webui/LinearPanel.test.tsx b/nanobot/channels/linear/tests/webui/LinearPanel.test.tsx index 2e6dae199..ab9090ab3 100644 --- a/nanobot/channels/linear/tests/webui/LinearPanel.test.tsx +++ b/nanobot/channels/linear/tests/webui/LinearPanel.test.tsx @@ -348,6 +348,23 @@ describe("Linear channel UI", () => { expect(screen.queryByText("Authorization stopped.")).not.toBeInTheDocument(); }); + it("updates the running status when an existing installation connects without OAuth", async () => { + const feature = savedFeature(); + mockFeature(feature); + requestMutationMock.mockResolvedValueOnce({ + session_id: "", status: "succeeded", + nanobot_features: { + features: [{ ...feature, enabled: true, running: true, runtime_status: "running" }], + enabled_count: 1, + }, + }); + renderSettingsView({ initialSection: "channels" }); + fireEvent.click(await screen.findByRole("button", { name: "View Linear settings" })); + fireEvent.click(await screen.findByRole("button", { name: "Connect Linear" })); + expect(await within(screen.getByRole("dialog")).findByText("Connected", { exact: true })).toBeVisible(); + expect(screen.getByRole("button", { name: "Connect another workspace" })).toBeEnabled(); + }); + it("does not mark saved credentials or a failed runtime as connected", async () => { mockFeature({ ...savedFeature(), enabled: true, configured: true, runtime_status: "failed", runtime_error: "Linear channel failed to start" }); diff --git a/webui/src/components/settings/channels/ChannelQrConnectFlow.tsx b/webui/src/components/settings/channels/ChannelQrConnectFlow.tsx index 721381c4b..3a6d26989 100644 --- a/webui/src/components/settings/channels/ChannelQrConnectFlow.tsx +++ b/webui/src/components/settings/channels/ChannelQrConnectFlow.tsx @@ -184,12 +184,15 @@ export function ChannelQrConnectFlow({ ...(force ? { force: true } : {}), }); setConnect(payload); + if (payload.nanobot_features) { + onFeaturesUpdate(payload.nanobot_features); + } } catch (err) { setError((err as Error).message); } finally { setBusy(false); } - }, [channelName, client, startParams]); + }, [channelName, client, startParams, onFeaturesUpdate]); useEffect(() => { const requested = Boolean(connectRequestId && connectRequestId !== handledRequestId.current);