From 9cb8e65dc0ad742ea075be1d58acec74da736dfc Mon Sep 17 00:00:00 2001 From: James Long Date: Mon, 9 Nov 2026 13:24:24 -0600 Subject: [PATCH] fix(tui): add a blank row under the OAuth dialog title (#62929) --- .../tui/src/component/dialog-integration.tsx | 11 +- .../test/cli/tui/dialog-integration.test.tsx | 100 ++++++++++++++++++ 2 files changed, 102 insertions(+), 9 deletions(-) diff --git a/packages/tui/src/component/dialog-integration.tsx b/packages/tui/src/component/dialog-integration.tsx index b8f9f62a982..bf622dbe61e 100644 --- a/packages/tui/src/component/dialog-integration.tsx +++ b/packages/tui/src/component/dialog-integration.tsx @@ -766,7 +766,6 @@ function OAuthAuto(props: { > ( - - {props.attempt.instructions} - + {props.attempt.instructions} Waiting for authorization… Press enter to open the link. If the browser can't reach this machine, paste @@ -807,7 +804,6 @@ function OAuthCode(props: { const client = useClient() const toast = useToast() const theme = useTheme().surface("dialog") - const newDesigns = useNewDesigns() const [error, setError] = createSignal() let settled = false @@ -823,7 +819,6 @@ function OAuthCode(props: { return ( { if (!code) return @@ -842,9 +837,7 @@ function OAuthCode(props: { }} description={() => ( - - {props.attempt.instructions} - + {props.attempt.instructions} {(value) => {value()}} diff --git a/packages/tui/test/cli/tui/dialog-integration.test.tsx b/packages/tui/test/cli/tui/dialog-integration.test.tsx index 18d8d113422..86b49a63e54 100644 --- a/packages/tui/test/cli/tui/dialog-integration.test.tsx +++ b/packages/tui/test/cli/tui/dialog-integration.test.tsx @@ -486,3 +486,103 @@ async function renderIntegration(activeLocation?: LocationRef, form?: FormFields }, } } + +test("leaves a blank row between the OAuth title and its instructions under new designs", async () => { + await using fixture = await renderOAuth({ paste: true, newDesigns: true }) + const frame = await fixture.app.waitForFrame((frame) => frame.includes("Redirect URL")) + const lines = frame.split("\n") + const title = lines.findIndex((line) => line.includes("opensend") && line.includes("esc")) + + expect(lines[title + 1]?.trim()).toBe("") + expect(lines[title + 2]).toContain("Authorize opensend in your browser.") +}) + +test("keeps the OAuth paste prompt layout without new designs", async () => { + await using fixture = await renderOAuth({ paste: true, newDesigns: false }) + const frame = await fixture.app.waitForFrame((frame) => frame.includes("Redirect URL")) + const lines = frame.split("\n") + const title = lines.findIndex((line) => line.includes("opensend") && line.includes("esc")) + + expect(lines[title + 1]?.trim()).toBe("") + expect(lines[title + 2]).toContain("Authorize opensend in your browser.") + expect(frame.split("Authorize opensend in your browser.").length).toBe(2) +}) + +async function renderOAuth(input: { paste?: true; newDesigns: boolean }) { + const calls = createFetch(async (url, request) => { + const directory = decodeURIComponent(request.headers.get("x-opencode-directory") ?? process.cwd()) + const location = { directory, project: { id: "proj_test", directory, canonical: directory } } + if (url.pathname === "/api/integration") + return json({ + location, + data: [ + { + id: "opensend", + name: "opensend", + methods: [{ type: "oauth", id: "mcp", label: "opensend" }], + connections: [], + metadata: { source: "mcp" }, + }, + ], + }) + if (request.method === "POST" && url.pathname === "/api/integration/opensend/connect/oauth") + return json({ + location, + data: { + attemptID: "att_test", + url: "https://opensend.example.com/api/auth/oauth2/authorize?response_type=code", + instructions: "Authorize opensend in your browser. This window will close automatically.", + mode: "auto", + ...(input.paste ? { paste: true } : {}), + time: { created: Date.now(), expires: Date.now() + 60_000 }, + }, + }) + if (request.method === "DELETE" && url.pathname === "/api/integration/opensend/connect/oauth/att_test") + return new Response(null, { status: 204 }) + if (url.pathname === "/api/integration/opensend/connect/oauth/att_test") + return json({ location, data: { status: "pending" } }) + return undefined + }) + + function Probe() { + const data = useData() + const dialog = useDialog() + onMount(() => { + void data.location.integration + .sync() + .then(() => dialog.replace(() => )) + }) + return null + } + + const app = await testRender( + () => ( + + + + + + + + + + + + + + + + + + + + ), + { width: 100, height: 30, kittyKeyboard: true }, + ) + app.renderer.start() + + return { + app, + [Symbol.asyncDispose]: async () => app.renderer.destroy(), + } +}