Skip to content

Commit 8a3fff2

Browse files
fix(ui): stop inferring session sharing identity kind from ID strings (#124257)
* fix(ui): drive session sharing icon from identity type Remove the ID-string channel heuristic in the chat sharing menu. Sharing identities are typed human/agent/system by the Gateway protocol; there is no channel identity kind, so a human profile whose ID happened to contain "channel:" was misrendered with the channel glyph instead of the owner chip. Presentation now branches on identity.type only. * test(ui): describe the sharing fixture ID as opaque, not canonical ClawSweeper flagged the comment on the channel-shaped human ID case: it implied channel-shaped IDs are canonical for human profiles, but durable profile IDs are generated UUIDs. The real supported path is an opaque human identity ID (e.g. an inbound SenderId) that can happen to contain "channel:" as a substring.
1 parent 80ee4b9 commit 8a3fff2

4 files changed

Lines changed: 28 additions & 41 deletions

File tree

‎ui/src/e2e/session-ownership.e2e.test.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,9 @@ suite.define(() => {
493493
label: `Member ${index + 1}`,
494494
})),
495495
];
496-
const channelIdentities = [
497-
{ type: "human" as const, id: "channel:chn_design", label: "Design" },
498-
{ type: "human" as const, id: "discord:channel:operations", label: "Operations" },
496+
const nonHumanIdentities = [
497+
{ type: "agent" as const, id: "agent-design", label: "Design" },
498+
{ type: "system" as const, id: "system-operations", label: "Operations" },
499499
];
500500
const gateway = await installMockGateway(currentPage, {
501501
sessionKey: "agent:main:ada",
@@ -544,7 +544,7 @@ suite.define(() => {
544544
"session.members.list": {
545545
sessionKey: "agent:main:ada",
546546
members: [{ identityId: longMemberId, addedBy: "profile-ada", addedAt: 1 }],
547-
identities: [...humanIdentities, ...channelIdentities],
547+
identities: [...humanIdentities, ...nonHumanIdentities],
548548
role: "owner",
549549
allowedVisibilities: ["shared", "read-only", "suggest", "draft"],
550550
},
@@ -677,7 +677,9 @@ suite.define(() => {
677677
await expectBrowser(
678678
dropdown.locator(".chat-pane__sharing-member openclaw-session-owner-chip"),
679679
).toHaveCount(30);
680-
await expectBrowser(dropdown.locator(".chat-pane__sharing-channel-icon")).toHaveCount(2);
680+
// Agent and system identities render the non-human icon from identity.type,
681+
// not from an ID-string heuristic; owner-chip presentation is human-only.
682+
await expectBrowser(dropdown.locator(".chat-pane__sharing-member-icon > svg")).toHaveCount(2);
681683
expect(
682684
await longNameItem.locator(".chat-pane__sharing-member-label").getAttribute("title"),
683685
).toBe(longMemberLabel);

‎ui/src/pages/chat/components/chat-session-sharing.test.ts‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe("chat session sharing menu", () => {
7171
expect(onMemberChange).toHaveBeenCalledWith("alice", true);
7272
});
7373

74-
it("distinguishes people from channel-backed members", () => {
74+
it("renders member presentation from identity.type, not from ID spelling", () => {
7575
const root = mount(
7676
renderChatSessionSharing({
7777
session: {
@@ -88,8 +88,12 @@ describe("chat session sharing menu", () => {
8888
members: [],
8989
identities: [
9090
{ type: "human", id: "profile-vyctor", label: "Vyctor Brzezowski" },
91+
// Human identity IDs are opaque (e.g. an inbound SenderId) and
92+
// can contain "channel:" as a substring; the recorded type,
93+
// not the ID string, must drive presentation.
9194
{ type: "human", id: "channel:chn_design", label: "Design" },
92-
{ type: "human", id: "discord:channel:operations", label: "Operations" },
95+
{ type: "agent", id: "discord:channel:operations", label: "Operations" },
96+
{ type: "system", id: "channel:audit", label: "Audit" },
9397
],
9498
role: "owner",
9599
allowedVisibilities: ["shared"],
@@ -101,16 +105,21 @@ describe("chat session sharing menu", () => {
101105
}),
102106
);
103107

104-
const human = root.querySelector('wa-dropdown-item[value="member:profile-vyctor"]');
105-
const channels = [
108+
const humans = [
109+
root.querySelector('wa-dropdown-item[value="member:profile-vyctor"]'),
106110
root.querySelector('wa-dropdown-item[value="member:channel:chn_design"]'),
111+
];
112+
const nonHumans = [
107113
root.querySelector('wa-dropdown-item[value="member:discord:channel:operations"]'),
114+
root.querySelector('wa-dropdown-item[value="member:channel:audit"]'),
108115
];
109116

110-
expect(human?.querySelector("openclaw-session-owner-chip")).not.toBeNull();
111-
for (const channel of channels) {
112-
expect(channel?.querySelector("openclaw-session-owner-chip")).toBeNull();
113-
expect(channel?.querySelector(".chat-pane__sharing-channel-icon svg")).not.toBeNull();
117+
for (const human of humans) {
118+
expect(human?.querySelector("openclaw-session-owner-chip")).not.toBeNull();
119+
}
120+
for (const nonHuman of nonHumans) {
121+
expect(nonHuman?.querySelector("openclaw-session-owner-chip")).toBeNull();
122+
expect(nonHuman?.querySelector(".chat-pane__sharing-member-icon svg")).not.toBeNull();
114123
}
115124
});
116125

‎ui/src/pages/chat/components/chat-session-sharing.ts‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ function sharingIcon(visibility: SessionVisibility): TemplateResult {
4343
return visibility === "shared" ? icons.users : icons.lock;
4444
}
4545

46-
function isChannelIdentity(identityId: string): boolean {
47-
return identityId.startsWith("channel:") || identityId.includes(":channel:");
48-
}
49-
5046
export function canManageChatSessionSharing(
5147
session: Pick<GatewaySessionRow, "sharingRole">,
5248
): boolean {
@@ -162,26 +158,17 @@ export function renderChatSessionSharing(props: ChatSessionSharingProps) {
162158
const disabledReason = members.has(identity.id)
163159
? props.memberRemoveDisabledReason
164160
: props.memberAddDisabledReason;
165-
const channelIdentity = isChannelIdentity(identity.id);
166161
return html`
167162
<wa-dropdown-item
168163
class="session-menu__item chat-pane__sharing-member"
169164
value=${`member:${identity.id}`}
170165
?disabled=${Boolean(disabledReason)}
171166
title=${disabledReason ?? nothing}
172167
>
173-
<span
174-
slot="icon"
175-
class="chat-pane__sharing-member-icon ${channelIdentity
176-
? "chat-pane__sharing-channel-icon"
177-
: ""}"
178-
aria-hidden="true"
179-
>
180-
${channelIdentity
181-
? icons.messageSquare
182-
: identity.type === "human"
183-
? renderSessionOwnerChip(identity, "header")
184-
: icons.bot}
168+
<span slot="icon" class="chat-pane__sharing-member-icon" aria-hidden="true">
169+
${identity.type === "human"
170+
? renderSessionOwnerChip(identity, "header")
171+
: icons.bot}
185172
</span>
186173
<span
187174
class="chat-pane__sharing-member-label"

‎ui/src/styles/chat/split-view.css‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -628,17 +628,6 @@ openclaw-chat-pane {
628628
justify-content: center;
629629
}
630630

631-
.chat-pane__sharing-channel-icon {
632-
border-radius: var(--radius-full);
633-
background: var(--bg-muted);
634-
color: var(--muted);
635-
}
636-
637-
.chat-pane__sharing-channel-icon svg {
638-
width: 13px;
639-
height: 13px;
640-
}
641-
642631
.chat-pane__sharing-member-label {
643632
display: block;
644633
overflow: hidden;

0 commit comments

Comments
 (0)