Skip to content

Commit 45ec5f4

Browse files
obviyusclaude
andauthored
feat(ui): hide system-created probe sessions from the sessions sidebar (#121855)
Machine-created probe/run sessions (health checks, internal effect sessions) previously surfaced in the Control UI sessions sidebar as raw first-message rows and buried real conversations. Classify them from recorded creation provenance only (system actor, or unnamed run/internal creation without a human actor) and hide them by default behind a persisted "Show system sessions" toggle, mirroring the automation-sessions toggle. Cron rows stay owned by the automation toggle; the selected session, the Sessions page, and the toggle keep hidden rows reachable. Legacy rows without provenance stay visible. Closes #121851 Co-authored-by: Ayaan Zaidi <[email protected]> Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 09c7cd9 commit 45ec5f4

11 files changed

Lines changed: 219 additions & 19 deletions

‎ui/src/components/app-sidebar-session-menu-renderers.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,15 @@ export function renderSidebarSessionSortMenu(params: {
232232
peopleSortAvailable: boolean;
233233
statusFilter: SidebarSessionStatusFilter;
234234
showCron: boolean;
235+
showSystem: boolean;
235236
creators: readonly SessionCreatorOption[];
236237
creatorFilterId: string | null;
237238
onGroupingChange: (grouping: SidebarSessionsGrouping) => void;
238239
onSortModeChange: (mode: SidebarSessionSortMode) => void;
239240
onStatusFilterChange: (statusFilter: SidebarSessionStatusFilter) => void;
240241
onCreatorFilterChange: (creatorId: string | null) => void;
241242
onShowCronChange: (show: boolean) => void;
243+
onShowSystemChange: (show: boolean) => void;
242244
onClose: (restoreFocus: boolean) => void;
243245
}) {
244246
const position = params.position;
@@ -274,6 +276,8 @@ export function renderSidebarSessionSortMenu(params: {
274276
params.onCreatorFilterChange(value.slice("creator:".length) || null);
275277
} else if (value === "show-cron") {
276278
params.onShowCronChange(!params.showCron);
279+
} else if (value === "show-system") {
280+
params.onShowSystemChange(!params.showSystem);
277281
}
278282
}}
279283
@keydown=${(event: KeyboardEvent) =>
@@ -328,6 +332,17 @@ export function renderSidebarSessionSortMenu(params: {
328332
>${params.showCron ? icons.check : nothing}</span
329333
>
330334
</wa-dropdown-item>
335+
<wa-dropdown-item
336+
class="sidebar-session-sort-menu__item"
337+
type="checkbox"
338+
value="show-system"
339+
.checked=${params.showSystem}
340+
>
341+
<span class="session-menu__text">${t("sessionsView.showSystemSessions")}</span>
342+
<span slot="details" class="session-menu__check" aria-hidden="true"
343+
>${params.showSystem ? icons.check : nothing}</span
344+
>
345+
</wa-dropdown-item>
331346
</wa-dropdown>
332347
</openclaw-menu-surface>
333348
`,

‎ui/src/components/app-sidebar-session-navigation-logic.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function projectSidebarSession(
3131
sessionsResult: null,
3232
sessionsAgentId: null,
3333
showCron: false,
34+
showSystem: false,
3435
statusFilter: "active",
3536
compareSessions: () => 0,
3637
highlightCurrentSession: false,
@@ -258,6 +259,7 @@ it("keeps a prepared worktree session in Coding before canonical metadata arrive
258259
},
259260
sessionsAgentId: null,
260261
showCron: false,
262+
showSystem: false,
261263
statusFilter: "active",
262264
compareSessions: () => 0,
263265
highlightCurrentSession: true,

‎ui/src/components/app-sidebar-session-navigation-logic.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { RouteId } from "../app-route-paths.ts";
55
import type { ApplicationContext } from "../app/context.ts";
66
import { t } from "../i18n/index.ts";
77
import {
8+
isCronSessionKey,
89
resolveChannelSessionInfo,
910
resolveSessionDisplayName,
1011
resolveSessionWorkSubtitle,
@@ -19,6 +20,7 @@ import {
1920
import {
2021
compareSessionRowsByUpdatedAt,
2122
filterVisibleSessionRows,
23+
isSystemCreatedSessionRow,
2224
resolveSessionNavigation,
2325
} from "../lib/sessions/index.ts";
2426
import {
@@ -33,6 +35,7 @@ import {
3335
normalizeAgentId,
3436
resolveUiCanonicalMainSessionKey,
3537
resolveUiConfiguredMainKey,
38+
resolveUiSessionNavigationParentKey,
3639
} from "../lib/sessions/session-key.ts";
3740
import { reconcileSidebarZone } from "../lib/sidebar-zone.ts";
3841
import { normalizeOptionalString } from "../lib/string-coerce.ts";
@@ -112,6 +115,7 @@ export function buildSidebarSessionNavigationState(input: {
112115
activeSession?: GatewaySessionRow | null;
113116
sessionsAgentId: string | null;
114117
showCron: boolean;
118+
showSystem: boolean;
115119
statusFilter: SidebarSessionStatusFilter;
116120
compareSessions: (a: SessionRow, b: SessionRow) => number;
117121
highlightCurrentSession: boolean;
@@ -138,6 +142,7 @@ export function buildSidebarSessionNavigationState(input: {
138142
context?.agentSelection.state.selectedId ?? context?.gateway.snapshot.assistantAgentId,
139143
hello: context?.gateway.snapshot.hello,
140144
showCron: input.showCron,
145+
showSystem: input.showSystem,
141146
archivedFilter: input.statusFilter,
142147
compareSessions: input.compareSessions,
143148
});
@@ -387,6 +392,32 @@ export function latestVisibleAgentSessionRow(input: {
387392
return visible.toSorted(compareSessionRowsByUpdatedAt)[0] ?? null;
388393
}
389394

395+
/**
396+
* Promote the hidden main session's children to top-level threads, with the
397+
* same visibility rules as ordinary roots so archived, cron, or
398+
* system-created children cannot sneak in and pagination stays deterministic.
399+
*/
400+
export function collectPromotedMainChildRows(input: {
401+
rows: readonly GatewaySessionRow[];
402+
childRowsByParent: Readonly<Record<string, readonly GatewaySessionRow[]>>;
403+
mainSessionKeys: ReadonlySet<string>;
404+
scopedRootKeys: ReadonlySet<string>;
405+
showCron: boolean;
406+
showSystem: boolean;
407+
}): GatewaySessionRow[] {
408+
return [...input.rows, ...Object.values(input.childRowsByParent).flat()].filter((row) => {
409+
const parentKey = resolveUiSessionNavigationParentKey(row);
410+
return (
411+
parentKey != null &&
412+
input.mainSessionKeys.has(parentKey) &&
413+
!input.scopedRootKeys.has(row.key) &&
414+
!row.archived &&
415+
(input.showCron || !isCronSessionKey(row.key)) &&
416+
(input.showSystem || !isSystemCreatedSessionRow(row))
417+
);
418+
});
419+
}
420+
390421
export function resolveSidebarAgentResumeKey(
391422
latest: SessionRow | null,
392423
agentId: string,

‎ui/src/components/app-sidebar-session-navigation.ts‎

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { isSessionRouteId } from "../app-route-paths.ts";
66
import { t } from "../i18n/index.ts";
77
import { listSelectableAgents } from "../lib/agents/display.ts";
88
import { shouldHandleNavigationClick } from "../lib/navigation-click.ts";
9-
import { isCronSessionKey } from "../lib/session-display.ts";
109
import type { SidebarSessionsGrouping } from "../lib/sessions/grouping.ts";
1110
import { filterVisibleSessionRows, sessionMatchesArchivedFilter } from "../lib/sessions/index.ts";
1211
import { runSessionNavigationIntent } from "../lib/sessions/navigation-handoff.ts";
@@ -20,7 +19,6 @@ import {
2019
normalizeAgentId,
2120
parseAgentSessionKey,
2221
resolveUiDefaultAgentId,
23-
resolveUiSessionNavigationParentKey,
2422
} from "../lib/sessions/session-key.ts";
2523
import { normalizeOptionalString } from "../lib/string-coerce.ts";
2624
import { AppSidebarBase } from "./app-sidebar-base.ts";
@@ -29,6 +27,7 @@ import {
2927
applySidebarSessionCreatorFilter,
3028
buildReconciledSidebarZone,
3129
buildSidebarSessionNavigationState,
30+
collectPromotedMainChildRows,
3231
compareSidebarSessionRowsByMode,
3332
collectKnownSidebarSessionCatalogIds,
3433
collectKnownSidebarSessionGroups,
@@ -51,6 +50,7 @@ import {
5150
loadStoredSidebarSessionStatusFilter,
5251
loadStoredSidebarSessionsGrouping,
5352
loadStoredSidebarSessionsShowCron,
53+
loadStoredSidebarSessionsShowSystem,
5454
type SidebarRecentSession,
5555
type SidebarSessionSortMode,
5656
type SidebarSessionStatusFilter,
@@ -119,6 +119,7 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
119119
@state() fullyShownChildSessionKeys: ReadonlySet<string> = new Set();
120120
@state() sessionsGrouping: SidebarSessionsGrouping = loadStoredSidebarSessionsGrouping();
121121
@state() sessionsShowCron = loadStoredSidebarSessionsShowCron();
122+
@state() sessionsShowSystem = loadStoredSidebarSessionsShowSystem();
122123
@state() sessionsStatusFilter: SidebarSessionStatusFilter =
123124
loadStoredSidebarSessionStatusFilter();
124125

@@ -282,6 +283,7 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
282283
activeSession: this.activeLineageRow(routeSessionKey),
283284
sessionsAgentId: this.sessionData.sessionsAgentId,
284285
showCron: this.sessionsShowCron,
286+
showSystem: this.sessionsShowSystem,
285287
statusFilter: this.sessionsStatusFilter,
286288
compareSessions: this.compareSidebarSessionRows,
287289
highlightCurrentSession: isSessionRouteId(this.activeRouteId),
@@ -616,6 +618,7 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
616618
}),
617619
filterByAgent: true,
618620
showCron: this.sessionsShowCron,
621+
showSystem: this.sessionsShowSystem,
619622
archivedFilter: this.sessionsStatusFilter,
620623
}).toSorted(this.compareSidebarSessionRows);
621624
// The identity card replaces the main row; promote children under all equivalent aliases.
@@ -654,22 +657,14 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
654657
) {
655658
scopedRootRows.push(lineageRoot);
656659
}
657-
// Promote the hidden main session's children to top-level threads, with
658-
// the same visibility rules and sort order as ordinary roots so archived
659-
// or cron children cannot sneak in and pagination stays deterministic.
660660
const scopedRootKeys = new Set(scopedRootRows.map((row) => row.key));
661-
const promotedRows = [
662-
...rows,
663-
...Object.values(this.sessionData.childSessionRowsByParent).flat(),
664-
].filter((row) => {
665-
const parentKey = resolveUiSessionNavigationParentKey(row);
666-
return (
667-
parentKey != null &&
668-
mainSessionKeys.has(parentKey) &&
669-
!scopedRootKeys.has(row.key) &&
670-
!row.archived &&
671-
(this.sessionsShowCron || !isCronSessionKey(row.key))
672-
);
661+
const promotedRows = collectPromotedMainChildRows({
662+
rows,
663+
childRowsByParent: this.sessionData.childSessionRowsByParent,
664+
mainSessionKeys,
665+
scopedRootKeys,
666+
showCron: this.sessionsShowCron,
667+
showSystem: this.sessionsShowSystem,
673668
});
674669
for (const row of promotedRows) {
675670
if (!scopedRootKeys.has(row.key)) {

‎ui/src/components/app-sidebar-session-types.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export function sidebarSessionStateId(key: string): string {
204204
const SIDEBAR_SESSION_GROUPING_STORAGE_KEY = "openclaw:sidebar:sessions:grouping";
205205
const SIDEBAR_SESSION_CATALOG_GROUPING_STORAGE_KEY = "openclaw:sidebar:sessions:catalog-grouping";
206206
const SIDEBAR_SESSION_SHOW_CRON_STORAGE_KEY = "openclaw:sidebar:sessions:show-cron";
207+
const SIDEBAR_SESSION_SHOW_SYSTEM_STORAGE_KEY = "openclaw:sidebar:sessions:show-system";
207208
const SIDEBAR_SESSION_STATUS_FILTER_STORAGE_KEY = "openclaw:sidebar:sessions:status-filter";
208209
const SIDEBAR_SESSION_COLLAPSED_SECTIONS_STORAGE_KEY =
209210
"openclaw:sidebar:sessions:collapsed-sections";
@@ -244,6 +245,10 @@ export function loadStoredSidebarSessionsShowCron(): boolean {
244245
return getSafeLocalStorage()?.getItem(SIDEBAR_SESSION_SHOW_CRON_STORAGE_KEY) === "true";
245246
}
246247

248+
export function loadStoredSidebarSessionsShowSystem(): boolean {
249+
return getSafeLocalStorage()?.getItem(SIDEBAR_SESSION_SHOW_SYSTEM_STORAGE_KEY) === "true";
250+
}
251+
247252
export function loadStoredSidebarSessionStatusFilter(): SidebarSessionStatusFilter {
248253
const stored = getSafeLocalStorage()?.getItem(SIDEBAR_SESSION_STATUS_FILTER_STORAGE_KEY);
249254
return stored === "archived" || stored === "all" ? stored : "active";
@@ -295,6 +300,10 @@ export function storeSidebarSessionsShowCron(show: boolean) {
295300
getSafeLocalStorage()?.setItem(SIDEBAR_SESSION_SHOW_CRON_STORAGE_KEY, String(show));
296301
}
297302

303+
export function storeSidebarSessionsShowSystem(show: boolean) {
304+
getSafeLocalStorage()?.setItem(SIDEBAR_SESSION_SHOW_SYSTEM_STORAGE_KEY, String(show));
305+
}
306+
298307
export function storeSidebarSessionStatusFilter(value: SidebarSessionStatusFilter) {
299308
getSafeLocalStorage()?.setItem(SIDEBAR_SESSION_STATUS_FILTER_STORAGE_KEY, value);
300309
}

‎ui/src/components/session-organizer-controller.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
storeCollapsedSessionSections,
2323
storeSidebarSessionsGrouping,
2424
storeSidebarSessionsShowCron,
25+
storeSidebarSessionsShowSystem,
2526
type SidebarRecentSession,
2627
type SidebarSectionDropTarget,
2728
type SidebarSessionMutationResult,
@@ -48,6 +49,7 @@ export interface SessionOrganizerControllerHost extends ReactiveControllerHost {
4849
readonly onUpdateSidebarEntries?: (entries: string[]) => void;
4950
sessionsGrouping: SidebarSessionsGrouping;
5051
sessionsShowCron: boolean;
52+
sessionsShowSystem: boolean;
5153
sessionsStatusFilter: SidebarSessionStatusFilter;
5254
clearSessionSelection(): void;
5355
findSidebarSessionByKey(sessionKey: string): SidebarRecentSession | undefined;
@@ -696,6 +698,15 @@ export class SessionOrganizerController implements ReactiveController {
696698
}
697699
}
698700

701+
setSessionsShowSystem(show: boolean) {
702+
this.host.sessionsShowSystem = show;
703+
try {
704+
storeSidebarSessionsShowSystem(show);
705+
} catch {
706+
// Keep the in-memory preference when storage is unavailable.
707+
}
708+
}
709+
699710
setSessionsStatusFilter(statusFilter: SidebarSessionStatusFilter) {
700711
if (statusFilter === this.host.sessionsStatusFilter) {
701712
return;

‎ui/src/components/sidebar-menus-render.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ export function renderSidebarSessionSortMenuForController(controller: SidebarMen
317317
peopleSortAvailable: host.sessionPeopleSortAvailable(),
318318
statusFilter: host.sessionsStatusFilter,
319319
showCron: host.sessionsShowCron,
320+
showSystem: host.sessionsShowSystem,
320321
creators: host.sessionOwnershipVisible ? host.sessionCreatorOptions : [],
321322
creatorFilterId: host.sessionCreatorFilterActive ? host.sessionCreatorFilterId : null,
322323
onGroupingChange: (grouping) => {
@@ -340,6 +341,10 @@ export function renderSidebarSessionSortMenuForController(controller: SidebarMen
340341
host.sessionOrganizer.setSessionsShowCron(show);
341342
controller.closeSessionSortMenu({ restoreFocus: true });
342343
},
344+
onShowSystemChange: (show) => {
345+
host.sessionOrganizer.setSessionsShowSystem(show);
346+
controller.closeSessionSortMenu({ restoreFocus: true });
347+
},
343348
onClose: (restoreFocus) => {
344349
if (controller.sessionSortMenuPosition !== position) {
345350
return;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,7 @@ export const en: TranslationMap = {
925925
groupByNone: "None",
926926
groupByCategory: "Custom groups",
927927
showCronSessions: "Show automation sessions",
928+
showSystemSessions: "Show system sessions",
928929
groupByChannel: "Channel",
929930
groupByKind: "Kind",
930931
groupByAgent: "Agent",

‎ui/src/lib/sessions/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export {
4949
filterSessionRows,
5050
filterVisibleSessionRows,
5151
getVisibleSessionRows,
52+
isSystemCreatedSessionRow,
5253
resolveSessionNavigation,
5354
sessionMatchesArchivedFilter,
5455
scopedAgentIdForSession,

0 commit comments

Comments
 (0)