GeezerVison is showing github.com — tui: /sessions drops pinned sessions outside the listed page and Ctrl+F no longer follows the pinned row · Issue #66534 · anomalyco/opencode
tui: /sessions drops pinned sessions outside the listed page and Ctrl+F no longer follows the pinned row #66534DescriptionSummary
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, so tabs.mode: auto resolves 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.json has 12 entries.
- Open
/sessions in 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
/sessions and 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+f again 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
extra when 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)), and sessionMap only contains the current search/list result (limit: 50, current directory unless ctrl+a). Pins outside that set are dropped. local.session.slots() similarly only keeps pins present in data.session.list().
DialogSelect is rendered with focusCurrent={false} and without preserveSelection, so the props.options effect in ui/dialog-select.tsx takes the reconcileSelection(store.selected, count) path and keeps the index instead of the value.
Additional Context
Activityopencodejr commented on Nov 26, 2026 Thanks for the detailed report. I reproduced the cursor problem (part B) on 2.4.2 with tabs off:
- With five sessions listed (E, D, C, B, A), I moved the cursor to session-B and pressed
ctrl+f.
- session-B moved under Pinned, but the highlight stayed on the 4th row, which was now session-C.
- Pressing
ctrl+f again 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)
// Reproduces anomalyco/opencode#66534 (part B): after ctrl+f (pin) in /sessions,
// the cursor stays on the same row index instead of following the pinned session.
import { Effect } from "effect"
import { OpenCodeDriver } from "opencode-drive"
const TITLES = ["session-A", "session-B", "session-C", "session-D", "session-E"]
export default OpenCodeDriver.use(
{
...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
tuiConfig: { tabs: { mode: "off" } },
tui: { recording: true, keypressOverlay: true, viewport: { cols: 140, rows: 40 } },
} as any,
({ ui, opencode }) =>
Effect.gen(function* () {
for (const title of TITLES) {
yield* opencode.session.create({ title })
yield* Effect.sleep(100)
}
yield* Effect.sleep(3000)
yield* ui.screenshot("0-home")
yield* ui.type("/sessions")
yield* Effect.sleep(500)
yield* ui.screenshot("0b-typed")
yield* ui.enter()
yield* Effect.sleep(1500)
yield* ui.screenshot("0c-after-enter")
yield* ui.waitFor("Search sessions", { timeout: 15000 } as any)
yield* Effect.sleep(800)
if (yield* ui.matches("Search sessions in")) yield* ui.press("a", { ctrl: true })
yield* ui.waitFor("session-A")
yield* Effect.sleep(800)
yield* ui.screenshot("1-list")
// Move the cursor down to the 4th row (session-B, list is newest first: E D C B A)
for (let i = 0; i < 3; i++) {
yield* ui.arrow("down")
yield* Effect.sleep(200)
}
yield* Effect.sleep(500)
yield* ui.screenshot("2-cursor-on-session-B")
// Pin it
yield* ui.press("f", { ctrl: true })
yield* Effect.sleep(1000)
yield* ui.screenshot("3-after-pin")
// Press ctrl+f again: if the cursor followed, this unpins session-B.
yield* ui.press("f", { ctrl: true })
yield* Effect.sleep(1000)
yield* ui.screenshot("4-after-second-ctrl-f")
yield* Effect.sleep(500)
}),
)
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.
troy818 commented on 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>9 do 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 in data.session.list().
data.session.list() (packages/client/src/solid/data.ts) is Object.values(store.session.info), and store.session.info is only filled by session.sync(id) / remember(info) / events, i.e. sessions that were opened, created, or seen running during this TUI run. The /sessions dialog's api.session.list result is never written into that store.
- So on a fresh start, unless a pinned session was opened in this run,
slots() is empty: no gutter numbers, no switch footer hint, and the quick-switch commands resolve to nothing. In 1.19, sync.data.session held 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 commented on 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 commented on Nov 27, 2026 Fixed the first half, and verified the second is already working.
Pinned sessions outside the page. /sessions built Pinned only from the query result:
const pinned = sessionTabs.enabled() ? [] : local.session.pinned().filter((sessionID) => sessionMap.has(sessionID))
so a pin outside the /api/session page 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 existing pin toggle keeps the cursor on the toggled session test in dialog-session-list-actions.test.tsx, and it passes on current dev: DialogSelect re-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.json with 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, and packages/tui typechecks.
Branch session-list-pinned-page at bccda28 is 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.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|