Skip to content

feat(app): find in conversation (⌘F) with cross-session search handoff - #2477

Merged
benjaminshafii merged 1 commit into
devfrom
feat/in-chat-search
Jul 4, 2026
Merged

benjaminshafii merged 1 commit into
devfrom
feat/in-chat-search

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

Summary

Adds in-chat search ("Find in conversation") alongside the existing cross-session search, with a UX designed so the two features compose:

  • ⌘/Ctrl+F opens a floating find bar over the transcript (search icon, live N/M match counter, prev/next, close) — discoverable via a session-header button and a command palette entry too, not just the shortcut.
  • Live highlighting in both user bubbles and assistant prose; the active match gets a visibly distinct highlight and is scrolled into view.
  • Enter/Shift+Enter cycle matches with wrap-around; Esc closes and clears.
  • Cross-session search handoff: picking a message result from "Search sessions" (⌘⇧F) used to just drop you in the session. It now opens the session with the find bar prefilled and jumped straight to the exact matched message.

Bug found and fixed during validation

While driving the real app with fraimz, discovered highlights applied at mount were silently wiped ~35ms later — motion.div re-sets dangerouslySetInnerHTML on unrelated re-renders (e.g. open-target context settling), destroying the <mark> nodes without the highlight effect's dependencies changing. Fixed by re-applying highlights after every render (near-free fast path when no query is active). Also fixed a screenshot-caught overlap defect where the bar could cover the first message on short transcripts.

Known v1 scope

Code blocks, reasoning, and tool output aren't searched — v1 targets what the user reads (user bubbles + assistant prose), consistent with the existing cross-session search engine's scope.

Testing

  • pnpm typecheck ✓
  • pnpm --filter @openwork/app exec bun test tests/session-search.test.ts ✓ (new messageId coverage)
  • pnpm --filter @openwork/app build ✓
  • pnpm fraimz --flow in-chat-find ✓ — 6-frame user-facing proof (seed → ⌘F → highlight+counter → Enter → Esc → cross-session handoff), passed on a cold app boot and twice consecutively (idempotent)
  • pnpm fraimz --flow core-flow ✓ — canonical flow stays green (the markdown fix is inert for normal use)

fraimz proof incoming as a PR comment.

- SessionFindBar: floating find bar over the transcript with live match
  counter, prev/next (Enter/Shift+Enter) wrap-around navigation, Esc to
  close; opened via ⌘/Ctrl+F, a session-header button, or the command
  palette. Transcript gets top padding while open so the bar never covers
  the first message.
- Highlights: wires the dormant highlightQuery plumbing through
  MessageListProvider -> MessageContent -> MarkdownBlock for assistant
  prose, and adds a React-level mark renderer for user bubbles; active
  match gets a distinct stronger mark.
- fix(markdown): re-apply search highlights after every render — motion.div
  re-sets dangerouslySetInnerHTML on unrelated re-renders (e.g. open-target
  context updates), which silently wiped marks applied at mount.
- Cross-session search handoff: message results now carry messageId and,
  on selection, open the target session with the find bar prefilled and
  jumped to the exact matched message.
- fraimz: evals/flows/in-chat-find.flow.mjs (6 frames, user-facing) proving
  seed -> ⌘F -> highlight+counter -> Enter -> Esc -> cross-session handoff.
@vercel

vercel Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jul 4, 2026 2:18pm
openwork-den Ready Ready Preview, Comment Jul 4, 2026 2:18pm
openwork-den-worker-proxy Ready Ready Preview, Comment Jul 4, 2026 2:18pm
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 4, 2026 2:18pm

@benjaminshafii

Copy link
Copy Markdown
Member Author

fraimz — ✅ PASSED

1 passed · 0 failed · 0 skipped — run 2026-07-04T14-18-06-860Z

Full frame proof with validated screenshots: evals/results/2026-07-04T14-18-06-860Z/fraimz.html (re-run: pnpm fraimz --flow in-chat-find)

✅ in-chat-find — Find in conversation: ⌘F highlights, navigates, and receives cross-session handoff

User-facing flow demo

  • ✅ Visible text does not include "Something went wrong"
  • 📸 in-chat-find-01-seeded-zebra-conversation.png — 4 validations passed

in-chat-find-01-seeded-zebra-conversation.png

  1. The flow creates a fresh conversation where 'zebra' appears in both the user's message and the assistant's visible prose.

    • 📸 in-chat-find-02-find-bar-open-focused.png — 3 validations passed
    in-chat-find-02-find-bar-open-focused.png
  2. Cmd/Ctrl+F opens Find in conversation, focuses its input, and the header exposes the same feature as an always-visible button.

    • 📸 in-chat-find-03-find-zebra-highlighted.png — 4 validations passed
    in-chat-find-03-find-zebra-highlighted.png
  3. Typing 'zebra' highlights the user bubble and assistant prose, marks one result active, and shows a live 1/N counter.

    • 📸 in-chat-find-04-find-enter-next-match.png — 4 validations passed
    in-chat-find-04-find-enter-next-match.png
  4. Pressing Enter advances from 1/N to 2/N while keeping exactly one active highlighted match.

    • 📸 in-chat-find-05-find-closed-cleared.png — 4 validations passed
    in-chat-find-05-find-closed-cleared.png
  5. Pressing Escape closes the find bar and removes all search highlight marks from the transcript.

    • 📸 in-chat-find-06-cross-session-handoff-to-find.png — 4 validations passed
    in-chat-find-06-cross-session-handoff-to-find.png
  6. Selecting the zebra message result from cross-session search returns to the seeded conversation, opens Find in conversation with the query, and activates the user-message match.

@benjaminshafii
benjaminshafii merged commit 88b7d49 into dev Jul 4, 2026
8 of 10 checks passed
@benjaminshafii

Copy link
Copy Markdown
Member Author

fraimz — ✅ PASSED

1 passed · 0 failed · 0 skipped — run 2026-07-04T14-19-15-871Z

Full frame proof with validated screenshots: evals/results/2026-07-04T14-19-15-871Z/fraimz.html (re-run: pnpm fraimz --flow core-flow)

✅ core-flow — Open app, send a message, get a response, reopen with session intact

  • 📸 core-flow-01-booted.png — 4 validations passed

core-flow-01-booted.png

  1. App boots clean to a known route

    • 📸 core-flow-02-session-created.png — 3 validations passed
    core-flow-02-session-created.png
  2. A new session is created and becomes active

    • ✅ Visible text does not include "Something went wrong"
    • 📸 core-flow-03-task-response.png — 4 validations passed
    core-flow-03-task-response.png
  3. The composer accepts a message and the agent responds

    • 📸 core-flow-04-reopened-session.png — 4 validations passed
    core-flow-04-reopened-session.png
  4. Reopening restores the session and its message history

This branch was successfully deployed

4 active deployments
Preview – openwork-den-worker-proxy — b2376087 Deployed Jul 4, 2026 by vercel[bot]
Preview – openwork-landing — b2376087 Deployed Jul 4, 2026 by vercel[bot]
Preview – openwork-den — b2376087 Deployed Jul 4, 2026 by vercel[bot]
Preview – openwork-app — b2376087 Deployed Jul 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant