rtk-ai/rtk

Output lost on composite commands (make ci-local / vitest) - summary lines removed

Open

#1,035 创建于 2026年4月5日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (2,914 fork)batch import
area:clibugeffort-mediumfilter-qualityhelp wantedplatform:macospriority:high

仓库指标

Star
 (48,085 star)
PR 合并指标
 (平均合并 11天 1小时) (30 天内合并 45 个 PR)

描述

Environment

  • RTK version: 0.34.3
  • OS: macOS Darwin 24.6.0
  • Claude Code hook config:
{
  "PreToolUse": [{
    "hooks": [{"command": "rtk-rewrite.sh", "type": "command"}],
    "matcher": "Bash"
  }]
}

Problem

RTK's output filtering causes critical CI result lines to be lost when running composite/long commands. Two specific issues observed:

1. vitest output parsing failure

Running npx vitest run produces:

[RTK:PASSTHROUGH] vitest parser: All parsing tiers failed

RTK cannot parse vitest's output format. The passthrough fallback sometimes still loses output.

2. make target output is cut off

Running make ci-local (which chains ruff check + pytest + vitest + quality check) gets cut off at ~13% of pytest results:

tests/unit/.../test_agent_frontmatter_fixtures[valid/agent-valid.md-True] PASSED [ 13%]
... (1379 lines truncated)

The cut removes:

  • The pytest summary line (251 passed, 18 skipped)
  • The entire vitest run (277 passed)
  • The quality check results

This means we cannot determine if CI passed or failed from the output, even though the exit code was 0.

3. File redirect also affected

Even when redirecting to a file (make ci-local > /tmp/output.log 2>&1), the log file contains the same ... (1379 lines truncated) marker, suggesting RTK filters before the output reaches the file.

Expected Behavior

  • Long composite commands (make targets chaining multiple tools) should not lose their summary/verdict lines
  • At minimum, the last N lines (tail) should always be preserved, as CI tools print pass/fail summaries at the end
  • vitest format should be recognized, or unknown formats should pass through cleanly

Suggested Fix

  1. Always preserve tail: Even when trimming middle sections, keep the last 20-30 lines (most CI tools print summaries at the end)
  2. Whitelist make/composite commands: Don't filter output from make, npm test, npx vitest etc.
  3. vitest parser: Add vitest output format support alongside existing jest/pytest parsers

Workaround

Remove the RTK hook from Claude Code settings entirely, losing all token-saving benefits.

贡献者指南