-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Description
Problem
The Bash tool currently runs with stdio: ["ignore", "pipe", "pipe"], meaning stdin is disconnected. This breaks any command requiring interactive password input:
sudo apt install ...ansible-playbook -K ...(ask-become-pass)ssh -t user@host "sudo ..."- GPG passphrase prompts
Users working with system administration, deployment automation, or remote servers cannot use these common workflows through OpenCode.
Proposed Approach
Use PTY-based execution for commands that may require interactive input:
- Auto-detect interactive commands - Pattern match for
sudo,ssh -t,ansible -K, etc. - PTY execution - Spawn an ephemeral PTY for interactive commands
- Prompt detection - Detect password prompts via patterns (
[sudo] password for,Password:,BECOME password:, etc.) - SecureInput system - Event-based system that requests password from user when prompt detected
- Direct PTY write - Password goes directly to PTY, never stored or logged
- Output sanitization - Replace password prompts with
[Password prompt - user input required]before sending to LLM
Security considerations
- Password never logged or stored in memory beyond immediate use
- Password never appears in conversation history or LLM context
- UI uses
type="password"input - 60s timeout, max 3 retry attempts
Why it belongs in OpenCode
This is a common pain point for DevOps/sysadmin workflows. The PTY infrastructure already exists for the terminal feature, so this leverages existing code. It's also how Claude Code handles similar scenarios.
Happy to share implementation details if there's interest.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels