Skip to content

Commit 6b86199

Browse files
fix(ui): keep session status icons visible (#125096)
Co-authored-by: RoboClaw <[email protected]>
1 parent 3010318 commit 6b86199

7 files changed

Lines changed: 99 additions & 36 deletions

File tree

‎ui/src/components/app-sidebar-session-row-render.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,13 @@ export function renderRecentSession(params: {
305305
title=${t("sessionsView.archived")}
306306
>${icons.archive}</span
307307
>`
308+
: nothing}${session.forkSource
309+
? html`<span
310+
class="sidebar-session-fork-indicator"
311+
role="img"
312+
aria-label=${t("sessionsView.forkedSession")}
313+
>${icons.gitFork}</span
314+
>`
308315
: nothing}${label}</span
309316
>
310317
<span class="sidebar-recent-session__details">

‎ui/src/components/session-leading-indicator.ts‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function renderPullRequestIndicator(
5959
role="img"
6060
aria-label=${label}
6161
title=${showTitle ? label : nothing}
62-
>${icons.gitBranch}</span
62+
>${pullRequestState === "open" ? icons.gitPullRequest : icons.gitMerge}</span
6363
>`;
6464
}
6565

@@ -70,22 +70,14 @@ function renderSessionTrailingState(
7070
const sessionState = renderSessionState(session, false);
7171
const concurrentUnreadState = session.hasActiveRun ? renderSessionUnreadState(session) : nothing;
7272
if (
73-
!session.forkSource &&
7473
pullRequestState === "none" &&
7574
sessionState === nothing &&
7675
concurrentUnreadState === nothing
7776
) {
7877
return nothing;
7978
}
80-
const forkLabel = t("sessionsView.forkedSession");
81-
return html`
82-
${session.forkSource
83-
? html`<span class="session-row-fork-indicator" role="img" aria-label=${forkLabel}
84-
>${icons.gitFork}</span
85-
>`
86-
: nothing}
87-
${renderPullRequestIndicator(pullRequestState, false)} ${sessionState} ${concurrentUnreadState}
88-
`;
79+
return html`${renderPullRequestIndicator(pullRequestState, false)} ${sessionState}
80+
${concurrentUnreadState}`;
8981
}
9082

9183
function renderPersistentSessionIcon(icon: string) {

‎ui/src/e2e/chat-flow.sidebar-presentation.e2e.test.ts‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,20 @@ suite.define(() => {
242242
kind: "direct",
243243
label: "Terminal tab bar redesign proposal",
244244
updatedAt: 2,
245-
lastMessagePreview: "Implemented and committed as 094ab2",
245+
activeRunIds: ["run-busy-session"],
246+
hasActiveRun: true,
247+
observerDigest: {
248+
agentId: "main",
249+
runId: "run-busy-session",
250+
headline:
251+
"The isolated clone is ready, but direct Git fetch and every remaining operation continue in the background",
252+
health: "on-track",
253+
updatedAt: 2,
254+
revision: 1,
255+
},
246256
incognito: true,
247257
hasAutomation: true,
248-
status: "done",
258+
status: "running",
249259
unread: true,
250260
},
251261
{
@@ -287,9 +297,20 @@ suite.define(() => {
287297
};
288298
};
289299
return {
300+
atoms: Array.from(
301+
row.querySelectorAll(
302+
".sidebar-recent-session__details-endcap :is(svg, .session-run-spinner, .session-unread-dot)",
303+
),
304+
(element) => {
305+
const box = element.getBoundingClientRect();
306+
return { bottom: box.bottom, left: box.left, right: box.right, top: box.top };
307+
},
308+
),
290309
badges: rect(".session-row-badges"),
291310
busyHeight: row.getBoundingClientRect().height,
311+
endcap: rect(".sidebar-recent-session__details-endcap"),
292312
name: rect(".sidebar-recent-session__name"),
313+
spinner: rect(".session-run-spinner"),
293314
state: rect(".session-row-state"),
294315
subtitle: rect(".sidebar-recent-session__subtitle"),
295316
};
@@ -307,6 +328,17 @@ suite.define(() => {
307328
(layout.subtitle.top + layout.subtitle.bottom) / 2,
308329
1,
309330
);
331+
expect(layout.state.left).toBeGreaterThanOrEqual(layout.endcap.left);
332+
expect(layout.state.right).toBeLessThanOrEqual(layout.endcap.right);
333+
expect(layout.spinner.left).toBeGreaterThanOrEqual(layout.endcap.left);
334+
expect(layout.spinner.right).toBeLessThanOrEqual(layout.endcap.right);
335+
expect(layout.atoms.length).toBeGreaterThanOrEqual(4);
336+
for (const atom of layout.atoms) {
337+
expect(atom.left).toBeGreaterThanOrEqual(layout.endcap.left);
338+
expect(atom.right).toBeLessThanOrEqual(layout.endcap.right);
339+
expect(atom.top).toBeGreaterThanOrEqual(layout.endcap.top);
340+
expect(atom.bottom).toBeLessThanOrEqual(layout.endcap.bottom);
341+
}
310342

311343
await busyRow.hover();
312344
await expect

‎ui/src/e2e/session-management.trailing-state.e2e.test.ts‎

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ suite.define(() => {
118118
}
119119
});
120120

121-
it("keeps a long non-running state clear of always-visible touch actions", async () => {
121+
it("keeps fork provenance in the title above always-visible touch actions", async () => {
122122
const context = await suite.browser.newContext({
123123
hasTouch: true,
124124
locale: "en-US",
@@ -149,25 +149,25 @@ suite.define(() => {
149149
await page.goto(`${suite.server.baseUrl}chat`);
150150
const row = page.locator('[data-session-key="agent:main:touch-forked"]');
151151
await row.waitFor({ state: "visible", timeout: 10_000 });
152-
const state = row.locator(".session-row-state");
152+
const fork = row.locator(".sidebar-recent-session__name .sidebar-session-fork-indicator");
153153
const pin = row.getByRole("button", { name: "Pin session" });
154154
const menu = row.getByRole("button", { name: "Open session menu" });
155-
await expect.poll(() => state.locator(".session-row-fork-indicator").isVisible()).toBe(true);
156-
await expect.poll(() => state.locator(".session-run-spinner").count()).toBe(0);
155+
await expect.poll(() => fork.isVisible()).toBe(true);
156+
await expect.poll(() => row.locator(".session-row-state").count()).toBe(0);
157157

158-
const [nameBounds, stateBounds, pinBounds, menuBounds] = await Promise.all([
158+
const [nameBounds, forkBounds, pinBounds, menuBounds] = await Promise.all([
159159
row.locator(".sidebar-recent-session__name").boundingBox(),
160-
state.boundingBox(),
160+
fork.boundingBox(),
161161
pin.boundingBox(),
162162
menu.boundingBox(),
163163
]);
164-
if (!nameBounds || !stateBounds || !pinBounds || !menuBounds) {
165-
throw new Error("Expected visible non-running touch state geometry");
164+
if (!nameBounds || !forkBounds || !pinBounds || !menuBounds) {
165+
throw new Error("Expected visible fork and touch action geometry");
166166
}
167-
expect(nameBounds.y + nameBounds.height / 2).toBeLessThan(
168-
stateBounds.y + stateBounds.height / 2,
169-
);
170-
expect(stateBounds.x + stateBounds.width).toBeLessThanOrEqual(pinBounds.x);
167+
expect(
168+
Math.abs(forkBounds.y + forkBounds.height / 2 - (nameBounds.y + nameBounds.height / 2)),
169+
).toBeLessThanOrEqual(2);
170+
expect(nameBounds.y + nameBounds.height / 2).toBeLessThan(pinBounds.y + pinBounds.height / 2);
171171
expect(pinBounds.x + pinBounds.width).toBeLessThanOrEqual(menuBounds.x);
172172
} finally {
173173
await context.close();
@@ -295,12 +295,32 @@ suite.define(() => {
295295
const row = page.locator('[data-session-key="agent:main:combined-state"]');
296296
await row.waitFor({ state: "visible", timeout: 10_000 });
297297
const state = row.locator(".session-row-state");
298-
await expect.poll(() => state.locator(".session-row-fork-indicator").isVisible()).toBe(true);
298+
await expect
299+
.poll(() =>
300+
row.locator(".sidebar-recent-session__name .sidebar-session-fork-indicator").isVisible(),
301+
)
302+
.toBe(true);
303+
await expect.poll(() => state.locator('[aria-label="Forked session"]').count()).toBe(0);
299304
await expect
300305
.poll(() => state.locator("[data-session-pr-state='open']").isVisible())
301306
.toBe(true);
302307
await expect.poll(() => state.locator(".session-run-spinner").isVisible()).toBe(true);
303308
await expect.poll(() => state.locator(".session-unread-dot").isVisible()).toBe(true);
309+
const [endcapBounds, openPullRequestBounds, spinnerBounds, unreadBounds] = await Promise.all([
310+
row.locator(".sidebar-recent-session__details-endcap").boundingBox(),
311+
state.locator("[data-session-pr-state='open'] svg").boundingBox(),
312+
state.locator(".session-run-spinner").boundingBox(),
313+
state.locator(".session-unread-dot").boundingBox(),
314+
]);
315+
if (!endcapBounds || !openPullRequestBounds || !spinnerBounds || !unreadBounds) {
316+
throw new Error("Expected visible combined session state geometry");
317+
}
318+
for (const iconBounds of [openPullRequestBounds, spinnerBounds, unreadBounds]) {
319+
expect(iconBounds.x).toBeGreaterThanOrEqual(endcapBounds.x);
320+
expect(iconBounds.x + iconBounds.width).toBeLessThanOrEqual(
321+
endcapBounds.x + endcapBounds.width,
322+
);
323+
}
304324
const link = row.locator(".sidebar-recent-session__link");
305325
const details = row.locator(".sidebar-recent-session__details");
306326
const pin = row.getByRole("button", { name: "Pin session" });

‎ui/src/styles/components.css‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5680,12 +5680,14 @@ td.data-table-key-col {
56805680
pointer-events: none;
56815681
}
56825682

5683-
.session-row-fork-indicator {
5683+
.sidebar-session-fork-indicator {
56845684
display: inline-flex;
5685+
margin-right: 4px;
56855686
color: var(--muted);
5687+
vertical-align: -2px;
56865688
}
56875689

5688-
.session-row-fork-indicator svg {
5690+
.sidebar-session-fork-indicator svg {
56895691
width: 14px;
56905692
height: 14px;
56915693
fill: none;

‎ui/src/styles/layout.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4184,7 +4184,7 @@ html:not(.openclaw-native-macos):not(.openclaw-native-nav):not(.openclaw-native-
41844184
}
41854185

41864186
.sidebar-recent-session__subtitle {
4187-
flex: 1 1 auto;
4187+
flex: 1 1 0;
41884188
min-width: 0;
41894189
overflow: hidden;
41904190
text-overflow: ellipsis;

‎ui/src/test-helpers/app-sidebar-cases/session-indicators.ts‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ describe("AppSidebar session indicators", () => {
272272

273273
const forked = sidebar.querySelector(`[data-session-key="${keys.forked}"]`);
274274
expectEmptyLead(forked);
275-
expect(
276-
forked?.querySelector(".session-row-aside > .session-row-state .session-row-fork-indicator"),
277-
).not.toBeNull();
278-
expect(forked?.querySelector(".session-row-fork-indicator")?.getAttribute("aria-label")).toBe(
279-
"Forked session",
275+
const forkIndicator = forked?.querySelector(
276+
".sidebar-recent-session__name .sidebar-session-fork-indicator",
280277
);
281-
expect(forked?.querySelector(".session-row-fork-indicator")?.hasAttribute("title")).toBe(false);
278+
expect(forkIndicator).not.toBeNull();
279+
expect(forkIndicator?.getAttribute("aria-label")).toBe("Forked session");
280+
expect(forkIndicator?.hasAttribute("title")).toBe(false);
281+
expect(forked?.querySelector(".session-row-state")).toBeNull();
282282

283283
const unread = sidebar.querySelector(`[data-session-key="${keys.unread}"]`);
284284
expectEmptyLead(unread);
@@ -296,7 +296,7 @@ describe("AppSidebar session indicators", () => {
296296
runningUnread?.querySelector(".session-row-aside > .session-row-state .session-unread-dot"),
297297
).not.toBeNull();
298298

299-
for (const key of [keys.forked, keys.unread, keys.runningUnread]) {
299+
for (const key of [keys.unread, keys.runningUnread]) {
300300
const link = sidebar.querySelector(`[data-session-key="${key}"] a`);
301301
const descriptionId = link?.getAttribute("aria-describedby");
302302
expect(descriptionId).toBe(`sidebar-session-state-${encodeURIComponent(key)}`);
@@ -310,6 +310,16 @@ describe("AppSidebar session indicators", () => {
310310
"Active run · Unread",
311311
);
312312

313+
const openPullRequestIcon = sidebar.querySelector(
314+
`[data-session-key="${keys.openPullRequest}"] [data-session-pr-state="open"] svg`,
315+
);
316+
const mergedPullRequestIcon = sidebar.querySelector(
317+
`[data-session-key="${keys.mergedPullRequest}"] [data-session-pr-state="merged"] svg`,
318+
);
319+
expect(openPullRequestIcon).not.toBeNull();
320+
expect(mergedPullRequestIcon).not.toBeNull();
321+
expect(openPullRequestIcon?.isEqualNode(mergedPullRequestIcon ?? null)).toBe(false);
322+
313323
for (const key of [keys.openPullRequest, keys.mergedPullRequest]) {
314324
const row = sidebar.querySelector(`[data-session-key="${key}"]`);
315325
expectEmptyLead(row);

0 commit comments

Comments
 (0)