Skip to content

feat(bug-report): print bug report URL in terminal instead of opening browser (#510) #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions codex-cli/src/components/chat/terminal-chat-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,8 @@ export default function TerminalChatInput({
setInput("");

try {
// Dynamically import dependencies to avoid unnecessary bundle size
const [{ default: open }, os] = await Promise.all([
import("open"),
import("node:os"),
]);

// Lazy import CLI_VERSION to avoid circular deps
const os = await import("node:os");
const { CLI_VERSION } = await import("../../utils/session.js");

const { buildBugReportUrl } = await import(
"../../utils/bug-report.js"
);
Expand All @@ -492,10 +485,6 @@ export default function TerminalChatInput({
.join(" | "),
});

// Open the URL in the user's default browser
await open(url, { wait: false });

// Inform the user in the chat history
setItems((prev) => [
...prev,
{
Expand All @@ -505,13 +494,13 @@ export default function TerminalChatInput({
content: [
{
type: "input_text",
text: "📋 Opened browser to file a bug report. Please include any context that might help us fix the issue!",
text: `🔗 Bug report URL: ${url}`,
},
],
},
]);
} catch (error) {
// If anything went wrong, notify the user
// If anything went wrong, notify the user.
setItems((prev) => [
...prev,
{
Expand Down
3 changes: 2 additions & 1 deletion codex-cli/src/components/help-overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default function HelpOverlay({
<Text color="cyan">/clearhistory</Text> – clear command history
</Text>
<Text>
<Text color="cyan">/bug</Text> – file a bug report with session log
<Text color="cyan">/bug</Text> – generate a prefilled GitHub issue URL
with session log
</Text>
<Text>
<Text color="cyan">/diff</Text> – view working tree git diff
Expand Down
5 changes: 4 additions & 1 deletion codex-cli/src/utils/slash-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const SLASH_COMMANDS: Array<SlashCommand> = [
{ command: "/help", description: "Show list of commands" },
{ command: "/model", description: "Open model selection panel" },
{ command: "/approval", description: "Open approval mode selection panel" },
{ command: "/bug", description: "Generate a prefilled GitHub bug report" },
{
command: "/bug",
description: "Generate a prefilled GitHub issue URL with session log",
},
{
command: "/diff",
description:
Expand Down