#20211: feat(webchat): add search UI for chat history
app: web-ui
gateway
size: L
## Summary
Closes #19725
Add a search bar to the web chat UI for searching through chat message history. Builds on the `chat.search` gateway method from PR #19722.
- **Search toggle** — magnifying glass icon in chat controls toolbar toggles the search panel
- **Search bar** — text input with Enter-to-search, Escape-to-close
- **Results panel** — displays matches with role and snippet, match count
- **Backend included** — cherry-picks the `chat.search` backend from #19722 (with review fixes)
## Changes
### UI
- `views/chat.ts` — search bar component with input, results list, empty state
- `app-render.helpers.ts` — search toggle button in chat controls toolbar
- `app-render.ts` — wire search props and `searchChatHistory()` calls
- `app.ts` / `app-view-state.ts` — `chatSearchOpen`, `chatSearchQuery`, `chatSearchResults`, `chatSearchLoading` state
- `styles/chat/layout.css` — search bar and results panel styling
### Backend (cherry-picked from #19722)
- `chat.search` gateway method with `searchSessionTranscript()` helper
- `searchContent` param for `sessions.list` cross-session content search
- Compaction index alignment fix and sessionFile/agentId passthrough fix
## Test plan
- [x] `pnpm test -- --run src/gateway/session-utils.fs.test.ts` — 52 tests pass
- [x] `pnpm test -- --run src/gateway/session-utils.test.ts` — 39 tests pass
- [x] `npx tsc --noEmit` — clean type check
- [ ] CI checks on upstream
## Note on pagination interaction
`chat.search` reads the full JSONL transcript server-side, finding matches across the entire session regardless of what the client has loaded. A future improvement could add "jump to result" by coordinating with cursor-based pagination (#19754).
## AI-assisted
This PR was developed with AI assistance (Opus 4.6). All changes have been reviewed and tested.
---
🤖 [Tackled](https://github.com/aleiby/claude-skills/tree/main/tackle) with [Claude Code](https://claude.com/claude-code)
Most Similar PRs
#19722: feat(chat): add search functionality for chat history
by aleiby · 2026-02-18
81.7%
#19754: feat(webchat): add cursor-based pagination to chat.history
by aleiby · 2026-02-18
74.6%
#22798: feat(webchat): ChatGPT-style multi-chat threads with generated titles
by opnsec · 2026-02-21
70.9%
#14966: fix(webchat): preserve user message visibility after chat.send
by BenediktSchackenberg · 2026-02-12
69.4%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
67.4%
#11711: feat(webui): add terminal-style input history navigation
by stephenschoettler · 2026-02-08
67.3%
#8334: fix(webchat): Filter NO_REPLY messages from chat history
by vishaltandale00 · 2026-02-03
66.6%
#21693: feat(gateway): expose session entry id on chat history messages
by tlxue · 2026-02-20
66.1%
#7522: fix(webchat): auto-scroll when message queue changes
by alsoknownasfoo · 2026-02-02
66.1%
#11889: fix(chat): filter HEARTBEAT_OK messages in chat.history when showOk...
by bendyclaw · 2026-02-08
65.6%