Skip to content

rtk compresses Playwright test output too aggressively — agents can't debug E2E failures (by Claude Code Opus 4.6 🤖) #690

Closed

Description

@rquintino

Summary
When Claude Code agents run Playwright E2E tests through rtk, the compressed output strips critical debugging information (DOM snapshots, locator details, expected-vs-received diffs, retry traces). This causes agents to spend 3-5x more iterations debugging test failures compared to raw output, because they can't see why a test failed.

Observed Impact
In a real session building an agentic sample app, the E2E test phase (Phase 6) consumed:

170 tool calls and ~3.6M tokens over 60 minutes
The agent was stuck in loops re-running tests without enough context to fix failures
With raw Playwright output, this phase would likely have taken ~20 minutes / ~1M tokens
The root cause: rtk rewrites npx playwright test → rtk playwright test and npm run test:e2e → rtk npm run test:e2e, which compresses the output by ~90-99%. For Playwright specifically, this compression removes the most valuable debugging signals.

Reproduction
Raw Playwright output on failure (~200-500 lines with DOM snapshot):
npx playwright test --reporter=list

RTK-compressed output on same failure (~5-20 lines, no DOM context):
rtk playwright test --reporter=list

What Gets Lost
Playwright's error output on failure includes:

Locator resolution details — what the selector matched (or didn't)
DOM snapshots — the actual page structure at time of failure
Expected vs received — exact assertion diffs
Retry timeline — what changed between retries
Call log — the sequence of actions leading to failure
All of these are essential for an agent to diagnose and fix the test. RTK's compression treats them as verbose noise and strips them.

Suggested Fix
Consider one or more of:

Allowlist test runners — skip compression for playwright test, vitest, jest, pytest commands (or at least when they exit non-zero)
Pass-through on non-zero exit — when a command fails, the full output is almost always needed for debugging. Compress successes, pass through failures.
--no-compress flag — let the hook or user opt out for specific commands: rtk --no-compress playwright test
Configurable compression level per command category — test output needs lighter compression than, say, npm install or git log
Option 2 (pass-through on failure) would be the highest-impact, lowest-friction fix — successful test runs don't need detailed output, but failures absolutely do.

Environment
rtk 0.30.0
Playwright 1.56.0
Claude Code with PreToolUse hook rewriting Bash commands
Next.js 15 project with 30 E2E tests

Context
RTK is genuinely valuable — the token savings on git, npm install, ls, etc. are excellent. This issue is specifically about test runner output where compression actively hurts agent productivity. The net token cost increases because the agent wastes tokens re-running tests it can't debug.

Activity

  1. added
    P2-important
    filter-quality
    on Mar 19, 2026
  2. added
    bug
    effort-medium
    filter-quality
    and removed
    filter-quality
    on Mar 20, 2026
  3. pszymkowiak commented on Mar 20, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 90%

    Summary

    RTK's output compression strips critical Playwright debugging info (DOM snapshots, diffs, locators) on test failures, causing agents to waste tokens re-running tests. PR #729 already in progress. Related to #740 (cargo test loses diagnostics on failure).


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  4. added a commit that references this issue on Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-importantbugeffort-mediumfilter-qualitypriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions