Repository navigation
Backlog
Labels
area/tuiTerminal interfaceplatform/windowsWindowsreproducedtype/bugSomething is brokenversion/v2OpenCode 2.x
Description
Summary
After upgrading from 1.19.0 to 2.4.2, the TUI /sessions dialog loses two pin behaviors that 1.x had: pinned sessions outside the current page of results no longer appear (with their quick-switch numbers), and pressing ctrl+f (session.pin.toggle) no longer moves the cursor with the pinned row.
Environment
- opencode version: 2.4.2 (upgraded from 1.19.0,
opencode-ai->@opencode/cli) - Client: TUI
- Model and provider: Not relevant
- OS: Windows 11 (Windows_NT 10.0.26200, x64)
- Terminal: herdr (
HERDR_ENV=1, sotabs.mode: autoresolves to tabs off and the Pinned group is active) - Shell: cmd.exe
- Install/channel: npm global, latest
- Active plugins: no CLI plugins in
cli.json; two local server plugins that only report session state to herdr
Reproduction
A. Pinned sessions disappear
- Pin sessions in several directories (in 1.x or 2.x).
~/.local/state/opencode/session.jsonhas 12 entries. - Open
/sessionsin one project directory. - Only the 4 pinned sessions that belong to the current directory appear under Pinned. The other 8 (other directories) are gone, along with their 1-9 quick-switch numbers.
ctrl+a(all projects) makes it worse: the list is the 50 most recent sessions across all projects, so only 2 of the 12 pins appear (the others rank 56 to 587 by update time).
B. Cursor does not follow the pinned row
- Open
/sessionsand move the cursor to an unpinned session lower in the list. - Press
ctrl+f. - The session moves into Pinned at the top, but the cursor stays on the same row index, now on a different session. Pressing
ctrl+fagain unpins/pins whatever is under the cursor.
Expected Behavior
As in 1.19.x:
- A. Pinned sessions are always listed under Pinned regardless of the list scope or page limit (1.x appended pinned IDs from synced data as
extrawhen they were not in the query result). - B. After pin/unpin the selection follows the toggled session (1.x passed
preserveSelection={true}).
Actual Behavior
In packages/tui/src/component/dialog-session-list.tsx at v2.4.2:
pinned = local.session.pinned().filter((id) => sessionMap.has(id)), andsessionMaponly contains the current search/list result (limit: 50, current directory unlessctrl+a). Pins outside that set are dropped.local.session.slots()similarly only keeps pins present indata.session.list().DialogSelectis rendered withfocusCurrent={false}and withoutpreserveSelection, so theprops.optionseffect inui/dialog-select.tsxtakes thereconcileSelection(store.selected, count)path and keeps the index instead of the value.
Additional Context
- Related: V2 TUI: add fast session overview and pinned session shortcuts #36193 (V2 TUI pinned session shortcuts), [FEATURE]: show pinned sessions in the session list when tabs are enabled #60236 (pinned sessions when tabs are enabled). This report is about the tabs-off path, where the Pinned group still exists.
- No workaround found for A or B.
- Pin state in
session.jsonsurvived the upgrade intact; this is display/selection only.
Metadata
Metadata
Assignees
Labels
area/tuiTerminal interfaceplatform/windowsWindowsreproducedtype/bugSomething is brokenversion/v2OpenCode 2.x
Activity
opencodejr commentedon Nov 26, 2026
Thanks for the detailed report. I reproduced the cursor problem (part B) on 2.4.2 with tabs off:
ctrl+f.ctrl+fagain pinned session-C instead of unpinning session-B.It still happens on the latest
dev(44344bd). The recording and screenshots below show it, and the script below reproduces it.I did not run part A (pins outside the loaded page or from other directories) here. It is tracked in #60236, which has PR #60237 open; #64337 (the same report on 2.2.6) was closed as a duplicate of it. Open PR #64339 also restores older pins, but only those in the selected scope, so pins from other directories would still be hidden in the current-directory view.
https://anoma.ly/team/github-bot/media/1de7e20ed43c2bfc08e822f24793efebd9325ced63390eb2bcbb6c614d550448.mp4
Reproduction script (drive.ts)
Run it with opencode-drive:
opencode-drive run ./drive.ts. It drivesopencodefrom yourPATH; setOC_DEVto the path of an OpenCode checkout to run that from source instead.troy818 commentedon Nov 26, 2026
Follow-up: after restarting the TUI (tabs off, pins in the current directory present in the list), no pinned session shows a quick-switch number at all, and
<leader>1..<leader>9do nothing.Cause, as far as I can tell from v2.4.2 source:
local.session.slots()(packages/tui/src/context/local.tsx) keeps only pins that are present indata.session.list().data.session.list()(packages/client/src/solid/data.ts) isObject.values(store.session.info), andstore.session.infois only filled bysession.sync(id)/remember(info)/ events, i.e. sessions that were opened, created, or seen running during this TUI run. The/sessionsdialog'sapi.session.listresult is never written into that store.slots()is empty: no gutter numbers, noswitchfooter hint, and the quick-switch commands resolve to nothing. In 1.19,sync.data.sessionheld the listed sessions, so every pin got a slot.Expected: slots are derived from the pin list itself (the first 9 pins), with pinned sessions fetched by ID when not loaded, so numbers are stable across restarts and directories.
LyleLiu666 commentedon Nov 26, 2026
I tested #64339 and #60237 on the same dev baseline. #64339 restores older pins in the selected scope, and #60237 shows the Pinned group with tabs enabled and loads saved pins when the picker opens.
The second Ctrl+F still toggles a different session in both. Neither restores the number shortcut directly from Home after restart. This tested patch covers those two paths. Would a separate follow-up for them be useful?
Guembri01 commentedon Nov 27, 2026
Fixed the first half, and verified the second is already working.
Pinned sessions outside the page.
/sessionsbuilt Pinned only from the query result:so a pin outside the
/api/sessionpage disappeared — other directories with the directory scope, and anything past the 50-result page with all projects on, which is the 8 of 12 you saw. A pin the query did not return is now taken from the synced store (data.session.get), and is still dropped when a search is active and it does not match.Cursor after
ctrl+f. That is covered by the existingpin toggle keeps the cursor on the toggled sessiontest indialog-session-list-actions.test.tsx, and it passes on currentdev:DialogSelectre-finds the selected row by value when the options reorder, so the cursor lands on the toggled session. Nothing needed changing for it.The new test seeds
session.jsonwith a pin whose session the page does not return and asserts the row renders: with the component reverted the frame never contains it (times out); with the change it sits above the page's session. The two dialog test files are 5 pass, 0 fail, andpackages/tuitypechecks.Branch
session-list-pinned-pageatbccda28is pushed with the body written. PR creation is returning 404 for this account again (one PR did open earlier today), so it waits as a branch.