Skip to content

Fix app run panic when stdin isn't a terminal#632

Merged
phinze merged 1 commit intomainfrom
phinze/mir-714-miren-app-run-should-work-without-a-tty
Feb 26, 2026
Merged

Fix app run panic when stdin isn't a terminal#632
phinze merged 1 commit intomainfrom
phinze/mir-714-miren-app-run-should-work-without-a-tty

Conversation

@phinze
Copy link
Copy Markdown
Contributor

@phinze phinze commented Feb 25, 2026

miren app run was using console.Current() to grab a terminal handle, but that function panics when stdin isn't a TTY — so any non-interactive use (piped input, non-interactive SSH, CI) would blow up. The sibling command sandbox exec already handled this correctly by using console.ConsoleFromFile(os.Stdin), which returns an error instead of panicking and lets the else branch fall through to raw stdin/stdout.

One-line fix to match the existing pattern. The server side already does the right thing — it only sets proc.Terminal = true when WinSize is present, which only gets set in the TTY branch.

Closes MIR-714

console.Current() panics when there's no TTY, which means
`miren app run` blows up over non-interactive SSH sessions or piped
input. Switch to ConsoleFromFile(os.Stdin), which returns an error
instead of panicking, matching what sandbox exec already does.
@phinze phinze requested a review from a team as a code owner February 25, 2026 22:49
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a217814 and ce46fa3.

📒 Files selected for processing (1)
  • cli/commands/app_run.go

📝 Walkthrough

Walkthrough

The change modifies the console acquisition logic in the app run command. Instead of directly checking console.Current(), it now attempts to acquire a console from standard input using console.ConsoleFromFile(os.Stdin) with explicit error handling. When successful, the console is used for input/output and window sizing operations. If the operation fails, the code falls back to standard input/output handling. The conditional logic for sizing and signal-based updates is scoped to execute only when the console is successfully obtained.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@phinze phinze merged commit 38df8e1 into main Feb 26, 2026
12 checks passed
@phinze phinze deleted the phinze/mir-714-miren-app-run-should-work-without-a-tty branch February 26, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants