fix: /bug report command, thinking indicator (#381)

- Fix `/bug` report command
- Fix thinking indicator
This commit is contained in:
Fouad Matin
2025-04-18 18:13:34 -07:00
committed by GitHub
parent c40f4891d4
commit aa32e22d4b
12 changed files with 154 additions and 183 deletions

View File

@@ -1,4 +1,7 @@
import type { ResponseItem } from "openai/resources/responses/responses.mjs";
import type {
ResponseItem,
ResponseOutputItem,
} from "openai/resources/responses/responses.mjs";
/**
* Build a GitHub issuesnew URL that prefills the Codex 2bugreport.yml
@@ -12,7 +15,7 @@ export function buildBugReportUrl({
platform,
}: {
/** Chat history so we can summarise user steps */
items: Array<ResponseItem>;
items: Array<ResponseItem | ResponseOutputItem>;
/** CLI revision string (e.g. output of `codex --revision`) */
cliVersion: string;
/** Active model name */
@@ -25,16 +28,10 @@ export function buildBugReportUrl({
labels: "bug",
});
// Template ids -------------------------------------------------------------
params.set("version", cliVersion);
params.set("model", model);
params.set("platform", platform);
// The platform input has no explicit `id`, so GitHub falls back to a slug of
// the label text. For “What platform is your computer?” that slug is:
// what-platform-is-your-computer
params.set("what-platform-is-your-computer", platform);
// Build the steps bullet list ---------------------------------------------
const bullets: Array<string> = [];
for (let i = 0; i < items.length; ) {
const entry = items[i];
@@ -50,12 +47,14 @@ export function buildBugReportUrl({
let reasoning = 0;
let toolCalls = 0;
let j = i + 1;
while (
j < items.length &&
!(entry?.type === "message" && entry.role === "user")
) {
while (j < items.length) {
const it = items[j];
if (it?.type === "message" && it?.role === "assistant") {
if (it?.type === "message" && it?.role === "user") {
break;
} else if (
it?.type === "reasoning" ||
(it?.type === "message" && it?.role === "assistant")
) {
reasoning += 1;
} else if (it?.type === "function_call") {
toolCalls += 1;
@@ -63,8 +62,10 @@ export function buildBugReportUrl({
j++;
}
const codeBlock = `\`\`\`\n ${messageText}\n \`\`\``;
bullets.push(
`- "${messageText}"\n - \`${reasoning} reasoning steps\` | \`${toolCalls} tool calls\``,
`- ${codeBlock}\n - \`${reasoning} reasoning\` | \`${toolCalls} tool\``,
);
i = j;