You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI: prompt history recall (Up) silently does nothing while the composer has text #45209
packages/tui/src/prompt/history.tsx:69-84 — pressing Up to recall a previous
prompt is a dead key whenever the composer contains any text:
move(direction: 1|-1,input: string){if(!store.history.length)returnundefinedconstcurrent=store.history.at(store.index)if(!current)returnundefinedif(current.input!==input&&input.length)return// ← bails here
In this module index === 0 means the live draft slot (append() resets to 0,
and store.index === 0 returning {input: "", parts: []} on line 82 confirms
it); negative indices address real entries from the end. But history.at(0) on
line 71 reads the array element — the oldest retained entry — not the draft.
So on the first Up press from a non-empty draft, the guard compares your typed
text against an entry from up to 50 prompts ago, never matches, and returns.
Nothing is recalled and there is no feedback.
Recall from an empty input works, which makes the failure look intermittent.
Two more things that suggest this isn't intentional:
Once you've recalled an entry and edited it, Down is now dead too (same guard, at(index) no longer matches the edited text) — you can't even get back to
your draft. A coherent "don't clobber my draft" design wouldn't trap you there.
The guard shipped wholesale in the OpenTUI migration commit (96bdeb3c7b, opentui #2685) and was never touched since; no test covers move(), and every major
shell allows Up with a non-empty input.
Is this guard intentional? If not, happy to send a small PR — skip the
comparison when store.index === 0 (nothing is being displayed yet), which also
unfreezes the edited-recall case above.
Plugins
No response
OpenCode version
dev + manually reproduced
Steps to reproduce
Submit any prompt once so ~/.local/share/opencode/prompt-history.jsonl has an entry
Open the TUI, type anything into the composer, e.g. git p
Press Up twice (first press just moves the cursor to column 0, see component/prompt/index.tsx:875; the second invokes history.move)
Nothing happens. Now clear the input and press Up — the last entry recalls fine
Activity
simonklee commentedon Aug 26, 2026
I think this is fixed in https://opencode.ai/v2/docs which we're working on releasing ASAP. Please re-open if you still have issue there.