Skip to content

fix: type-only LLM error messages to stop 200-path leakage#478

Merged
cgfixit merged 1 commit into
mainfrom
claude/cyclaw-optimize-llm-error-redact
Jul 9, 2026
Merged

fix: type-only LLM error messages to stop 200-path leakage#478
cgfixit merged 1 commit into
mainfrom
claude/cyclaw-optimize-llm-error-redact

Conversation

@cgfixit

@cgfixit cgfixit commented Jul 9, 2026

Copy link
Copy Markdown
Owner

What

LocalLLMClient / GrokClient / ClaudeClient on_other handlers previously set message=f"... {str(e)}". That string flows through graph._generate_or_error into the HTTP 200 QueryResponse.answer / error fields without gate._sanitize_error (only the bare 500 path sanitizes).

Now:

  • on_other messages are type-only (LM Studio error: ValueError) with details.exc_type
  • _extract_content / _extract_claude_content ValueErrors no longer append exception text or content reprs that can echo proxy HTML / body fragments

Why / benefit

Stops accidental disclosure of URLs, body fragments, and credential-shaped strings in successful-status answers when generation fails. Root cause fixed once in the client (all three providers).

Risk to monitor

Operators lose the free-form exception message in the answer UI; type + logs still diagnose. Audit still gets code: message with the type-only message.

Verify

GROK_API_KEY=dummy pytest tests/test_client.py tests/test_graph.py tests/test_runtime_errors.py -q — all passed.

Scan context

CyClaw-Optimize continuation (ponytail + Karpathy + python-coding-agent). Companion to #477 (sanitizer FPs).

@cgfixit cgfixit marked this pull request as ready for review July 9, 2026 18:30
@cgfixit cgfixit merged commit 7cf80f2 into main Jul 9, 2026
29 checks passed
@cgfixit cgfixit deleted the claude/cyclaw-optimize-llm-error-redact branch July 9, 2026 18:30
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.

1 participant