diff --git a/ui/src/pages/debug/debug-page.ts b/ui/src/pages/debug/debug-page.ts index 5c859d6e5715..51a1c292fcd1 100644 --- a/ui/src/pages/debug/debug-page.ts +++ b/ui/src/pages/debug/debug-page.ts @@ -1,6 +1,6 @@ import { consume } from "@lit/context"; import { initialState, Task, TaskStatus } from "@lit/task"; -import { html } from "lit"; +import { html, nothing } from "lit"; import { state } from "lit/decorators.js"; import type { EventLogEntry } from "../../api/event-log.ts"; import type { GatewayBrowserClient } from "../../api/gateway.ts"; @@ -34,6 +34,7 @@ class DebugPage extends OpenClawLightDomElement { @state() private debugCallParams = "{}"; @state() private debugCallResult: string | null = null; @state() private debugCallError: string | null = null; + @state() private debugDiagnosticsError: string | null = null; @state() private eventLog: readonly EventLogEntry[] = []; private readonly polling = new PollController( @@ -55,6 +56,7 @@ class DebugPage extends OpenClawLightDomElement { client ? loadGatewayDiagnostics(client, signal) : initialState, onComplete: (result) => { this.diagnosticsTaskActiveClient = null; + this.debugDiagnosticsError = null; this.debugStatus = result.status; this.debugHealth = result.health; this.debugModels = result.models; @@ -62,7 +64,7 @@ class DebugPage extends OpenClawLightDomElement { }, onError: (error) => { this.diagnosticsTaskActiveClient = null; - this.debugCallError = String(error); + this.debugDiagnosticsError = String(error); }, }); private readonly subscriptions = new SubscriptionsController(this) @@ -122,6 +124,7 @@ class DebugPage extends OpenClawLightDomElement { this.debugHeartbeat = null; this.debugCallResult = null; this.debugCallError = null; + this.debugDiagnosticsError = null; } private syncPolling() { @@ -156,7 +159,7 @@ class DebugPage extends OpenClawLightDomElement { this.debugCallError = null; this.debugCallResult = null; const gateway = this.gatewaySource; - const epoch = this.callEpoch; + const epoch = ++this.callEpoch; const isCurrent = () => this.connected && this.client === client && @@ -179,7 +182,7 @@ class DebugPage extends OpenClawLightDomElement { } override render() { - const body = renderDebug({ + const debugView = renderDebug({ loading: this.diagnosticsTask.status === TaskStatus.PENDING, status: this.debugStatus, health: this.debugHealth, @@ -196,6 +199,12 @@ class DebugPage extends OpenClawLightDomElement { onRefresh: () => void this.loadDiagnostics(), onCall: () => void this.callDebugMethod(), }); + const body = html` + ${this.debugDiagnosticsError + ? html`