Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

fix(tui): bound the provider Auth note to the detail pane height

Jack Rudenko171d160b0f65
diff --git a/packages/cli/src/tui/components/ProviderDetail.test.ts b/packages/cli/src/tui/components/ProviderDetail.test.ts
index 568b0d6b..37748c82 100644
--- a/packages/cli/src/tui/components/ProviderDetail.test.ts
+++ b/packages/cli/src/tui/components/ProviderDetail.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
-import { resolveProviderDetailKeyDisplay } from "./ProviderDetail.js";
+import { credentialNoteLines, resolveProviderDetailKeyDisplay } from "./ProviderDetail.js";
describe("resolveProviderDetailKeyDisplay", () => {
test("shows OAuth as the active credential instead of an empty key", () => {
@@ -30,3 +30,39 @@ describe("resolveProviderDetailKeyDisplay", () => {
).toBe("env-mask");
});
});
+
+// REGRESSION: Vertex Auth note overflowed DETAIL_H and painted over the Status row — /dev:fix session dev-fix-20261020-235500-vtx01
+describe("credentialNoteLines", () => {
+ const note =
+ "Project xlabs-test from `gcloud config get project` — ADC login (who signs) and project (who pays) must be one Google account; press l to run gcloud auth application-default login";
+ const width = 85;
+ const maxWidth = width - 4 - 7;
+
+ test("keeps a short note unchanged in one line with or without a failure", () => {
+ const shortNote = "Project xlabs-test from ADC";
+ expect(credentialNoteLines(shortNote, width, false)).toEqual([shortNote]);
+ expect(credentialNoteLines(shortNote, width, true)).toEqual([shortNote]);
+ });
+
+ test("collapses whitespace in a short note", () => {
+ expect(credentialNoteLines(" Project\txlabs-test\nfrom ADC ", width, false)).toEqual([
+ "Project xlabs-test from ADC",
+ ]);
+ });
+
+ test("bounds a long note to two indented-width lines without a failure", () => {
+ const lines = credentialNoteLines(note, width, false);
+ expect(lines).toHaveLength(2);
+ expect(lines[0]).toStartWith("Project xlabs-test");
+ expect(lines[1]).toEndWith("…");
+ for (const line of lines) expect(line.length).toBeLessThanOrEqual(maxWidth);
+ });
+
+ test("bounds a long note to one indented-width line during a failure", () => {
+ const lines = credentialNoteLines(note, width, true);
+ expect(lines).toHaveLength(1);
+ expect(lines[0]).toStartWith("Project xlabs-test");
+ expect(lines[0]).toEndWith("…");
+ expect(lines[0]?.length).toBeLessThanOrEqual(maxWidth);
+ });
+});
diff --git a/packages/cli/src/tui/components/ProviderDetail.tsx b/packages/cli/src/tui/components/ProviderDetail.tsx
index 407d0c0e..55cefe07 100644
--- a/packages/cli/src/tui/components/ProviderDetail.tsx
+++ b/packages/cli/src/tui/components/ProviderDetail.tsx
@@ -49,6 +49,10 @@ function wrapToLines(text: string, maxWidth: number, maxLines: number): string[]
return lines;
}
+export function credentialNoteLines(note: string, width: number, hasFailure: boolean): string[] {
+ return wrapToLines(note, width - 4 - "Auth: ".length, hasFailure ? 1 : 2);
+}
+
interface ProviderDetailProps {
selectedProvider: ProviderDef;
mode: Mode;
@@ -211,6 +215,7 @@ export function ProviderDetail({
tr && (tr.status === "failed" || tr.status === "unavailable")
? (tr.providerMessage ?? tr.error)
: undefined;
+ const noteLines = credentialNote ? credentialNoteLines(credentialNote, width, !!failureText) : [];
return (
<box
@@ -345,14 +350,15 @@ export function ProviderDetail({
credential is not an environment variable — it names the source
precisely (which project, from the ADC file or `gcloud config`) or, when
nothing resolved, both remedies. */}
- {credentialNote && (
- <text>
+ {noteLines.map((line, i) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: positional slices of one string
+ <text key={i}>
<span fg={C.blue} attributes={A.bold}>
- {"Auth: "}
+ {i === 0 ? "Auth: " : " "}
</span>
- <span fg={hasKey ? C.green : C.yellow}>{credentialNote}</span>
+ <span fg={hasKey ? C.green : C.yellow}>{line}</span>
</text>
- )}
+ ))}
{selectedProvider.endpointEnvVar && (
<text>
<span fg={C.blue} attributes={A.bold}>
@@ -361,7 +367,9 @@ export function ProviderDetail({
<span fg={C.cyan}>{activeEndpoint || selectedProvider.defaultEndpoint || "default"}</span>
</text>
)}
- {!failureText && (
+ {/* Two Auth: lines use the description's row; the description remains in
+ the list's DESCRIPTION column. */}
+ {!failureText && noteLines.length < 2 && (
<text>
<span fg={C.blue} attributes={A.bold}>
Desc:{" "}