Skip to content

fix(tee): render absolute log path in hints instead of ~ shorthand#2701

Closed
cc1a2b wants to merge 1 commit into
rtk-ai:developfrom
cc1a2b:fix/tee-shell-safe-hint-path
Closed

fix(tee): render absolute log path in hints instead of ~ shorthand#2701
cc1a2b wants to merge 1 commit into
rtk-ai:developfrom
cc1a2b:fix/tee-shell-safe-hint-path

Conversation

@cc1a2b

@cc1a2b cc1a2b commented Jun 28, 2026

Copy link
Copy Markdown

Summary

  • Fixes Tee hint path with ~ shorthand breaks on paths with spaces (not shell-safe) #1644: the tee hint paths were rendered with the ~ home-directory shorthand, which is not safely copy-pasteable. ~ does not expand inside quotes, and home paths can contain spaces (e.g. macOS ~/Library/Application Support), so agents/LLMs that reuse the path verbatim hit "file not found" (and space/backtick paths can even trigger spurious tool-permission prompts).
  • Renders the absolute path in display_path — the single source shared by both the [full output: …] hint and the [see remaining: tail -n +N …] hint. The path is already absolute (built from data_local_dir()), so this only drops the ~ strip-prefix step.
  • Adds a regression test for a path under the home directory; the existing format_hint tests use /tmp paths and never exercised the ~ branch.

Note: this is a fresh, rebased-on-develop take on the same fix previously explored in the now-closed #1657 (closed by its author as stale), extended to cover both hints via the shared display_path helper plus a home-path regression test.

Test plan

  • cargo fmt --all -- --check — clean
  • cargo clippy --all-targets — no new warnings on tee.rs
  • cargo test --bins core::tee — 21 passed (incl. new test_display_path_is_shell_safe_for_home_paths)
  • Behavior: a hint for $HOME/Library/Application Support/rtk/tee/… now renders the absolute path (no ~), so cat "<path>" works when pasted.

All changes target the develop branch.

The tee "full output" and "see remaining: tail …" hints rendered the log
path with the `~` home-directory shorthand. That form is not usable when
copied verbatim into a follow-up shell command: `~` does not expand inside
quotes and home paths can contain spaces (e.g. macOS
`~/Library/Application Support`), so agents/LLMs that reuse the path hit
"file not found" — and paths with spaces/backticks can even trigger
spurious permission prompts.

Render the absolute path in `display_path`, the single source shared by
both hints. The path is already absolute (built from `data_local_dir()`),
so this only drops the `~` strip-prefix step.

Add a regression test for a path under the home directory; the existing
tests use `/tmp` paths and never exercised the `~` branch.

Closes rtk-ai#1644
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cc1a2b cc1a2b closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tee hint path with ~ shorthand breaks on paths with spaces (not shell-safe)

2 participants