GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #64630

New issue
Copy link
New issue
Copy link
Done
#66795
#64718
Done
tui: popping a stashed Shell draft in Build mode submits it as a regular prompt#64630
#66795
#64718
Copy link
Labels
area/tuiTerminal interfaceplatform/windowsWindowsstatus/repro-simulatedReproduced with a simulated model or mocktype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@521ox
521ox
opened on Nov 18, 2026
Issue body actions

Description

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

  1. In an existing session, bind prompt.stash to F6 and prompt.stash.pop to F7 (test bindings, not defaults).
  2. Type !draft sample, check that the input says Shell, then press F6 to stash it.
  3. 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.

Activity

  1. opencodejr
    added
    area/tuiTerminal interface
    platform/windowsWindows
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 18, 2026
  2. opencodejr commented on Nov 18, 2026

    @opencodejr
    opencodejrBot
    on Nov 18, 2026
    Contributor
    More actions

    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:

    1. Bound prompt.stash to F6 and prompt.stash.pop to F7, then sent one message so the session existed.
    2. Typed !echo stash-sample. The input showed Shell.
    3. Pressed F6, Esc, F7. The text came back, but the input showed Build.
    4. 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.

  3. opencodejr
    added
    status/repro-simulatedReproduced with a simulated model or mock
    on Nov 18, 2026
  4. neriousy
    closed this as completedin #66795on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tuiTerminal interfaceplatform/windowsWindowsstatus/repro-simulatedReproduced with a simulated model or mocktype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.