Skip to content

Commit 3fe6e58

Browse files
authored
fix(ui): clarify gateway disconnect status in tab title (#130364)
* fix(ui): clarify disconnected gateway title * fix(ui): keep disconnect title concise * test(ui): align shell disconnect title
1 parent 4ca379e commit 3fe6e58

6 files changed

Lines changed: 27 additions & 24 deletions

File tree

‎ui/src/app-navigation.test.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,26 @@ describe("formatDocumentTitle", () => {
177177
);
178178
});
179179

180-
it("does not add a queued count for an empty offline outbox", () => {
181-
expect(formatDocumentTitle({ context: "Usage", offline: true, queuedCount: 0 })).toBe(
182-
"(Offline) Usage — OpenClaw",
183-
);
180+
it("names the disconnected gateway without implying internet loss", () => {
181+
expect(
182+
formatDocumentTitle({ context: "Usage", gatewayDisconnected: true, queuedCount: 0 }),
183+
).toBe("(Disconnected) Usage — OpenClaw");
184184
});
185185

186-
it("includes the queued outbox count in the offline marker", () => {
187-
expect(formatDocumentTitle({ context: "Usage", offline: true, queuedCount: 3 })).toBe(
188-
"(Offline · 3 queued) Usage — OpenClaw",
189-
);
186+
it("includes the queued outbox count in the disconnected marker", () => {
187+
expect(
188+
formatDocumentTitle({ context: "Usage", gatewayDisconnected: true, queuedCount: 3 }),
189+
).toBe("(Disconnected · 3 queued) Usage — OpenClaw");
190190
});
191191

192192
it("ignores a queued count while online", () => {
193193
expect(formatDocumentTitle({ context: "Usage", queuedCount: 3 })).toBe("Usage — OpenClaw");
194194
});
195195

196-
it("suppresses the attention count while offline", () => {
197-
expect(formatDocumentTitle({ context: "Usage", attentionCount: 2, offline: true })).toBe(
198-
"(Offline) Usage — OpenClaw",
199-
);
196+
it("suppresses the attention count while disconnected", () => {
197+
expect(
198+
formatDocumentTitle({ context: "Usage", attentionCount: 2, gatewayDisconnected: true }),
199+
).toBe("(Disconnected) Usage — OpenClaw");
200200
});
201201
});
202202

‎ui/src/app-navigation.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,24 +441,24 @@ export function titleForRoute(routeId: NavigationRouteId): string {
441441
}
442442

443443
/** Window/tab title, markers leftmost because tabs truncate from the right.
444-
* Offline replaces the approval count (a stale queue is not actionable) and
445-
* carries the pending-outbox total; titles already ending in the brand
444+
* A disconnected Gateway replaces the approval count (a stale queue is not
445+
* actionable) and carries the pending-outbox total; titles already ending in the brand
446446
* ("Ask OpenClaw") skip the suffix so it never reads "… OpenClaw — OpenClaw". */
447447
export function formatDocumentTitle(options: {
448448
context: string;
449449
attentionCount?: number;
450-
offline?: boolean;
450+
gatewayDisconnected?: boolean;
451451
queuedCount?: number;
452452
}): string {
453453
const base = options.context.endsWith("OpenClaw")
454454
? options.context
455455
: `${options.context} — OpenClaw`;
456-
if (options.offline) {
456+
if (options.gatewayDisconnected) {
457457
const queued =
458458
options.queuedCount && options.queuedCount > 0
459459
? ` · ${t("connection.queuedCount", { count: String(options.queuedCount) })}`
460460
: "";
461-
return `(${t("common.offline")}${queued}) ${base}`;
461+
return `(${t("connection.disconnectedTitle")}${queued}) ${base}`;
462462
}
463463
if (options.attentionCount && options.attentionCount > 0) {
464464
return `(${options.attentionCount}) ${base}`;

‎ui/src/app/app-host.document-title.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,16 @@ describe("OpenClaw shell document title", () => {
167167
expect(document.title).toBe("(2) Usage — OpenClaw");
168168
});
169169

170-
it("shows offline instead of a stale approval count", () => {
170+
it("shows disconnected instead of a stale approval count", () => {
171171
const shell = createShell(createContext({ connected: false, approvalCount: 2 }));
172172
shell.routeState = { routeId: "usage" };
173173

174174
shell.syncDocumentTitle();
175175

176-
expect(document.title).toBe("(Offline) Usage — OpenClaw");
176+
expect(document.title).toBe("(Disconnected) Usage — OpenClaw");
177177
});
178178

179-
it("includes stored chat outbox messages in the offline marker", () => {
179+
it("includes stored chat outbox messages in the disconnected marker", () => {
180180
const shell = createShell(createContext({ connected: false }));
181181
shell.routeState = { routeId: "usage" };
182182
shell.outboxStoreRuntime = {
@@ -185,7 +185,7 @@ describe("OpenClaw shell document title", () => {
185185

186186
shell.syncDocumentTitle();
187187

188-
expect(document.title).toBe("(Offline · 3 queued) Usage — OpenClaw");
188+
expect(document.title).toBe("(Disconnected · 3 queued) Usage — OpenClaw");
189189
});
190190

191191
it("uses the meaningful custodian label without a brand suffix", () => {

‎ui/src/app/app-host.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,12 @@ class OpenClawShell
646646
if (isSessionRouteId(routeId) && this.activeSessionKey) {
647647
primaryContext = this.chatTitleContext(context, outboxScopeHost) || primaryContext;
648648
}
649-
const offline = context.gateway.snapshot.phase !== "connected";
649+
const gatewayDisconnected = context.gateway.snapshot.phase !== "connected";
650650
let title = formatDocumentTitle({
651651
context: primaryContext,
652652
attentionCount: context.overlays.snapshot.approvalQueue.length,
653-
offline,
654-
...(offline && {
653+
gatewayDisconnected,
654+
...(gatewayDisconnected && {
655655
queuedCount: this.outboxStoreRuntime?.summarizeStoredChatOutboxes(outboxScopeHost).total,
656656
}),
657657
});

‎ui/src/e2e/sidebar-account-footer.e2e.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ suite.define(() => {
174174
await offline.waitFor({ state: "visible", timeout: 10_000 });
175175
expect(await offline.textContent()).toContain("Offline");
176176
expect(await offline.textContent()).toContain("Reconnecting…");
177+
await expect.poll(() => page.title()).toContain("(Disconnected)");
177178
await captureUnionProof(page, "sidebar-account-footer", "feature-dark-offline.png", [footer]);
178179

179180
const socketCount = await gateway.getSocketCount();
@@ -186,6 +187,7 @@ suite.define(() => {
186187
await expect
187188
.poll(() => footer.locator(".sidebar-footer-bar__status").count(), { timeout: 10_000 })
188189
.toBe(0);
190+
await expect.poll(() => page.title()).not.toContain("Disconnected");
189191
await gateway.emitGatewayEvent("shutdown", {
190192
reason: "gateway restart",
191193
restartExpectedMs: 5_000,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4276,6 +4276,7 @@ export const en: TranslationMap = {
42764276
eventStale: "Stale session",
42774277
},
42784278
connection: {
4279+
disconnectedTitle: "Disconnected",
42794280
queuedCount: "{count} queued",
42804281
reconnecting: "Reconnecting…",
42814282
restarting: "Restarting…",

0 commit comments

Comments
 (0)