GeezerVison is showing github.com — tui: popping a stashed Shell draft in Build mode submits it as a regular prompt · Issue #64630 · anomalyco/opencode
tui: popping a stashed Shell draft in Build mode submits it as a regular prompt #64630DescriptionDescription
After stashing a Shell draft and switching back to Build, Stash pop restores the text but not its input mode. Enter submits the restored text as a regular prompt. I would expect a restored draft to keep its original destination, as it does when returning from prompt history (#63262).
Steps to reproduce
- In an existing session, bind
prompt.stash to F6 and prompt.stash.pop to F7 (test bindings, not defaults).
- Type
!draft sample, check that the input says Shell, then press F6 to stash it.
- Press Esc to return to Build, then F7.
draft sample comes back without the Shell indicator.
With the actual TUI and a local fixture intercepting submission, Enter sent the restored text to /prompt in 3/3 fresh runs. Skipping only Esc sent the same text to /shell in 3/3 controls. No command ran and no model was contacted. This is explicit stash/pop, not Up/Down history navigation.
OpenCode version
V2 dev at 22377659a8ed223f3eebc86660dd1a5bc2b33ca5 (2.3.0).
Operating System
Windows 11 x64, Bun 1.4.4.
Terminal
OpenTUI test renderer; no third-party plugins. Activityopencodejr commented on Nov 18, 2026 Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the detailed report. I reproduced it on 2.3.0, and it still happens on the latest dev (d412042be).
What I did, with the TUI driven by a test harness and a simulated model:
- Bound
prompt.stash to F6 and prompt.stash.pop to F7, then sent one message so the session existed.
- Typed
!echo stash-sample. The input showed Shell.
- Pressed F6, Esc, F7. The text came back, but the input showed Build.
- Pressed Enter. The text went to the model as a regular prompt; it was not run as a shell command.
The recording, screenshots and script below show this. Because a simulated model stood in for a real one, this is not a check against a real provider, but the mode is already lost in the TUI before any request is sent.
Looking at the code, the stash saves only the prompt text and parts, not the input mode. Pop and the stash list then restore the text without setting the mode. Prompt history does restore the mode, which is what #63262 relies on.
recording.mp4
Reproduction script (drive.ts)
// Repro for anomalyco/opencode#64630: a stashed Shell draft popped in Build mode
// loses Shell mode and is sent to the model as a regular prompt.
import { Effect, Stream } from "effect"
import { Llm, OpenCodeDriver } from "opencode-drive"
export default OpenCodeDriver.use(
{
...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
tui: { recording: true, keypressOverlay: true },
tuiConfig: { keybinds: { "prompt.stash": "f6", "prompt.stash.pop": "f7" } },
project: { git: true, files: { "README.md": "repro\n" } },
},
({ ui, llm }) =>
Effect.gen(function* () {
let requests = 0
yield* llm.title(() => Effect.succeed("Stash repro"))
yield* llm.serve(() => {
requests++
return Stream.make(Llm.text(`Model reply #${requests}`))
})
// 1. existing session
yield* ui.submit("hello")
yield* ui.waitFor("Model reply #1")
const before = requests
// 2. type a shell draft and stash it
yield* ui.type("!")
yield* ui.type("echo stash-sample")
yield* Effect.sleep(500)
yield* ui.screenshot("1-shell-draft")
yield* ui.press("f6")
yield* Effect.sleep(500)
yield* ui.screenshot("2-after-stash")
// 3. back to Build, pop
yield* ui.press("escape")
yield* Effect.sleep(500)
yield* ui.press("f7")
yield* Effect.sleep(500)
yield* ui.screenshot("3-after-pop")
// 4. submit
yield* ui.enter()
yield* Effect.sleep(3000)
yield* ui.screenshot("4-after-enter")
const frame = yield* ui.capture()
yield* Effect.log(`model requests after enter: ${requests - before}`)
yield* Effect.log(`popped draft reached the model: ${JSON.stringify(frame).includes("Model reply #2")}`)
}),
)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|