Skip to content

Commit 6207636

Browse files
roboclaw-botVACInc
andcommitted
fix(ui): distinguish incomplete transcript results
Co-authored-by: VACInc <[email protected]>
1 parent 32ce8cc commit 6207636

3 files changed

Lines changed: 43 additions & 9 deletions

File tree

‎ui/src/components/command-palette.test.ts‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,30 @@ describe("CommandPalette lifecycle", () => {
339339
{ state: "truncated", response: { truncated: true } },
340340
])("shows a partial-search notice when transcript results are $state", async ({ response }) => {
341341
const metadata = createSessionResult("agent:main:metadata", "Needle planning");
342-
const list = vi.fn<ApplicationContext<RouteId>["sessions"]["list"]>(async () => metadata);
343-
const request = vi.fn(async () => ({ results: [], ...response }));
342+
const contextOnly = createSessionResult("agent:main:context", "Unrelated title");
343+
const roster = {
344+
...metadata,
345+
count: 2,
346+
totalCount: 2,
347+
sessions: [...metadata.sessions, ...contextOnly.sessions],
348+
} as SessionsListResult;
349+
const list = vi.fn<ApplicationContext<RouteId>["sessions"]["list"]>(async (options) =>
350+
options?.search ? metadata : roster,
351+
);
352+
const request = vi.fn(async () => ({
353+
results: [
354+
{
355+
sessionKey: "agent:main:context",
356+
sessionId: "context",
357+
messageId: "message-context",
358+
role: "assistant" as const,
359+
timestamp: 42,
360+
snippet: "The needle also appears in this transcript.",
361+
score: 10,
362+
},
363+
],
364+
...response,
365+
}));
344366
const { gateway } = createGateway(true, {
345367
methods: ["sessions.search"],
346368
request: request as GatewayBrowserClient["request"],
@@ -353,9 +375,11 @@ describe("CommandPalette lifecycle", () => {
353375
await palette.updateComplete;
354376

355377
expect(palette.textContent).toContain(
356-
"Transcript search unavailable — showing chat titles and metadata",
378+
"Transcript matches may be incomplete — indexing or search limits apply",
357379
);
358380
expect(palette.textContent).toContain("Needle planning");
381+
expect(palette.textContent).toContain("Unrelated title");
382+
expect(palette.textContent).toContain("needle also appears in this transcript");
359383
});
360384

361385
it("lazily searches automation names and descriptions once per connection", async () => {

‎ui/src/components/command-palette.ts‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type CommandPaletteProps = {
6161
catalogItems: readonly PaletteItem[];
6262
sessionSearchFailed: boolean;
6363
sessionSearchPartial: boolean;
64+
sessionSearchIncomplete: boolean;
6465
onToggle: () => void;
6566
onQueryChange: (query: string) => void;
6667
onActiveIndexChange: (index: number) => void;
@@ -234,9 +235,13 @@ function renderCommandPalette(props: CommandPaletteProps) {
234235
}}
235236
/>
236237
<div id=${paletteListboxId} class="cmd-palette__results" role="listbox">
237-
${props.sessionSearchPartial
238+
${props.sessionSearchPartial || props.sessionSearchIncomplete
238239
? html`<div class="cmd-palette__empty" role="status">
239-
${t("palette.searchPartial")}
240+
${t(
241+
props.sessionSearchIncomplete
242+
? "palette.searchIncomplete"
243+
: "palette.searchPartial",
244+
)}
240245
</div>`
241246
: nothing}
242247
${grouped.length === 0
@@ -308,6 +313,7 @@ export class CommandPalette extends OpenClawLightDomContentsElement {
308313
@state() private catalogItems: readonly PaletteItem[] = [];
309314
@state() private sessionSearchFailed = false;
310315
@state() private sessionSearchPartial = false;
316+
@state() private sessionSearchIncomplete = false;
311317

312318
private readonly subscriptions = new SubscriptionsController(this);
313319
private sessionSearchTimer: ReturnType<typeof globalThis.setTimeout> | null = null;
@@ -407,6 +413,7 @@ export class CommandPalette extends OpenClawLightDomContentsElement {
407413
this.sessionItems = [];
408414
this.sessionSearchFailed = false;
409415
this.sessionSearchPartial = false;
416+
this.sessionSearchIncomplete = false;
410417
}
411418

412419
private clearCatalogSearch() {
@@ -461,6 +468,7 @@ export class CommandPalette extends OpenClawLightDomContentsElement {
461468
this.sessionItems = [];
462469
this.sessionSearchFailed = false;
463470
this.sessionSearchPartial = false;
471+
this.sessionSearchIncomplete = false;
464472
const search = normalizeOptionalString(query);
465473
if (!this.open || !search || search.length < SESSION_SEARCH_MIN_CHARS) {
466474
return;
@@ -572,10 +580,10 @@ export class CommandPalette extends OpenClawLightDomContentsElement {
572580
return;
573581
}
574582
const transcriptResult = transcriptOutcome?.result ?? null;
575-
this.sessionSearchPartial =
576-
transcriptOutcome?.error === true ||
577-
transcriptResult?.indexing === true ||
578-
transcriptResult?.truncated === true;
583+
this.sessionSearchPartial = transcriptOutcome?.error === true;
584+
this.sessionSearchIncomplete =
585+
transcriptOutcome?.error !== true &&
586+
(transcriptResult?.indexing === true || transcriptResult?.truncated === true);
579587
const transcriptHitByKey = new Map<string, SessionsSearchHit>();
580588
for (const hit of transcriptResult?.results ?? []) {
581589
if (!transcriptHitByKey.has(hit.sessionKey)) {
@@ -660,6 +668,7 @@ export class CommandPalette extends OpenClawLightDomContentsElement {
660668
],
661669
sessionSearchFailed: this.sessionSearchFailed,
662670
sessionSearchPartial: this.sessionSearchPartial,
671+
sessionSearchIncomplete: this.sessionSearchIncomplete,
663672
desktopAvailable: this.desktopAvailable,
664673
custodianAvailable: this.custodianAvailable,
665674
onToggle: this.togglePalette,

‎ui/src/i18n/locales/en.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4331,6 +4331,7 @@ export const en: TranslationMap = {
43314331
noResults: "No results",
43324332
searchFailed: "Chat search failed — check the gateway logs and retry",
43334333
searchPartial: "Transcript search unavailable — showing chat titles and metadata",
4334+
searchIncomplete: "Transcript matches may be incomplete — indexing or search limits apply",
43344335
categories: {
43354336
search: "Search",
43364337
navigation: "Navigation",

0 commit comments

Comments
 (0)