Skip to content

[FIX] Chat error/message pipeline: error cards, control-token leak, duplicate replies - #69

Open
ScottieR wants to merge 4 commits into
masterfrom
cuj/chat-error-pipeline
Open

ScottieR wants to merge 4 commits into
masterfrom
cuj/chat-error-pipeline

Conversation

@ScottieR

Copy link
Copy Markdown
Owner

Fixes #50, fixes #54 — from the 2026-08-24 Sloane health-forms CUJ test.

What broke in the test

Sloane's first-ever reply was a raw GatewayClientRequestError: FailoverError: No API key found for provider "google" with container paths and a CLI remediation; its recovery message rendered leading with a literal [[reply_to_current]] token and appeared twice back-to-back.

Changes

  • System-error card: errors render as a distinct card (plain-language headline, raw error behind Show technical details, one-click Run Diagnostics) instead of agent prose. Legacy persisted ⚠️ System Error messages route through the same card.
  • Unreachable error mapping fixed: the No API key found for provider branch was nested inside the 429/quota branch, so plain missing-key errors matched nothing and rendered raw. Hoisted it; this also fixes the quota branch clobbering its own rate-limit copy with the generic "API Key is missing" fallback.
  • Control-token stripping + dedup: stripAgentControlTokens() strips leading [[…]] directives at every agent-text ingestion point (send, retry, history poll, dedup normalizer). The dedup fix is what kills the duplicate: send-path and history-poll copies differed only by the token prefix, defeating the equality check.

Testing

  • New unit tests for stripAgentControlTokens (leading, stacked, mid-message bracket text untouched)
  • Full frontend suite: 43 files / 359 tests pass; tsc --noEmit clean

🤖 Generated with Claude Code

…uplicate replies

Three failures from the 2026-08-24 Sloane CUJ test (issues #50, #54):

- Errors now render as a system-error card — plain-language headline,
  raw error behind a 'Show technical details' disclosure, and a Run
  Diagnostics button — never as agent prose. Legacy persisted
  '⚠️ System Error' messages render through the same card.
- The 'No API key found for provider' mapping was nested inside the
  429/quota branch and unreachable for plain missing-key errors, so the
  raw FailoverError rendered verbatim; hoisted to its own branch. This
  also fixes the quota branch unconditionally overwriting its own
  rate-limit message with the generic 'API Key is missing' fallback.
- OpenClaw [[reply_to_current]]-style control tokens are stripped at
  every agent-text ingestion point (send response, retry response,
  history poll, dedup normalizer). Stripping in the dedup normalizer is
  what fixes the duplicate delivery: the send path and history poll each
  delivered a copy, and the token prefix on one side defeated the
  text-equality check.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ScottieR added a commit that referenced this pull request Aug 25, 2026
…ure (#91)

PR #69 (a diff centered on the 3,000-line ChatTab.tsx) exhausted the
40-turn review budget twice in ~3 minutes without ever reaching the
structured-output call, and with show_full_output off the log recorded
nothing between init and error_max_turns — undiagnosable by design.
Raise the budget to 60 (job timeout still bounds the worst case) and
turn on full output so the next exhaustion shows where the turns went.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
ScottieR and others added 2 commits August 24, 2026 18:30
…ster

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…vals

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant