Skip to content

fix(platform): show guardrail metrics read errors - #4401

Closed
yannickmonney wants to merge 2 commits into
mainfrom
fix/chat-health-guardrail-error
Closed

yannickmonney wants to merge 2 commits into
mainfrom
fix/chat-health-guardrail-error

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Guardrail metrics failures now render an explicit partial error with Retry while retaining chat health metrics. Added EN/DE/FR copy.

Verified: scoped oxlint and oxfmt; Vitest is blocked by the repository alias resolution in this environment.

Closes #3872

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Verdict: request changes on exact head f282b6f.

Finding (medium): when the chat-health query succeeds with summary.hasAnyData === false, the container returns the early empty-state panel before rendering ChatHealthMetricsPageView. If the guardrail query failed, guardrailsError is therefore omitted and the user sees no partial-error state or Retry, contrary to the required degraded guardrail behavior. The error needs to be preserved in the empty branch (or the branch delayed) while retaining the teaching panel.

The normal loaded path keeps chat-health cards intact, scopes Retry to refetchGuardrails, and the full chat-health failure remains unchanged. Locale wording is present in EN/DE/FR; DE uses “Du”, FR uses “Tu”, and no ß appears in the new strings.

Regression coverage is missing for the new guardrail failure/Retry path (the existing page tests do not exercise it), and the PR has no manual-register paragraph as required by the brief.

Validation: exact-head page test invocation was attempted with one worker but the UI harness fails before collection (z.number undefined from packages/shared schema). Scoped oxlint/oxfmt/type checks were attempted; the local tool run did not complete within the review window. CI is stalled under incident 3q1yb5m7ltvb and was not rerun.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

TALE-939 repair report for TALE-300 and TALE-359 (3729d02a-eb44-42b2-a68e-1bec2cebbcd6), ready for C12 re-review.

PR: #4401
Repair commit: ea6dfaa — fix(platform): retain guardrail errors without chat data
Confirmed the requested original head f282b6f before work and again before the fast-forward push. No main merge or force-push.

The container now shares the guardrail failure presentation between its loaded metrics and no-chat-data teaching panel. The partial error and Try again remain visible in the early-return path; Retry refetches only guardrail statistics. The full chat-health failure retains its original behavior. Existing EN/DE/FR messages are reused, with no new strings.

Verification:

  • 14 targeted component tests pass with /opt/node/bin/node, one worker, and a review-only server.fs.allow config for shared font assets. Tests cover EN/DE/FR partial failure with chat data, failure without chat data, query-only Retry and recovery in both paths, successful zero events, and the unchanged full failure.
  • Running the new tests against the original f282b6f page produces two expected failures: the no-chat-data error and its Retry. The repaired page was restored afterward.
  • Scoped type-aware oxlint and experimental type checking pass for the page, tests and lazy importer. Scoped oxfmt passes; the manual register gate passes (5 trees, 1476 boxes).
  • The automation register paragraph was added. git merge-tree checks across 81 open PR heads introduce no new register conflict; 21 older heads already conflict with that register on the baseline.
  • Real Chromium renders the partial error and teaching panel together. The visual-aspect-analyzer skill reports 100/100 for the settled rendered snapshot. The live fixture reports 99/100 for a small startup page-level layout shift, so this is not a claim of a clean live transition audit. Browser Retry behavior is covered by component tests, not the static visual snapshot.

CI: pending/queued at handoff; watched without rerunning any workflow. No failed check reported. C12 re-review and full CI remain open.

Workspace task reporting was unavailable: workspace_status returned not_granted. This authorized PR comment is the fallback report for both related tasks.

Delivery artifacts include the repair patch, changed source/register files, test and check logs, merge-tree evidence, browser fixture/screenshot and visual reports.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Re-review of exact repaired head ea6dfaa: no blocking findings in the repair.

The previous no-chat-data defect is resolved: the early MetricsLayout branch now carries the guardrail read failure and Retry alongside the teaching panel. The normal loaded view preserves the same partial failure; Retry calls only refetchGuardrails, while successful zero-event reads and the full chat-health failure retain their behavior. The new regressions exercise the empty branch, EN/DE/FR refusal copy, scoped Retry/recovery, zero-event controls and full failure. The automation register now documents that coverage.

Independent validation on the repaired head: 14 page component tests passed with one worker; scoped type-aware oxlint with type checking reports zero diagnostics for both changed TSX files; oxfmt check passes. A temporary review-only server.fs.allow config admitted the task worktree's shared dependency/font paths. CI remains pending; no jobs were rerun. This is a source/component re-review, not a claim of live backend or visual validation.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

TALE-953 independent exact-head re-review: REQUEST CHANGES for delivery; CODE ACCEPT for the repair.

Head: ea6dfaafd635db531c1877bac0042955562d51b2, unchanged from the brief. Current base: dd1cb498de2a17abf677c07ccffc7e82de157061. Head tree: d8d7375aa8fc403cf3fa0d7d639ae483f21a97ef. I authored no commits on this PR; task routing identifies C6 as implementation author. Shared GitHub/bot attribution does not identify the individual agent.

Close-out using single-file diffs from f282b6f2f22ad7787b317efe5bbf439bfd64f0e7:

Prior finding Exact-head result
Empty-chat early return loses guardrail error/Retry CLOSED: services/platform/app/features/analytics/chat-health/chat-health-metrics-page.tsx:624 constructs the shared notice, :643 includes it in the empty branch, :645 retains the teaching panel. Loaded view receives it at :673; full health failure retains precedence at :613.
Missing regressions CLOSED in source: chat-health-metrics-page.test.tsx:242 loaded EN/DE/FR failures, :270 empty-chat failure, :283 scoped Retry/recovery in both branches, :303 successful zero events, :332 full health failure. Execution NOT_RUN here.
Missing manual register CLOSED: services/platform/tests/manual/reference/automation.md:115 accurately describes component coverage and leaves live backend recovery, browser layout and screen-reader announcements manual.

Adversarial CODE read found no new blocking repair defect. The repair shares the existing error node without changing query arguments, external props or loaded behavior. packages/ui/src/components/metrics/metrics-layout.tsx:60 renders notices before children. Retry calls only refetchGuardrails (page.tsx:632), whose adapter retains a separate org/period-scoped key (services/platform/app/lib/backend/metrics.ts:155). The route tolerates preload rejection (services/platform/app/routes/dashboard/$id/settings/metrics/chat-health.tsx:45) and still renders the page; the lazy importer needs no change.

Old-code discrimination by reading, not execution: the empty-chat case at test :270 would fail on f282b6f because its notice was omitted. The hasAnyData=false instance at :283 would fail finding Retry. The three loaded-locale cases, loaded Retry case, zero-event case and full-failure case should pass on that old head; they protect existing behavior. Recovery is simulated by clearing the mocked error and rerendering, so it does not prove backend recovery, fetching transitions or focus handoff. Earlier comments report 14 passing component tests; this run did not reproduce them.

Part/topic Disposition at this head
B / CODE ACCEPT by source inspection. Executable regression, lint/typecheck and manual-register gate NOT_RUN under this brief.
B / SECURITY ACCEPT for the touched display boundary: failureDetail prevents serialized payload display; shared UI renders text. No new auth/credential/tool/connector boundary. Scanner NOT_RUN.
B / DATA ACCEPT for read-state integrity: failed guardrails remain distinct from successful zero events; health data survives partial failure; org/period keys unchanged. Persistent writes, schema and migrations N/A. Actual cached-refresh/recovery proof remains owed below.
B / documentation ACCEPT for register accuracy. Product/API contract, deployment, dependency/toolchain and migration changes N/A.
B / performance No new request loop or material computation in repair; benchmark N/A. Fetching/repeated Retry behavior unobserved.
A / UX-CLARITY BLOCKED / NOT_RUN: browser evidence that error and loaded/teaching content are clear together, failure differs from no events, and retry/repeated failure/recovery are understandable.
A / A11Y BLOCKED / NOT_RUN: keyboard reachability, visible focus, focus through Retry/repeated failure/removal on recovery, screen-reader announcements and contrast. Existing loaded-state axe test does not cover the new empty failure branch.
A / LOCALE EN/DE/FR keys present and reused in source. Browser evidence BLOCKED / NOT_RUN for all three languages in loaded/empty failure and Retry/recovery states, including wrapping and untranslated fallback checks.
A / REL-MANUAL Register source ACCEPT; execution BLOCKED / NOT_RUN: actual guardrail backend failure with successful health, with and without chat data; scoped Retry request; repeated failure; recovery; cached/background refresh; zero-events and full-health-failure controls.
A / UI-RESPONSIVE BLOCKED / NOT_RUN: desktop/narrow/mobile EN/DE/FR layouts, notice/Retry wrapping, overflow, preserved cards/teaching content, loading/retry/recovery transitions.

All five Part A cells require a browser stack phase and atomic reservation unavailable to this run. Source acceptance does not admit execution. The task's named topics are dispositioned above; a broader organization matrix could not be retrieved because workspace_status returned not_granted.

Delivery blockers: GitHub reports mergeable=false, mergeable_state=dirty at the base above. An author conflict slice is needed, followed by review of its new head. No update-branch or merge attempted.

Exact-head CI snapshot: 78 completed check runs: 48 success, 26 skipped, 1 neutral, 3 failure. Failed checks are Unit (workspaces), Unit, and CI ready (Checks). The workspace log identifies services/sandbox-runtime/daemon/src/exec-completion.test.ts:35 / :187: barrier not reached after five seconds in “attach during terminal replay finish cannot rearm the orphan deadline or reap sibling-dependent leftovers”. This is outside changed files; it is not proven harmless or pre-existing. UI, CI ready (Build/E2E), and all four platform Playwright shards report success; those statuses do not establish feature-specific manual coverage or a clean retry/visual audit. Legacy commit status is pending with no statuses; the check-run snapshot above is the substantive result.

Next owners: C6/author for conflict resolution; Fleet/CI owner for daemon-failure diagnosis and CI admission; Fleet for separately reserved Part A review. Next check: the next dispatch after an owner reports a changed head or CI resolution, without polling unchanged failures. No tests, installs, builds, stack, commits, pushes, CI reruns or Ops-review credential use. No consuming resources started; no owned cleanup required.

Review, receipt, exact source files, single-file repair patches, source hashes, API snapshots and failed-job log are delivered as TALE-953 native attachments. Direct card commenting is blocked by the unavailable workspace connector; this authorized PR comment and the task final report serve as receipt fallback.

@yannickmonney
yannickmonney force-pushed the fix/chat-health-guardrail-error branch from ea6dfaa to bdb9f4f Compare October 9, 2026 02:15
@yannickmonney
yannickmonney disabled auto-merge October 9, 2026 02:56
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Independent exact-head review: REQUEST CHANGES at bdb9f4fcd5431f3633a10d4a90c260cb46436938. Reviewer: agent #2 Independent Review (TALE-359), run 39ab3c9a; native verdict on TALE-300.

Still holds:

  • The page and test hunks are line-for-line identical to the re-reviewed ea6dfaaf. The rebase only moved the three guardrailsLoadFailed strings into messages/<locale>/analytics.yml.
  • The PR is mergeable/clean, and exact-head CI is green: 51 success, 26 skipped, 1 neutral, 0 failed. UI 1-4/4 ran fresh (turbo Cached: 0).
  • Retry is scoped to refetchGuardrails, and a full chat-health failure keeps precedence.

F1 (blocking). When the guardrail read fails with no data, the loaded view still renders the guardrail section as a successful zero period, right under the new alert:

  • the "Guardrail events" card shows 0 and "0 blocked" (chat-health-metrics-page.tsx L487-496);
  • "By kind" and "By filter" are empty (L544-558);
  • the trend chart says "No guardrail events" (L560 and L310, chatHealth.guardrails.chart.noData).

So the page states "Couldn’t load guardrail metrics" and "No guardrail events" at once. That is the confusion #3872 describes: missing security telemetry looks like no activity.

The failure test (chat-health-metrics-page.test.tsx L242-268) does not assert that these figures are absent. #4272 and #4345 withhold zero figures when a read is unavailable.

Fix: while guardrails are unavailable, replace or omit the Guardrail events value and the Guardrails section with the failure state, and keep the chat-health cards. Add the absence assertions, and keep the zero-events control at L303.

Should fix (not blocking on their own):

  • F2: a failed refresh over cached guardrail figures says "Couldn’t load" above figures that are still shown. Use stale/refresh wording, as fix(platform): distinguish failed automation metrics reads #4345 does with readStateOf and refreshFailed.
  • F3: "Try again" appears both in the message text and on the button (EN, DE and FR).

Merge readiness: the head is 261 commits behind main, and main is currently red (Type check, agent-oauth.ts TS2769 since #4898/#4899). Please merge only after the repair, a green main and a fresh exact-head run.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #4907 (merged to main on 2026-10-13, 7132169732), which contains this PR's two commits (show guardrail metrics read errors, retain guardrail errors without chat data) plus the unavailable-metrics state that #4905 added. All 159 lines this PR adds are on current main. Closed during the branch cleanup of 2026-10-13.

@yannickmonney
yannickmonney deleted the fix/chat-health-guardrail-error branch October 13, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(platform): Chat Health hides a failed guardrail metrics read as an empty section

1 participant