From 13efaccb17204b363dad9fbb2a8c85227b7711ab Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Tue, 20 Oct 2026 01:53:32 +0900 Subject: [PATCH] Show lowercase profile names in posted comments --- src/post/post.test.ts | 16 ++++++++-------- src/profiles/profiles.test.ts | 6 +++--- src/profiles/profiles.ts | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/post/post.test.ts b/src/post/post.test.ts index 0570247..74a92fd 100644 --- a/src/post/post.test.ts +++ b/src/post/post.test.ts @@ -147,7 +147,7 @@ test("posts a successful issue result and removes runtime credentials", async () const [request] = requests; expect(request?.url).toStrictEqual(`${context.apiUrl}/repos/owner/repo/issues/7/comments`); expect(requestBody(request?.init)).toStrictEqual({ - body: "done\n\n> Profile: `CODEX` · `gpt-test`", + body: "done\n\n> Profile: `codex` · `gpt-test`", }); expect(request?.init?.headers).toStrictEqual({ Authorization: "token reviewer-secret", @@ -178,11 +178,11 @@ test("retries a rejected inline review without anchors", async () => { ); expect(bodies[0]).toMatchObject({ - comments: [{ body: "Finding\n\n> Profile: `CODEX` · `gpt-test`" }], + comments: [{ body: "Finding\n\n> Profile: `codex` · `gpt-test`" }], }); expect(bodies[1]).toMatchObject({ comments: [], - body: "✅ Approved\nReady\n\n> Profile: `CODEX` · `gpt-test`", + body: "✅ Approved\nReady\n\n> Profile: `codex` · `gpt-test`", }); assert(await missing(result.runtimeDir)); }); @@ -205,9 +205,9 @@ test("reports each tried profile and keeps the action failed", async () => { expect(bodies).toStrictEqual([ { body: - "AI bot failed.\n\n> Tried: `CODEX` · `gpt-test` (sign-in failed), " + - "`CLAUDE` · `claude-test` (usage exhausted), " + - "`OPENCODE` · `openrouter/test` (failed)", + "AI bot failed.\n\n> Tried: `codex` · `gpt-test` (sign-in failed), " + + "`claude` · `claude-test` (usage exhausted), " + + "`opencode` · `openrouter/test` (failed)", }, ]); assert(!JSON.stringify(bodies).includes("reviewer-secret")); @@ -235,7 +235,7 @@ test("drops failure entries that are not known labels", async () => { expect(bodies).toStrictEqual([ { - body: "AI bot failed.\n\n> Tried: `CLAUDE` · `claude-test` (sign-in failed)", + body: "AI bot failed.\n\n> Tried: `claude` · `claude-test` (sign-in failed)", }, ]); }); @@ -315,7 +315,7 @@ test("reports an attributed failure when a pull request review is missing", asyn expect(bodies).toStrictEqual([ { - body: "AI bot failed.\n\n> Tried: `CODEX` · `gpt-test` (failed)", + body: "AI bot failed.\n\n> Tried: `codex` · `gpt-test` (failed)", }, ]); assert(await missing(result.runtimeDir)); diff --git a/src/profiles/profiles.test.ts b/src/profiles/profiles.test.ts index 5441a91..6879598 100644 --- a/src/profiles/profiles.test.ts +++ b/src/profiles/profiles.test.ts @@ -12,7 +12,7 @@ import { test("formats profile attribution as a Markdown quote", () => { expect(profileFooter({ type: "OPENCODE", model: "openrouter/qwen/qwen3.8-27b" })).toBe( - "> Profile: `OPENCODE` · `openrouter/qwen/qwen3.8-27b`", + "> Profile: `opencode` · `openrouter/qwen/qwen3.8-27b`", ); }); @@ -105,8 +105,8 @@ test("falls through after a sign-in failure and records each try", async () => { { type: "CLAUDE", model: "claude-sonnet-5", reason: "USAGE_EXHAUSTED" }, ]); expect(failureFooter(failures)).toStrictEqual( - "> Tried: `CODEX` · `gpt-5.6-terra` (sign-in failed), " + - "`CLAUDE` · `claude-sonnet-5` (usage exhausted)", + "> Tried: `codex` · `gpt-5.6-terra` (sign-in failed), " + + "`claude` · `claude-sonnet-5` (usage exhausted)", ); }); diff --git a/src/profiles/profiles.ts b/src/profiles/profiles.ts index 2d25a17..67cb85e 100644 --- a/src/profiles/profiles.ts +++ b/src/profiles/profiles.ts @@ -8,8 +8,20 @@ export interface BotProfile extends ProfileIdentity { token?: string; } +// The lowercase name a profile type reads as in posted comments. +function profileName(type: ProfileIdentity["type"]): string { + switch (type) { + case "CLAUDE": + return "claude"; + case "CODEX": + return "codex"; + case "OPENCODE": + return "opencode"; + } +} + export function profileFooter(profile: ProfileIdentity): string { - return `> Profile: \`${profile.type}\` · \`${profile.model}\``; + return `> Profile: \`${profileName(profile.type)}\` · \`${profile.model}\``; } export function withProfile(body: string, profile: ProfileIdentity): string { @@ -66,7 +78,9 @@ export function failureFooter(failures: ProfileFailure[]): string { return "> Profile: none"; } return `> Tried: ${failures - .map(({ type, model, reason }) => `\`${type}\` · \`${model}\` (${toMessage(reason)})`) + .map( + ({ type, model, reason }) => `\`${profileName(type)}\` · \`${model}\` (${toMessage(reason)})`, + ) .join(", ")}`; }