opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Shell commands are broken in message history and in `opencode run`

Open jdanbrown opened this issue 1 month ago • 3 comments

Description

Bug 1: Shell commands are broken in message history

  • Send message !date → observe that ! changes the input box into "Shell" mode, and then date is input into the box and run as a shell command (correct)
  • Press up to recall your last message → date is recalled into the input box, but it isn't switched into Shell mode, so when you send it it's incorrectly sent as a message to the model instead of as a command to the shell

Bug 2: Shell commands are broken in opencode run

  • opencode run '!date' → sends the string !date to the model instead of running date as a shell command

Is the fancy switch into Shell mode actually worthwhile, or would it be better overall to remove that and just interpret messages that start with ! as shell commands? That would be one way to fix both of these issues by doing less, as well as any potential other issues that might be lurking.

OpenCode version

1.0.150

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 15.5

Terminal

VS Code terminal

jdanbrown avatar Dec 12 '25 20:12 jdanbrown

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

  • #2006: Shell commands are not stored in message history (directly addresses the message history recall problem)
  • #5310: Shell mode (! command) doesn't work on Windows (related shell command execution issues)
  • #4671: shell mode (!) is broken on Windows Powershell (Windows-specific shell execution)
  • #3213: opencode run and TUI exits hang on v0.15+ (related to opencode run command issues)
  • #4968: Shell sessions losing $PATH value from parent shell (environment inheritance for shell commands)
  • #2202: PATH is not inherited from invoking shell (similar environment inheritance issue)

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

github-actions[bot] avatar Dec 12 '25 20:12 github-actions[bot]

Yeah run doesn't support shell mode, not sure how that'd work either since it just loads things into context, it doesn't trigger inference

rekram1-node avatar Dec 12 '25 20:12 rekram1-node

The other part is a bug tho

rekram1-node avatar Dec 12 '25 20:12 rekram1-node

Thanks! Confirmed working in 1.0.159.

jdanbrown avatar Dec 15 '25 23:12 jdanbrown