Skip to content

Commit d2be00e

Browse files
authored
feat(ui): persistent emoji session icons in the sidebar (#124034)
* feat(gateway): persist emoji session icons * feat(ui): add persistent session icon menu * docs: explain persistent session icons * docs: list Set icon in the session context menu enumeration * test(gateway): canonicalize group defaults workspace path * fix(ci): sync session icon protocol coverage * fix(sessions): enforce RGI emoji sequences for session icons ClawSweeper P2: single non-emoji graphemes like 漢 passed the segmenter-based predicate. Anchored \p{RGI_Emoji} admits exactly one interchange emoji sequence and deletes the length cap and ASCII carve-out. * fix(sessions): compile RGI emoji validation
1 parent 079bb34 commit d2be00e

41 files changed

Lines changed: 304 additions & 71 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6013,6 +6013,7 @@ public struct SessionRow: Codable, Sendable {
60136013
public let incognito: Bool?
60146014
public let kind: AnyCodable
60156015
public let label: String?
6016+
public let icon: String?
60166017
public let boardface: AnyCodable?
60176018
public let displayname: String?
60186019
public let derivedtitle: String?
@@ -6076,6 +6077,7 @@ public struct SessionRow: Codable, Sendable {
60766077
incognito: Bool? = nil,
60776078
kind: AnyCodable,
60786079
label: String? = nil,
6080+
icon: String? = nil,
60796081
boardface: AnyCodable? = nil,
60806082
displayname: String? = nil,
60816083
derivedtitle: String? = nil,
@@ -6138,6 +6140,7 @@ public struct SessionRow: Codable, Sendable {
61386140
self.incognito = incognito
61396141
self.kind = kind
61406142
self.label = label
6143+
self.icon = icon
61416144
self.boardface = boardface
61426145
self.displayname = displayname
61436146
self.derivedtitle = derivedtitle
@@ -6202,6 +6205,7 @@ public struct SessionRow: Codable, Sendable {
62026205
case incognito
62036206
case kind
62046207
case label
6208+
case icon
62056209
case boardface = "boardFace"
62066210
case displayname = "displayName"
62076211
case derivedtitle = "derivedTitle"
@@ -8771,6 +8775,7 @@ public struct SessionsPatchParams: Codable, Sendable {
87718775
public let expectedsessionid: String?
87728776
public let expectedlifecyclerevision: String?
87738777
public let label: AnyCodable?
8778+
public let icon: AnyCodable?
87748779
public let category: AnyCodable?
87758780
public let boardface: AnyCodable?
87768781
public let statusnote: AnyCodable?
@@ -8805,6 +8810,7 @@ public struct SessionsPatchParams: Codable, Sendable {
88058810
expectedsessionid: String? = nil,
88068811
expectedlifecyclerevision: String? = nil,
88078812
label: AnyCodable? = nil,
8813+
icon: AnyCodable? = nil,
88088814
category: AnyCodable? = nil,
88098815
boardface: AnyCodable? = nil,
88108816
statusnote: AnyCodable? = nil,
@@ -8838,6 +8844,7 @@ public struct SessionsPatchParams: Codable, Sendable {
88388844
self.expectedsessionid = expectedsessionid
88398845
self.expectedlifecyclerevision = expectedlifecyclerevision
88408846
self.label = label
8847+
self.icon = icon
88418848
self.category = category
88428849
self.boardface = boardface
88438850
self.statusnote = statusnote
@@ -8873,6 +8880,7 @@ public struct SessionsPatchParams: Codable, Sendable {
88738880
case expectedsessionid = "expectedSessionId"
88748881
case expectedlifecyclerevision = "expectedLifecycleRevision"
88758882
case label
8883+
case icon
88768884
case category
88778885
case boardface = "boardFace"
88788886
case statusnote = "statusNote"
@@ -8905,6 +8913,7 @@ public struct SessionsPatchParams: Codable, Sendable {
89058913

89068914
public struct SessionsPatchMutation: Codable, Sendable {
89078915
public let label: AnyCodable?
8916+
public let icon: AnyCodable?
89088917
public let category: AnyCodable?
89098918
public let boardface: AnyCodable?
89108919
public let statusnote: AnyCodable?
@@ -8935,6 +8944,7 @@ public struct SessionsPatchMutation: Codable, Sendable {
89358944

89368945
public init(
89378946
label: AnyCodable? = nil,
8947+
icon: AnyCodable? = nil,
89388948
category: AnyCodable? = nil,
89398949
boardface: AnyCodable? = nil,
89408950
statusnote: AnyCodable? = nil,
@@ -8964,6 +8974,7 @@ public struct SessionsPatchMutation: Codable, Sendable {
89648974
groupactivation: AnyCodable? = nil)
89658975
{
89668976
self.label = label
8977+
self.icon = icon
89678978
self.category = category
89688979
self.boardface = boardface
89698980
self.statusnote = statusnote
@@ -8995,6 +9006,7 @@ public struct SessionsPatchMutation: Codable, Sendable {
89959006

89969007
private enum CodingKeys: String, CodingKey {
89979008
case label
9009+
case icon
89989010
case category
89999011
case boardface = "boardFace"
90009012
case statusnote = "statusNote"

‎docs/concepts/session-tool.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Use [`sessions_search`](/concepts/session-search) for exact full-text recall acr
6060

6161
The owner-gated `sessions` tool exposes bounded self-service surfaces:
6262

63-
- `action: "patch"` changes the current session by default, or another visible session selected by `sessionKey`. It can set the label, pin/archive state, model, and thinking level. Archiving or restoring another session requires its `sessions_list` `sessionId` as `expectedSessionId`.
63+
- `action: "patch"` changes the current session by default, or another visible session selected by `sessionKey`. It can set the label, persistent sidebar `icon`, pin/archive state, model, and thinking level. The icon must be one emoji grapheme; pass an empty string to clear it. Archiving or restoring another session requires its `sessions_list` `sessionId` as `expectedSessionId`.
6464
- `action: "reset"` resets another visible session selected by `sessionKey`.
6565
- `action: "delete"` first archives and then deletes the exact same generation of another visible session selected by `sessionKey`. By default its transcript is retained as a deleted archive; pass `deleteTranscript: false` to leave the transcript state untouched. Resetting or deleting the session currently running the tool is rejected.
6666
- `group_list`, `group_set`, `group_rename`, and `group_delete` manage the global ordered session-group catalog. `group_set` replaces the ordered name list rather than patching one entry.

‎docs/web/control-ui.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ and [Linux](/platforms/linux) desktop apps, the
238238

239239
## Sidebar navigation
240240

241-
The sidebar organizes everything around the agent. The identity row at the top is the active agent; below it, the **Pages** section starts with **Home** — the agent's rolling main session, badged with its unread or running state — followed by the pinned destinations (**Automations** and **Plugins** by default). The customize control on the Pages header opens a menu with every other destination, including **Usage** and plugin-provided tabs, plus **Edit pinned items**; right-clicking the navigation area opens the pin editor directly. The session list below splits into zones: **Threads** for the agent's chat sessions (the main session stays behind Home; sessions it spawned appear here as top-level threads, and named threads show without a type prefix), **Groups** for group and room conversations, and **Coding** for sessions bound to a managed worktree or exec node (rows show a `repo ⎇ branch` line plus the node host), ACP-backed harness sessions, and the Codex/Claude CLI catalogs. Coding starts collapsed on first run and remembers your choice; its collapsed header keeps the true count and shows a running indicator while contained sessions work. Custom groups (the session `category`) and **Pinned** rows sit above Threads, and assigning a session to a custom group always wins over the automatic zone classification. The Threads header holds the sort control (Created, Last updated, or People when the Gateway reports multiple server identities), Group by, a persisted **Status** filter for Active, Archived, or All, and the **+** that opens the New session page. People orders creator groups by name and keeps Created order within each group. Archived rows stay inline, dimmed with an archive glyph; they do not contribute unread or attention state and stay outside lineage promotion. Opening a session moves the selection highlight without reordering rows. Parent sessions with recent child runs show a disclosure and child count; expand it to inspect nested child sessions, live or terminal status, and runtime without leaving the sidebar. Selecting a child opens its chat and automatically reveals its ancestor path. Child rows stay outside root grouping, pinning, dragging, multi-select, and pagination; collapsed zones do not consume the visible page budget. Sessions with new activity since they were last read show an unread dot, and opening one marks it read. A session holding composer text you typed but never sent shows a pencil badge until the draft is sent or cleared; the active session hides it because its composer is already in view. An agent can also publish a short expiring status line and optionally request attention with a curated amber icon; that declaration clears when you open the session, send the next message, clear it explicitly, or its TTL expires. Cloud-worker lifecycle states use a globe badge; local and reclaimed sessions omit a placement badge because local execution is the default. Each root session row has a context menu (kebab button or right-click) with Pin/Unpin, Mark as unread/read, Rename, Fork, Move to group (including New group and Remove from group), Archive or Unarchive, and Delete; touch layouts keep the direct pin and menu controls visible. Cmd/Ctrl-click toggles root rows into a multi-select and Shift-click extends it across the visible order; opening the menu on a selected row then offers batch actions (Mark N as unread/read, Move N to group, Archive N, Delete N) that apply to every selected session, with a single confirmation for batch delete. Drag a root session onto **Pinned** to pin it, or onto a custom group to move it. Custom group headers can be collapsed, expanded, or dragged to reorder them; group names, order, and New Session defaults live in the gateway (`sessions.groups.*`), so they follow you across browsers, while collapsed state stays in the browser profile. Each custom group header has a **+** that opens the normal New Session page and assigns the created session to that group. **New session defaults** in the group menu sets its working directory and Local or Worktree preference; the page prefills those values but leaves them editable. Leaving the directory empty uses the selected agent's workspace. The menu also has Rename group, New group, and Delete group; renaming or deleting a group updates every member session server-side, including archived ones, and deleting a group keeps its sessions and moves them back to Threads.
241+
The sidebar organizes everything around the agent. The identity row at the top is the active agent; below it, the **Pages** section starts with **Home** — the agent's rolling main session, badged with its unread or running state — followed by the pinned destinations (**Automations** and **Plugins** by default). The customize control on the Pages header opens a menu with every other destination, including **Usage** and plugin-provided tabs, plus **Edit pinned items**; right-clicking the navigation area opens the pin editor directly. The session list below splits into zones: **Threads** for the agent's chat sessions (the main session stays behind Home; sessions it spawned appear here as top-level threads, and named threads show without a type prefix), **Groups** for group and room conversations, and **Coding** for sessions bound to a managed worktree or exec node (rows show a `repo ⎇ branch` line plus the node host), ACP-backed harness sessions, and the Codex/Claude CLI catalogs. Coding starts collapsed on first run and remembers your choice; its collapsed header keeps the true count and shows a running indicator while contained sessions work. Custom groups (the session `category`) and **Pinned** rows sit above Threads, and assigning a session to a custom group always wins over the automatic zone classification. The Threads header holds the sort control (Created, Last updated, or People when the Gateway reports multiple server identities), Group by, a persisted **Status** filter for Active, Archived, or All, and the **+** that opens the New session page. People orders creator groups by name and keeps Created order within each group. Archived rows stay inline, dimmed with an archive glyph; they do not contribute unread or attention state and stay outside lineage promotion. Opening a session moves the selection highlight without reordering rows. Parent sessions with recent child runs show a disclosure and child count; expand it to inspect nested child sessions, live or terminal status, and runtime without leaving the sidebar. Selecting a child opens its chat and automatically reveals its ancestor path. Child rows stay outside root grouping, pinning, dragging, multi-select, and pagination; collapsed zones do not consume the visible page budget. Sessions with new activity since they were last read show an unread dot, and opening one marks it read. A session holding composer text you typed but never sent shows a pencil badge until the draft is sent or cleared; the active session hides it because its composer is already in view. An agent can also publish a short expiring status line and optionally request attention with a curated amber icon; that declaration clears when you open the session, send the next message, clear it explicitly, or its TTL expires. Cloud-worker lifecycle states use a globe badge; local and reclaimed sessions omit a placement badge because local execution is the default. Each root session row has a context menu (kebab button or right-click) with Pin/Unpin, Mark as unread/read, Rename, Set icon, Fork, Move to group (including New group and Remove from group), Archive or Unarchive, and Delete; touch layouts keep the direct pin and menu controls visible. Cmd/Ctrl-click toggles root rows into a multi-select and Shift-click extends it across the visible order; opening the menu on a selected row then offers batch actions (Mark N as unread/read, Move N to group, Archive N, Delete N) that apply to every selected session, with a single confirmation for batch delete. Drag a root session onto **Pinned** to pin it, or onto a custom group to move it. Custom group headers can be collapsed, expanded, or dragged to reorder them; group names, order, and New Session defaults live in the gateway (`sessions.groups.*`), so they follow you across browsers, while collapsed state stays in the browser profile. Each custom group header has a **+** that opens the normal New Session page and assigns the created session to that group. **New session defaults** in the group menu sets its working directory and Local or Worktree preference; the page prefills those values but leaves them editable. Leaving the directory empty uses the selected agent's workspace. The menu also has Rename group, New group, and Delete group; renaming or deleting a group updates every member session server-side, including archived ones, and deleting a group keeps its sessions and moves them back to Threads.
242+
243+
### Session icons
244+
245+
Choose **Set icon** from a single session's context menu to give its sidebar row one persistent emoji. The `sessions` agent tool can set the same `icon` field; only one emoji grapheme is accepted, and an empty value removes it. This decoration replaces the owner avatar in the leading glyph slot, but temporary attention state always takes precedence so an operator request cannot be hidden.
242246

243247
## New session page
244248

‎packages/gateway-protocol/src/schema/sessions-patch.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const SESSIONS_PATCH_MANY_MAX_TARGETS = 100;
1010

1111
const SessionsPatchMutationProperties = {
1212
label: Type.Optional(Type.Union([SessionLabelString, Type.Null()])),
13+
icon: Type.Optional(Type.Union([Type.String(), Type.Null()])),
1314
/** User-defined organization bucket ("category", not chat-group); null clears it. */
1415
category: Type.Optional(Type.Union([SessionLabelString, Type.Null()])),
1516
boardFace: Type.Optional(Type.Union([Type.Literal("chat"), Type.Literal("dashboard")])),

‎packages/gateway-protocol/src/schema/sessions-row.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe("SessionRowSchema", () => {
1515
avatarUrl: "/api/users/profile-ada/avatar?v=7",
1616
},
1717
archivedBy: { type: "human", id: "profile-bob", label: "Bob" },
18+
icon: "🦞",
1819
visibility: "suggest",
1920
sharingRole: "owner",
2021
restartRecoveryStatus: "tombstoned",
@@ -28,6 +29,7 @@ describe("SessionRowSchema", () => {
2829
activeLeafEntryId: "leaf-rendered",
2930
createdActor: { avatarUrl: "/api/users/profile-ada/avatar?v=7" },
3031
archivedBy: { type: "human", id: "profile-bob", label: "Bob" },
32+
icon: "🦞",
3133
visibility: "suggest",
3234
sharingRole: "owner",
3335
restartRecoveryStatus: "tombstoned",

‎packages/gateway-protocol/src/schema/sessions-row.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const SessionRowSchema = Type.Object(
3636
Type.Literal("unknown"),
3737
]),
3838
label: Type.Optional(Type.String()),
39+
icon: Type.Optional(Type.String()),
3940
boardFace: Type.Optional(Type.Union([Type.Literal("chat"), Type.Literal("dashboard")])),
4041
displayName: Type.Optional(Type.String()),
4142
derivedTitle: Type.Optional(Type.String()),

‎packages/gateway-protocol/src/validator-registry.ts‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Type } from "typebox";
21
import { lazyCompile as compile } from "./protocol-validator.js";
32
import * as S from "./schema-modules.js";
43
import type {
@@ -243,18 +242,7 @@ export const validateSessionsViewerPresenceSetParams = compile(
243242
S.SessionsViewerPresenceSetParamsSchema,
244243
);
245244
export const validateSessionsAbortParams = compile(S.SessionsAbortParamsSchema);
246-
// Keep the current generated/client contract icon-free while accepting the
247-
// retired field from beta v4 clients at the raw Gateway validation boundary.
248-
const SessionsPatchV4CompatibilityParamsSchema = Type.Object(
249-
{
250-
...S.SessionsPatchParamsSchema.properties,
251-
icon: Type.Optional(Type.Union([S.NonEmptyString, Type.Null()])),
252-
},
253-
{ additionalProperties: false },
254-
);
255-
export const validateSessionsPatchParams = compile<S.SessionsPatchParams>(
256-
SessionsPatchV4CompatibilityParamsSchema,
257-
);
245+
export const validateSessionsPatchParams = compile(S.SessionsPatchParamsSchema);
258246
export const validateSessionsPatchManyParams = compile(S.SessionsPatchManyParamsSchema);
259247
export const validateSessionsPluginPatchParams = compile(S.SessionsPluginPatchParamsSchema);
260248
export const validateSessionsResetParams = compile(S.SessionsResetParamsSchema);

‎src/agents/tools/sessions-tool.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ describe("sessions tool", () => {
162162
},
163163
deleteTranscript: { type: "boolean" },
164164
label: { type: "string", description: expect.stringContaining("Empty string clears") },
165+
icon: {
166+
type: "string",
167+
description: expect.stringContaining("Distinct from attention"),
168+
},
165169
statusNote: { type: "string", maxLength: 120 },
166170
attention: {
167171
type: "string",
@@ -946,7 +950,7 @@ describe("sessions tool", () => {
946950
});
947951
});
948952

949-
it("patches and clears title, status, attention, and archive state", async () => {
953+
it("patches and clears title, icon, status, attention, and archive state", async () => {
950954
const callGateway = vi.fn(async () => ({ ok: true }));
951955
const tool = createSessionsTool({
952956
agentSessionKey: "agent:main:main",
@@ -958,12 +962,13 @@ describe("sessions tool", () => {
958962
await tool.execute("declare", {
959963
action: "patch",
960964
label: "Waiting on staging",
965+
icon: "🦞",
961966
statusNote: "Blocked: need the staging password",
962967
attention: "key",
963968
ttlMinutes: 45,
964969
archived: true,
965970
});
966-
await tool.execute("clear", { action: "patch", label: "", attention: "clear" });
971+
await tool.execute("clear", { action: "patch", label: "", icon: "", attention: "clear" });
967972

968973
expect(callGateway.mock.calls).toEqual([
969974
[
@@ -972,6 +977,7 @@ describe("sessions tool", () => {
972977
params: {
973978
key: "agent:main:main",
974979
label: "Waiting on staging",
980+
icon: "🦞",
975981
statusNote: "Blocked: need the staging password",
976982
attention: "key",
977983
ttlMinutes: 45,
@@ -983,7 +989,7 @@ describe("sessions tool", () => {
983989
[
984990
{
985991
method: "sessions.patch",
986-
params: { key: "agent:main:main", label: null, attention: null },
992+
params: { key: "agent:main:main", label: null, icon: null, attention: null },
987993
},
988994
],
989995
]);

0 commit comments

Comments
 (0)