feat(web): surface Workbench diagnostics

This commit is contained in:
lyon
2026-06-20 16:03:05 +08:00
parent cf219821f0
commit d947b9e4e8
5 changed files with 315 additions and 26 deletions
@@ -13,6 +13,11 @@ test.describe("projection diagnostics visibility", () => {
await expect(page.locator(sessionTab("ses_projection_degraded"))).toHaveAttribute("data-projection-health", "degraded");
const card = page.locator(`${selectors.messageCard}[data-role="agent"][data-status="running"]`).last();
await expect(card).toContainText("状态更新超时");
await expect(card.locator(".projection-diagnostic")).toContainText("agentrun_result_timeout");
await expect(card.locator(".projection-diagnostic")).toContainText("trace_id");
await expect(card.locator(".projection-diagnostic")).toContainText("trc_projection_degraded");
await expect(card.locator(".projection-diagnostic")).toContainText("valuesPrinted");
await expect(card.locator(".projection-diagnostic")).toContainText("false");
await expect(card.locator(selectors.traceTimeline)).toHaveAttribute("data-projection-health", "degraded");
await expect(card.locator(".trace-empty")).toContainText("状态更新超时");
await expect(page.locator(selectors.commandSend)).toHaveAttribute("data-action", "cancel");
@@ -27,6 +32,9 @@ test.describe("SSE projection errors", () => {
await gotoWorkbench(page, "/workbench/sessions/ses_projection_sse_error");
const card = page.locator(`${selectors.messageCard}[data-role="agent"][data-status="running"]`).last();
await expect(card).toContainText("SSE 投影事件异常");
await expect(card.locator(".projection-diagnostic")).toContainText("workbench_sse_projection_error");
await expect(card.locator(".projection-diagnostic")).toContainText("req_e2e_workbench_sse_projection_error");
await expect(card.locator(".projection-diagnostic")).toContainText("/v1/workbench/events");
await expect(page.locator(sessionTab("ses_projection_sse_error"))).toHaveAttribute("data-projection-health", "degraded");
await saveScreenshot(page, testInfo, "projection-sse-error-visible");
});
@@ -39,6 +47,10 @@ test.describe("REST gap hydration errors", () => {
await gotoWorkbench(page, "/workbench/sessions/ses_trace_hydration_timeout");
const card = page.locator(`${selectors.messageCard}[data-role="agent"][data-status="running"]`).last();
await expect(card).toContainText("Trace 更新超时");
await expect(card.locator(".projection-diagnostic")).toContainText("trace_hydration_timeout");
await expect(card.locator(".projection-diagnostic")).toContainText("33333333333333333333333333333333");
await expect(card.locator(".projection-diagnostic")).toContainText("req_e2e_trace_hydration_timeout");
await expect(card.locator(".projection-diagnostic")).toContainText("/v1/workbench/traces/trc_trace_hydration_timeout/events");
await expect(card).toHaveAttribute("data-status", "running");
await expect(card.locator(selectors.traceTimeline)).toHaveAttribute("data-projection-health", "degraded");
await expect(page.locator(selectors.commandSend)).toHaveAttribute("data-action", "cancel");
@@ -53,6 +65,8 @@ test.describe("sealed final response diagnostics separation", () => {
await gotoWorkbench(page, "/workbench/sessions/ses_sealed_final_diag");
const card = page.locator(`${selectors.messageCard}[data-role="agent"][data-status="completed"]`).last();
await expect(card.locator(".projection-diagnostic")).toContainText("Trace 更新超时");
await expect(card.locator(".projection-diagnostic")).toContainText("req_e2e_sealed_final_trace_timeout");
await expect(card.locator(".projection-diagnostic")).toContainText("/v1/workbench/traces/trc_sealed_final_diag/events");
const finalResponse = card.locator(".message-text").filter({ hasText: "已完成的 sealed final response 不应被诊断覆盖。" });
await expect(finalResponse).toBeVisible();
await expect(finalResponse).not.toContainText("Trace 更新超时");