Skip to content

Commit 8e7abdd

Browse files
committed
fix(ui): drop resting relative ages from agent chip subtitle and footer build chip
1 parent 3e8f1c6 commit 8e7abdd

5 files changed

Lines changed: 17 additions & 41 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,7 @@ export abstract class AppSidebarSessionNavigationElement extends AppSidebarSessi
446446
return t("agentChip.working");
447447
}
448448
if (latest) {
449-
const label = resolveSessionDisplayName(latest.key, latest);
450-
const meta = formatSidebarTimestamp(latest.updatedAt);
451-
return meta ? `${label} · ${meta}` : label;
449+
return resolveSessionDisplayName(latest.key, latest);
452450
}
453451
return t("agentChip.ready");
454452
}
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
22
import type { ControlUiBuildInfo } from "../build-info.ts";
3-
import { formatTimeAgo } from "../lib/format.ts";
43

54
const BRANCH_DISPLAY_LENGTH = 14;
65

@@ -15,19 +14,11 @@ function formatBranchPrefix(branch: string | null): string {
1514
return `${displayBranch}@`;
1615
}
1716

18-
export function formatBuildChipText(info: ControlUiBuildInfo, nowMs: number): string | null {
17+
export function formatBuildChipText(info: ControlUiBuildInfo): string | null {
1918
if (!info.commit) {
2019
return null;
2120
}
2221
const branch = formatBranchPrefix(info.branch);
2322
const commit = `${info.commit.slice(0, 7)}${info.dirty === true ? "*" : ""}`;
24-
if (!info.builtAt) {
25-
return `${branch}${commit}`;
26-
}
27-
const builtAtMs = Date.parse(info.builtAt);
28-
if (Number.isNaN(builtAtMs)) {
29-
return `${branch}${commit}`;
30-
}
31-
const age = formatTimeAgo(Math.max(0, nowMs - builtAtMs), { suffix: false });
32-
return `${branch}${commit} · ${age}`;
23+
return `${branch}${commit}`;
3324
}

‎ui/src/components/sidebar-build-chip.node.test.ts‎

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,25 @@ function buildInfo(overrides: Partial<ControlUiBuildInfo> = {}): ControlUiBuildI
1818
}
1919

2020
describe("formatBuildChipText", () => {
21-
const nowMs = Date.parse(BUILT_AT) + 24 * 60_000;
2221
const cases: Array<{
2322
name: string;
2423
info: ControlUiBuildInfo;
25-
nowMs?: number;
2624
expected: string | null;
2725
}> = [
2826
{
2927
name: "main clean build",
3028
info: buildInfo(),
31-
expected: "e8cbc62 · 24m",
29+
expected: "e8cbc62",
3230
},
3331
{
3432
name: "non-main branch",
35-
info: buildInfo({ branch: "feat/x", builtAt: "2026-07-10T12:19:00.000Z" }),
36-
expected: "feat/x@e8cbc62 · 5m",
33+
info: buildInfo({ branch: "feat/x" }),
34+
expected: "feat/x@e8cbc62",
3735
},
3836
{
3937
name: "dirty worktree",
40-
info: buildInfo({ dirty: true, builtAt: "2026-07-10T09:00:00.000Z" }),
41-
expected: "e8cbc62* · 3h",
42-
},
43-
{
44-
name: "missing build timestamp",
45-
info: buildInfo({ builtAt: null }),
46-
expected: "e8cbc62",
38+
info: buildInfo({ dirty: true }),
39+
expected: "e8cbc62*",
4740
},
4841
{
4942
name: "missing commit",
@@ -52,29 +45,24 @@ describe("formatBuildChipText", () => {
5245
},
5346
{
5447
name: "long branch",
55-
info: buildInfo({ branch: "abcdefghijklmnop", builtAt: null }),
48+
info: buildInfo({ branch: "abcdefghijklmnop" }),
5649
expected: "abcdefghijklmn…@e8cbc62",
5750
},
5851
{
5952
name: "long branch keeps an emoji that fits exactly at the boundary",
60-
info: buildInfo({ branch: `${"a".repeat(12)}😀suffix`, builtAt: null }),
53+
info: buildInfo({ branch: `${"a".repeat(12)}😀suffix` }),
6154
expected: "aaaaaaaaaaaa😀…@e8cbc62",
6255
},
6356
{
6457
name: "long branch does not split an emoji across the boundary",
65-
info: buildInfo({ branch: `${"a".repeat(13)}😀suffix`, builtAt: null }),
58+
info: buildInfo({ branch: `${"a".repeat(13)}😀suffix` }),
6659
expected: "aaaaaaaaaaaaa…@e8cbc62",
6760
},
68-
{
69-
name: "future build timestamp",
70-
info: buildInfo({ builtAt: "2026-07-10T12:25:00.000Z" }),
71-
expected: "e8cbc62 · 0s",
72-
},
7361
];
7462

7563
for (const testCase of cases) {
7664
it(testCase.name, () => {
77-
expect(formatBuildChipText(testCase.info, testCase.nowMs ?? nowMs)).toBe(testCase.expected);
65+
expect(formatBuildChipText(testCase.info)).toBe(testCase.expected);
7866
});
7967
}
8068
});

‎ui/src/components/sidebar-build-chip.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { pathForRoute } from "../app-route-paths.ts";
44
import { CONTROL_UI_BUILD_INFO } from "../build-info.ts";
55
import { t } from "../i18n/index.ts";
66
import { OpenClawLightDomContentsElement } from "../lit/openclaw-element.ts";
7-
import { PollController } from "../lit/poll-controller.ts";
87
import { formatBuildChipText } from "./sidebar-build-chip-format.ts";
98
import "./tooltip.ts";
109

@@ -25,11 +24,8 @@ class SidebarBuildChip extends OpenClawLightDomContentsElement {
2524
@property({ attribute: false }) gatewayVersion: string | null = null;
2625
@property({ attribute: false }) onNavigate?: (routeId: "about") => void;
2726

28-
// Relative age must advance without sidebar renders; controller teardown keeps reconnects clean.
29-
readonly polling = new PollController(this, 60_000, () => this.requestUpdate());
30-
3127
override render() {
32-
const text = formatBuildChipText(CONTROL_UI_BUILD_INFO, Date.now());
28+
const text = formatBuildChipText(CONTROL_UI_BUILD_INFO);
3329
if (!text) {
3430
return nothing;
3531
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,17 @@ describe("AppSidebar agent chip", () => {
261261
path: "",
262262
count: 1,
263263
defaults,
264-
sessions: [{ key: "agent:main:main", kind: "direct", updatedAt: 5 }],
264+
sessions: [{ key: "agent:main:main", kind: "direct", label: "Main task", updatedAt: 5 }],
265265
},
266266
agentId: "main",
267267
});
268268
await sidebar.updateComplete;
269269

270270
// No per-agent sections: the card switcher owns agent switching now, and
271271
// the main session lives behind the identity card instead of the list.
272+
expect(sidebar.querySelector(".sidebar-agent-card__subtitle")?.textContent?.trim()).toBe(
273+
"Main task",
274+
);
272275
expect(sidebar.querySelector(".sidebar-agent-section")).toBeNull();
273276
expect(sidebar.querySelectorAll(".sidebar-recent-session")).toHaveLength(0);
274277
expect(sidebar.querySelector(".sidebar-agent-card__menu-unread")).not.toBeNull();

0 commit comments

Comments
 (0)