Skip to content

fix(tee): render absolute log path in format_hint#1657

Open
truffle-dev wants to merge 1 commit intortk-ai:developfrom
truffle-dev:fix/tee-format-hint-absolute-path-1644
Open

fix(tee): render absolute log path in format_hint#1657
truffle-dev wants to merge 1 commit intortk-ai:developfrom
truffle-dev:fix/tee-format-hint-absolute-path-1644

Conversation

@truffle-dev
Copy link
Copy Markdown

Summary

Tee writes the captured output to a file under dirs::data_local_dir() and prints a hint line so a downstream consumer can read it back. When the file landed under $HOME, the hint was rendered with the ~ shorthand:

[full output: ~/Library/Application Support/rtk/tee/7_curl.log]

That string is not safe to copy verbatim into a shell:

  • cat "~/Library/Application Support/rtk/tee/..." does not expand ~ inside double quotes
  • cat ~/Library/Application Support/rtk/tee/... splits on the space and fails

Both paths the hint advertises are paths the consumer is expected to use as-is, so the shorthand is a trap on macOS (default data dir is ~/Library/Application Support) and on any Linux user that puts spaces in their home path.

Fix

Drop the ~ strip-prefix logic and render the absolute path. The path passed in is already absolute (built from data_local_dir()), so this is a one-line change to format_hint. The [full output: ...] enclosure stays.

canonicalize would also work but requires the file to exist at hint time, and the hint is built before the writer flushes, so absolute-only is the simpler fit.

Tests

Two regression tests cover the home-prefixed and space-containing shapes. cargo test --all 1689 passed.

Closes #1644

The tee hint shows where rtk wrote a command's full output so
downstream consumers (LLMs, scripts) can read it back. Until now
paths under $HOME were rendered with the `~` shorthand, which is
not safe to copy verbatim:

- `cat "~/Library/Application Support/rtk/tee/..."` does not
  expand `~` inside double quotes
- `cat ~/Library/Application Support/rtk/tee/...` splits on the
  space and fails

Rendering the absolute path keeps the existing `[full output: ...]`
enclosure stable and removes the trap. Two regression tests cover
the home-prefixed and space-containing paths.

Closes rtk-ai#1644
@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier labels May 1, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Removes the ~ home directory shorthand from the tee hint line, rendering the absolute path instead. The ~ shorthand broke shell copy-paste because it doesn't expand inside double quotes and splits on spaces when unquoted. Two regression tests are added to verify absolute paths and paths with spaces.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #1644


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants