The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): sidebar search results no longer show raw >>>term<<< FTS markers
Teknium20059cbc6993
diff --git a/apps/desktop/src/app/chat/sidebar/index.tsx b/apps/desktop/src/app/chat/sidebar/index.tsxindex d36903a5eef..868b1167083 100644--- a/apps/desktop/src/app/chat/sidebar/index.tsx+++ b/apps/desktop/src/app/chat/sidebar/index.tsx@@ -257,6 +257,16 @@ const HEADER_NAV_BTN =// FTS results cover sessions that aren't in the loaded page; synthesize a// minimal SessionInfo so they render in the same row component (resume works// by id; the snippet stands in for the preview).++// The backend's FTS layer wraps matched terms in literal '>>>' / '<<<'+// highlight markers (sqlite snippet() delimiters — see hermes_state_search.py).+// The sidebar renders the snippet as plain text, so the markers must be+// stripped or a search for "foo" paints rows titled ">>>foo<<<".+// Exported for tests.+export function stripFtsMarkers(snippet: string): string {+ return snippet.replaceAll('>>>', '').replaceAll('<<<', '')+}+function searchResultToSession(result: SessionSearchResult): SessionInfo {const ts = result.session_started ?? Date.now() / 1000@@ -272,7 +282,7 @@ function searchResultToSession(result: SessionSearchResult): SessionInfo {message_count: 0,model: result.model ?? null,output_tokens: 0,- preview: result.snippet?.trim() || null,+ preview: stripFtsMarkers(result.snippet ?? '').trim() || null,source: result.source ?? null,started_at: ts,title: null,diff --git a/apps/desktop/src/app/chat/sidebar/strip-fts-markers.test.ts b/apps/desktop/src/app/chat/sidebar/strip-fts-markers.test.tsnew file mode 100644index 00000000000..1b33c7bc45e--- /dev/null+++ b/apps/desktop/src/app/chat/sidebar/strip-fts-markers.test.ts@@ -0,0 +1,27 @@+// Regression: the backend's session-search FTS layer wraps matched terms in+// literal '>>>' / '<<<' snippet() delimiters (hermes_state_search.py). The+// sidebar paints the snippet as plain text, so an unstripped marker renders+// rows titled ">>>foo<<<" (Aug 2026 desktop audit).+import { describe, expect, it } from 'vitest'++import { stripFtsMarkers } from './index'++describe('stripFtsMarkers', () => {+ it('strips highlight markers around the matched term', () => {+ expect(stripFtsMarkers('...replied with >>>MARCO<<< and nothing else...')).toBe(+ '...replied with MARCO and nothing else...'+ )+ })++ it('strips multiple marked terms', () => {+ expect(stripFtsMarkers('>>>alpha<<< then >>>beta<<<')).toBe('alpha then beta')+ })++ it('leaves marker-free snippets untouched', () => {+ expect(stripFtsMarkers('plain snippet text')).toBe('plain snippet text')+ })++ it('handles empty string', () => {+ expect(stripFtsMarkers('')).toBe('')+ })+})