Repository navigation
fix(tee): hash long recovery-file slugs to prevent collisions and shorten hints - #3266
Merged
KuSh merged 2 commits intoAug 20, 2026
Merged
Conversation
…rten hints The tee recovery filename embeds a command-derived slug (often a file path that duplicates the command the LLM already issued), costing ~12 tokens in every truncation hint. Long slugs (>24 chars) now collapse to a short readable prefix plus a 6-hex SHA-256 tag. This also fixes a latent collision in the old 40-char truncation: sibling paths sharing a long common prefix (e.g. several `git show` blobs from the same directory in the same second) truncated to an identical filename and overwrote each other's recovery file. Hashing the full slug makes distinct commands produce distinct filenames (~1-in-16M collision).
2 tasks done
3 tasks done
KuSh
requested changes
Aug 17, 2026
KuSh
left a comment
Collaborator
There was a problem hiding this comment.
Hi, LGTM except for some nitpicks
Address review nits on rtk-ai#3266: - Collapse short_hash to format!("{:x}", Sha256::digest(..))[..6] per suggestion. - Reword docs: 6 hex = 24 bits is not collision-resistant on its own (birthday bound ~few thousand slugs); safety here comes from also requiring the same readable prefix and epoch second.
Merged
This was referenced Aug 27, 2026
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
rtk 0.46.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## [0.46.0](rtk-ai/rtk@v0.45.0...v0.46.0) (2026-08-26) ### Features - find: dispatch on find's grammar; compress find output for unmodeled predicates ([#3603](rtk-ai/rtk#3603)) - find: tee tail hint when rtk imposes the result cap ([#3603](rtk-ai/rtk#3603)) ### Bug Fixes - find: never-worse guard, recovery hint, and dispatch on find's grammar ([#3603](rtk-ai/rtk#3603)) - git: don't misdetect a value-taking option's argument as a patch flag ([#3575](rtk-ai/rtk#3575)) - cicd: stop benchmark.sh deleting the tracked scripts/benchmark harness ([#3595](rtk-ai/rtk#3595)) - tee: hash long recovery-file slugs to prevent collisions and shorten hints ([#3266](rtk-ai/rtk#3266)) - benchmark: avoid negative curl/cargo cases that fail the benchmark job ([#3430](rtk-ai/rtk#3430)) - test: accept both Ask and Allow verdicts in rewrite tests ([#3147](rtk-ai/rtk#3147)) — Closes [#3146](rtk-ai/rtk#3146) - core: decode process output using Windows console code page ([#2717](rtk-ai/rtk#2717)) — Closes [#2452](rtk-ai/rtk#2452) - git: preserve patch output from log commands ([#2951](rtk-ai/rtk#2951)) — Closes [#2944](rtk-ai/rtk#2944) - discover: sanitize drive-letter colon so Windows discover finds sessions ([#2952](rtk-ai/rtk#2952)) — Closes [#2919](rtk-ai/rtk#2919) - stream: decode lossily instead of dropping lines on invalid UTF-8 ([#2997](rtk-ai/rtk#2997)) — Closes [#2994](rtk-ai/rtk#2994) ### Other - test(find): use the platform temp dir instead of /tmp ([#3717](https://github.com/rtk-ai/rtk/pull/3717))</pre> <p>View the full release notes at <a href="https://github.com/rtk-ai/rtk/releases/tag/v0.46.0">https://github.com/rtk-ai/rtk/releases/tag/v0.46.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17826
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fix(tee): recovery-file slugs (an embedded path that duplicates the command) are now hashed when long. This fixes a latent collision where two sibling paths truncated in the same second overwrote each other's recovery file, and it shortens the truncation hint by ~12 tokens.Test plan
cargo fmt --all --check && cargo clippy --all-targets && cargo test— clean on currentdevelop.