Show lowercase profile names in posted comments
This commit is contained in:
@@ -147,7 +147,7 @@ test("posts a successful issue result and removes runtime credentials", async ()
|
|||||||
const [request] = requests;
|
const [request] = requests;
|
||||||
expect(request?.url).toStrictEqual(`${context.apiUrl}/repos/owner/repo/issues/7/comments`);
|
expect(request?.url).toStrictEqual(`${context.apiUrl}/repos/owner/repo/issues/7/comments`);
|
||||||
expect(requestBody(request?.init)).toStrictEqual({
|
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({
|
expect(request?.init?.headers).toStrictEqual({
|
||||||
Authorization: "token reviewer-secret",
|
Authorization: "token reviewer-secret",
|
||||||
@@ -178,11 +178,11 @@ test("retries a rejected inline review without anchors", async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(bodies[0]).toMatchObject({
|
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({
|
expect(bodies[1]).toMatchObject({
|
||||||
comments: [],
|
comments: [],
|
||||||
body: "✅ Approved\nReady\n\n> Profile: `CODEX` · `gpt-test`",
|
body: "✅ Approved\nReady\n\n> Profile: `codex` · `gpt-test`",
|
||||||
});
|
});
|
||||||
assert(await missing(result.runtimeDir));
|
assert(await missing(result.runtimeDir));
|
||||||
});
|
});
|
||||||
@@ -205,9 +205,9 @@ test("reports each tried profile and keeps the action failed", async () => {
|
|||||||
expect(bodies).toStrictEqual([
|
expect(bodies).toStrictEqual([
|
||||||
{
|
{
|
||||||
body:
|
body:
|
||||||
"AI bot failed.\n\n> Tried: `CODEX` · `gpt-test` (sign-in failed), " +
|
"AI bot failed.\n\n> Tried: `codex` · `gpt-test` (sign-in failed), " +
|
||||||
"`CLAUDE` · `claude-test` (usage exhausted), " +
|
"`claude` · `claude-test` (usage exhausted), " +
|
||||||
"`OPENCODE` · `openrouter/test` (failed)",
|
"`opencode` · `openrouter/test` (failed)",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
assert(!JSON.stringify(bodies).includes("reviewer-secret"));
|
assert(!JSON.stringify(bodies).includes("reviewer-secret"));
|
||||||
@@ -235,7 +235,7 @@ test("drops failure entries that are not known labels", async () => {
|
|||||||
|
|
||||||
expect(bodies).toStrictEqual([
|
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([
|
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));
|
assert(await missing(result.runtimeDir));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
|
|
||||||
test("formats profile attribution as a Markdown quote", () => {
|
test("formats profile attribution as a Markdown quote", () => {
|
||||||
expect(profileFooter({ type: "OPENCODE", model: "openrouter/qwen/qwen3.8-27b" })).toBe(
|
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" },
|
{ type: "CLAUDE", model: "claude-sonnet-5", reason: "USAGE_EXHAUSTED" },
|
||||||
]);
|
]);
|
||||||
expect(failureFooter(failures)).toStrictEqual(
|
expect(failureFooter(failures)).toStrictEqual(
|
||||||
"> Tried: `CODEX` · `gpt-5.6-terra` (sign-in failed), " +
|
"> Tried: `codex` · `gpt-5.6-terra` (sign-in failed), " +
|
||||||
"`CLAUDE` · `claude-sonnet-5` (usage exhausted)",
|
"`claude` · `claude-sonnet-5` (usage exhausted)",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,20 @@ export interface BotProfile extends ProfileIdentity {
|
|||||||
token?: string;
|
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 {
|
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 {
|
export function withProfile(body: string, profile: ProfileIdentity): string {
|
||||||
@@ -66,7 +78,9 @@ export function failureFooter(failures: ProfileFailure[]): string {
|
|||||||
return "> Profile: none";
|
return "> Profile: none";
|
||||||
}
|
}
|
||||||
return `> Tried: ${failures
|
return `> Tried: ${failures
|
||||||
.map(({ type, model, reason }) => `\`${type}\` · \`${model}\` (${toMessage(reason)})`)
|
.map(
|
||||||
|
({ type, model, reason }) => `\`${profileName(type)}\` · \`${model}\` (${toMessage(reason)})`,
|
||||||
|
)
|
||||||
.join(", ")}`;
|
.join(", ")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user