Repository navigation
Conversation
The tee log is the recovery hatch when filters truncate. It used head-only truncation at max_file_size (1MB by default), which discarded exactly the information that tail-heavy commands (test runners, build summaries, error trailers) put at the end. So a make test run with 17000+ progress lines would tee the first 1MB of progress and lose the pass/fail summary. Switch to a 25/75 head/tail split: keep the first quarter of the budget (prologue, command echo, banner) and the last three quarters (where the useful output lives for tail-heavy commands), with a marker between documenting how many bytes were dropped. UTF-8 char boundaries are respected on both ends. Updated existing UTF-8 boundary tests to exercise the new split, and added a tail-preservation test that simulates a make test run.
|
Thanks for digging into the recovery path. The mechanism this patch edits was replaced on develop by #3278 (merged 2026-09-09), which moved output recovery to a content addressed sqlite store selected by the [retriever] mode setting and left the tee file writer as the legacy path in src/core/tee_file.rs. That store already keeps the hidden tail instead of the prefix the agent has already seen, so the head bias you hit no longer applies on the default path, and write_tee_file no longer lives in src/core/tee.rs, so the change cannot land as written. Two gaps are still worth a small issue or a narrow PR against the current code: the legacy tee writer still keeps only the head when output exceeds max_file_size, and the store cuts at the first max_entry_bytes of the hidden region, so a very long hidden tail still loses its end. Please comment or reopen if a part of this was missed. |
Before
write_tee_filetruncated raw output atmax_file_size(1MB default) by keeping the first 1MB of bytes and dropping the rest. The tee log is the recovery hatch agents fall back to when the live filter dropped a needed signal, but for tail-heavy commands the head is the part that doesn't matter.Triggered by
rtk make teston a php-src checkout: ~17000 phpt progress lines followed by a pass/fail summary. The make filter kept only the first ~16 progress lines (separate fix onfeat/php-tooling). The tee log captured 1MB of progress lines and also dropped the summary. Same head-bias on a tail-heavy command, two layers down.After
write_tee_filekeeps a 25/75 head/tail slice with a--- N bytes truncated from middle ---marker between them. Default 1MB budget gives ~256KB of head plus ~768KB of tail. The slicer rounds both cuts to UTF-8 char boundaries, so multi-byte input never panics.Tail gets the larger share because tee mostly captures build and test output, where summaries and failure trailers live at the end. The head stays because the prologue often shows the command echo and config that explain what was running.
Scope rationale
max_file_size,RTK_TEE=0,force_tee_hintbehave the same.feat/php-toolingbecause that branch already touches PHP tooling. This PR fixes the recovery layer for every tail-heavy command, not just make.Backward compatibility: marker text changed from
--- truncated at N bytes ---to--- N bytes truncated from middle ---. Visible if anyone parses tee logs programmatically.Test plan
cargo test --bin rtk: 1721 passed, 0 failedcargo clippy --all-targets: no new warningscargo fmt --all: no churntest_write_tee_file_keeps_tail: 3000-line phpt-style run, verifies head + marker + tail all survivetest_write_tee_file_truncation_utf8_boundaryandtest_write_tee_file_truncation_emoji: new split exercised with multi-byte chars at both cuts