opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[BUG]: desktop 2.4.1: Ctrl+F does nothing in the conversation, and the Find command is hidden from the palette

Open magicprinc opened this issue 1 week ago • 6 comments

Description

Pressing Ctrl+F in a session does nothing at all: no Find bar, no highlight, no focus change. The menu has no Find item either — it lists Copy, Paste and the usual edit actions — and the Ctrl+K palette lists no in-conversation search. The only search it offers is Search sessions, which searches the session list, not the open conversation.

Steps to reproduce

  1. Open the Desktop app 2.4.1 on Windows and open a session that has messages.
  2. Press Ctrl+F, first with the caret in the composer and then with the timeline focused. Tried with both the Russian and the English keyboard layout — same result.
  3. Nothing opens, nothing is searched.

Expected behavior

The conversation Find bar opens, as it does on the dev branch: session.search is registered there with keybind: "mod+f".

Actual behavior

Nothing happens, and there is no second way in: the command is hidden from the palette and absent from the menu.

Additional context

The feature does ship in this build — resources/app.asar of the installed 2.4.1 contains session.search, session.search.placeholder, session.search.noResults and mod+f. In the sources it is registered as:

command.register("session.search", () => [
  {
    id: "session.search",
    title: controller.query.placeholder(),
    keybind: "mod+f",
    hidden: true,
    onSelect: controller.query.open,
  },
])

(packages/app/src/session/timeline/search-controller.ts)

Two things worth checking, both of which would make the keybind do nothing while leaving the feature unreachable:

  1. The command id is not unique. The home screen's session search registers the same id with the same keybind (home.search → { id: "session.search", title: "session.search.placeholder", keybind: "mod+f", hidden: true }), and settings search adds a third mod+f (settings.search.focus). The registry is keyed by id — optionMap in packages/app/src/shell/commands/command.tsx does map.set(option.id, option), so one owner shadows another and the surviving handler can belong to a screen that is not mounted.
  2. hidden: true leaves no fallback. Since the command never appears in the palette, a failing keybind makes the feature unreachable by every route. The menu does not help either: there is no Find item in it, and the shipped app.asar contains no Ctrl+F accelerator, so nothing outside the renderer's keymap can open it.

The keyboard layout is ruled out: the result is identical with the Russian and with the English layout active. The sources agree — keymap.ts takes letters from event.code (physicalKey), so the shortcut is layout-independent since #55676 — which leaves the dispatch path as the suspect rather than the key itself.

Two asks: fix the binding, and make the command discoverable — a visible palette entry (or a Find item in the Edit/View menu) next to whatever fixes the collision, so the feature cannot be silently unreachable again.

Beyond the fix: content search across sessions

Separate from the bug above, and easy to split into its own issue if that is cleaner: the app has no way to answer "in which sessions did the word OpenCode appear". The palette's Search sessions matches only the session label and the project name (packages/app/src/home/sessions/search.ts filters on ${sessionLabel} · ${projectName}), so it searches names, not what was said.

The corpus for this already exists. The sqlite_fts flag builds an SQLite full-text index of session titles and message text in the background and enables the opencode.session.search and opencode.session.read tools (packages/schema/src/config/flag.ts). Today that index is reachable only by the agent, and only with the flag on — not by the person using the app.

What I would like, in priority order:

  1. A search over all sessions that returns the matching session, the message it appears in, and a way to jump there — the same result shape the conversation Find already navigates.
  2. The same options as the conversation Find (case sensitive, whole word, and regex where it is cheap), so the two searches do not behave differently.
  3. A clear hint when the full-text index is off, with the option to enable it there and then, instead of silently scanning only recent sessions.
  4. Even without the index, a bounded scan of recent sessions would already answer most of these queries — worth having as the fallback rather than nothing at all.

OpenCode version

Desktop app 2.4.1 (bundled CLI 2.4.1)

Operating System

Windows 10 (build 19045) x64

Terminal

n/a — desktop app

Plugins

opencode-history, opencode-github-panel, opencode-turn-markers

magicprinc avatar Nov 24 '26 02:11 magicprinc

Thanks for the detailed report. I couldn't reproduce this here: it needs the Windows desktop app, and my environment can't run it, so a maintainer with that setup will need to check it.

What I found in the code, without being able to confirm it by running the app:

  • The conversation Find (session/timeline/search-controller.ts) and the Home session search (home/sessions/search.ts) do register the same command id, session.search, on mod+f. The command registry keeps only the first registration of a duplicate id.
  • Home and the session view are separate routes, though, so normally only one of them registers at a time. The collision would only explain this if Home's registration is still active after a session opens.

One thing that would help narrow it down: does Ctrl+F still do nothing with your plugins (opencode-history, opencode-github-panel, opencode-turn-markers) disabled? A plugin taking that shortcut would cause the same symptom.

Related: #64062 (the conversation Find hangs when the query shrinks to 2 characters on Windows, so Find does open for some users) and #55676 (shortcuts on non-Latin layouts). The cross-session content search you describe is tracked in #60995 and #54863.

opencodejr[bot] avatar Nov 24 '26 02:11 opencodejr[bot]

I would like to investigate this on Windows. I will try to reproduce Ctrl+F and the missing Find command with plugins disabled, then check whether the Home search registration is still active after opening a session. Could a maintainer assign this to me?

KhadeerBasha1232 avatar Nov 24 '26 08:11 KhadeerBasha1232

I went looking for this in dev and can only explain half of it there, so here is what I found rather than a patch.

What the source says. packages/app/src/session/timeline/search-controller.ts:120-128 is the registration you quoted, unchanged:

command.register("session.search", () => [
  { id: "session.search", title: controller.query.placeholder(), keybind: "mod+f", hidden: true, onSelect: controller.query.open },
])

hidden: true is exactly why the command is absent from the palette and the menu — that part is by design, not a broken wiring. It is registered from the session screen (packages/app/src/session/screen.tsx:41 → createTimelineSearchController), so it exists whenever a conversation is mounted.

What that does not explain. If the command is registered, mod+f should still fire; hidden gates discovery, not firing. So on dev, where you say the bar opens, the chain works end to end, and the difference is the 2.4.1 build rather than this file.

That makes this a version-skew report unless it still reproduces on a current build. Two things would tell us which:

  1. On the latest desktop build, does mod+f open the Find bar, and does it still do nothing in 2.4.1 when you reinstall 2.4.1? If 2.4.1 fails and the current build works, it is fixed already and only needed a release.
  2. If the current build still fails, the seam is the command layer's keybind handling for dynamically registered commands (command.register(id, () => [...]), as opposed to a static list) — because the same mod+f also appears on home/sessions/search.ts:149 and settings/search.tsx:54, and the session screen's copy is the only dynamic one. A capture of document.activeElement and the pressed key when it fails would settle it.

One separate thing that is a source-level gap, independent of the keybind: with hidden: true there is no discoverable way in — no palette row, no menu item — so someone who does not know the shortcut has no Find at all. If a maintainer wants that changed, the fix is one flag plus a palette test; I did not change it because visibility is a product decision, not a bug fix.

Guembri01 avatar Nov 24 '26 21:11 Guembri01

Suddenly after restart (npm update -g) it works 🤷‍♀️

image

PS: but still search can be more reach than this

image

magicprinc avatar Nov 24 '26 21:11 magicprinc

still not in any menu

image image

magicprinc avatar Nov 24 '26 21:11 magicprinc

Glad Ctrl+F works after updating. What's left is that Find isn't in the palette or menu, because session.search is registered with hidden: true. If maintainers want it discoverable, I can unhide it and add a menu entry. Otherwise I'll leave this one.

KhadeerBasha1232 avatar Nov 25 '26 04:11 KhadeerBasha1232