Skip to content

[FEATURE]:Interactive Shell Passthrough / Shared Pseudoterminal (pty) for MFA/auth/Cowork #53781

Open

Description

@aptitudepi

Feature hasn't been suggested before.

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

Describe the enhancement you want to request

Problem

Right now, the OpenCode TUI handles shell execution as a strictly non-interactive process. If OpenCode tries to execute a shell tool or command that requires runtime interactive authentication (such as an SSH password prompt, an encrypted private key passphrase (Enter passphrase for key...), a sudo request, or an interactive MFA/OAuth login token hook) the session either hangs indefinitely or fails.

There is currently no native way for a user to "step into" the agent's running terminal buffer, type the password or complete the auth step, and let the agent continue.

Potential Solution Description

I would like to see an Interactive Passthrough Mode or a Shared Sub-Terminal Pane inside the OpenCode TUI.

When an agent-initiated bash command requests TTY/interactive input, OpenCode should:

  1. Detect the prompt pause (or let the user manually trigger an override).
  2. Expose or yield control of that specific pseudoterminal (pty) screen directly to the user.
  3. Allow the user to type in their password or verification code safely.
  4. Automatically pass execution control back to OpenCode seamlessly once the auth block is completed, letting the agent continue its automated workflow without breaking the session context, with the user able to see the terminal live.

Alternatives Considered

  • Terminal Multiplexers (tmux/Zellij): Splitting windows manually and sharing environment variables. It works, but it breaks the unified, seamless experience of using the OpenCode TUI directly.
  • Bypassing security: Using passwordless SSH keys is not always available on every system.
  • Alternative Architectures: Platforms like AgentsRoom use a dedicated ssh_connect loop that spawns a shared terminal window exactly for this coworker-auth paradigm, proving that the layout workflow is highly effective for pairing with agents, but adding a live terminal might enable user-agent cowork to be uch more efficient.

Activity

  1. opencode-agent commented on Oct 7, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed request, @aptitudepi!

    To restate it: when an agent-run shell command stops at an interactive prompt (sudo password, SSH key passphrase, MFA/OAuth code), you'd like OpenCode to hand that pty to you in the TUI so you can see it live and type the answer. Control would then go back to the agent without breaking the session. Right now the agent's shell commands run with stdin detached, so these prompts can't be answered and the command hangs or fails.

    Maintainers will consider this. Related issues and discussions:

    This can't be built as a plugin today. A plugin can't currently route the built-in shell tool through a PTY or show an interactive terminal pane in the TUI.

  2. iceteaSA commented on Oct 18, 2026

    @iceteaSA

    Part of this can already be built as a plugin on 2.x, for programs that accept an askpass helper instead of a TTY. We built one for sudo:

    • The plugin wraps the built-in shell tool through ctx.tool.transform and rewrites elevated commands to sudo -A, with SUDO_ASKPASS pointing at a small helper.
    • When sudo needs the password it runs the helper. The helper asks the operator (a TUI dialog, or the desktop's own password dialog via zenity/kdialog when the service has a display) and writes the answer to its stdout, where sudo reads it. The password never shows up in tool output, the transcript or a model request.
    • Two things we had to add. First, sudo -K before and after every mediated call, so a warmed timestamp can't be reused by a later command that never went through the prompt. Second, refusing background: true for these calls, because that cleanup has to run after the command exits. Matching the literal word sudo isn't enough either (command sudo, env X=1 sudo, eval, xargs and friends), so the wrapper tokenizes the command and refuses forms it can't rewrite safely.

    The same helper covers more of the list in this issue:

    • ssh, scp and ssh-add passphrases and passwords: SSH_ASKPASS plus SSH_ASKPASS_REQUIRE=force (OpenSSH 8.4+).
    • git over HTTPS: GIT_ASKPASS.

    What it can't cover is anything that only reads from a TTY and has no askpass hook, such as MFA or one-time-code prompts in most CLIs. That still needs the passthrough described here.

    Two smaller host gaps make the askpass route clumsier than it should be: the plugin prompt dialog has no masked input mode (#56747), and web/desktop have no plugin dialog at all (#43132), so on those clients the desktop password dialog is the only way to ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions