Skip to content

Parser fallback truncates to 500 chars on parse failure — LLM gets near-empty output #620

@FlorianBruniaux

Description

@FlorianBruniaux

Problem

When the parser encounters an unexpected tier or panics, src/parser/mod.rs:92,99 truncates output to 500 characters as a "safe fallback".

500 chars is almost nothing — a typical error message from vitest, playwright, or cargo test is 2-5x that size. Claude receives a truncated error with no way to diagnose it, then loops trying different commands.

Root cause

src/parser/mod.rs:92,99:

// When tier > max, fallback to first 500 chars
output[..500.min(output.len())].to_string()

Impact

  • Vitest/Playwright failure messages are cut mid-sentence
  • Claude can't see the actual assertion failure or stack trace
  • Claude retries the test command, generating duplicate truncated output
  • Loop continues until context limit or user intervention

Proposed fix

Two options (pick one or both):

Option A — Raise truncation limit:
Change 500 → 3000 chars. Enough to show full error messages.

Option B — Passthrough on failure (preferred):
When the parser fails, return the unmodified raw output instead of truncating. RTK's contract is "smaller output or the same output" — never less signal than the raw command.

Acceptance criteria

  • Parse failure returns ≥ the full output of the underlying command
  • No test failure message is truncated mid-way
  • RTK never returns less information than the raw command on parser error

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical: causes LLM loops, worse than raw commandbugSomething isn't workingfilter-qualityFilter produces incorrect/truncated signal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions