opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Allow interactive terminal input for commands requiring user input (sudo, passwords, others)

Open kaizen403 opened this issue 3 weeks ago • 2 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Description

When running commands that require user input (like sudo password prompts), OpenCode should allow the user to temporarily take control of the terminal to enter the input manually.

Use Case

  • Installing packages with yay/pacman that require sudo
  • Any command needing interactive password input
  • SSH connections that need passphrase entry

Current Behavior

Commands that need interactive input fail with: "sudo: a terminal is required to read the password"

Expected Behavior

OpenCode pauses and hands terminal control to the user for input, similar to how Claude Code handles this.

kaizen403 avatar Jan 13 '26 00:01 kaizen403

This issue might be a duplicate of existing issues. Please check:

  • #652: App becomes unresponsive when executing commands requiring sudo password
  • #3027: Terminal gets corrupted when prompted for SSH key
  • #3212: Agent runs "sudo" and freezes UI when analyzing system configs
  • #257: [bug] can't input gpg password when git commit

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Jan 13 '26 00:01 github-actions[bot]

I'd be interested in working on this myself if it gets approved. Happy to discuss implementation approaches. @thdxr

kaizen403 avatar Jan 13 '26 00:01 kaizen403

Hey, this seems like you could solve it by writing some skills. I had Opus write itself a skill so it uses pkexec instead of sudo whenever running a command as root is required. This means a graphical prompt asking for my password pops up on my screen, and no console text input is required.

Such a skill could be generalized to make the agent analyze whether something needs an interactive session, either before running a command or after realizing a command has failed because of it.

hir0xygen avatar Jan 13 '26 04:01 hir0xygen

Thanks for the suggestion! A skill that swaps sudo for pkexec (or reruns in a PTY) is a solid workaround and I can add one to unblock interactive commands. However, the original request is for a first-class interactive TTY handoff so users can enter passwords/inputs consistently, even where pkexec/GUI prompts aren’t available. I’d like to keep this issue open to track a built-in solution (PTY attach + UI handoff), while I can also publish a skill in the meantime. If the maintainers prefer the skill-only path, I’m happy to document that instead.

kaizen403 avatar Jan 13 '26 17:01 kaizen403