You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
discover: the example command shown for a bucket changes between runs on the same history #4313
rtk discover prints one example command per bucket in its report. On the same unchanged ~/.claude/projects/ tree, the example for one bucket flips between runs of the same binary while the count and the estimate stay the same.
Observed on develop c529013e (Linux, LC_ALL=C, stdin from /dev/null) against a 6-project history tree with two git commands in one bucket, five runs each of rtk discover --all and rtk discover -p "":
The label came back status, log, log, log, status on --all and log, status, log, status, status on -p ""; count 2 and ~168 tokens never changed. Exit code 0 every time.
Where to look: the bucket keeps the first command it sees as its example (src/discover/mod.rs, the or_insert_with on the bucket maps around lines 478-492), and the order commands arrive in depends on fs::read_dir order in src/discover/provider.rs::discover_sessions_in_projects_dir and on HashMap iteration in src/discover/mod.rs. Neither is sorted before the example is chosen. Whichever one it is, a deterministic pick (sort the session paths, or keep the most frequent spelling) would make two runs of rtk discover on the same history produce the same report, which also matters for anyone diffing its --format json output.
Found while reviewing #2931; unrelated to that change (both the merge-base and the PR binaries show it).
discover's per-bucket example command is chosen non-deterministically from unsorted dir/HashMap iteration, making repeated runs on the same history produce different (though still correct) reports.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/discover/mod.rs
src/discover/provider.rs
Suggested Actions
Sort session paths before iterating in discover_sessions_in_projects_dir (src/discover/provider.rs)
Make the or_insert_with example pick deterministic in src/discover/mod.rs (lines ~478-492), e.g. lexicographic or most-…
Add a regression test running discover twice on a fixed fixture tree and diffing --format json output
Triaged automatically by wshm · This is an automated analysis, not a human review.
Activity
rtk-wshm-sync-bot commentedon Sep 27, 2026
🔍 Automated Triage
buglowSummary
discover's per-bucket example command is chosen non-deterministically from unsorted dir/HashMap iteration, making repeated runs on the same history produce different (though still correct) reports.
📁 Relevant files
src/discover/mod.rssrc/discover/provider.rsSuggested Actions
Triaged automatically by wshm · This is an automated analysis, not a human review.