Skip to content

feat(discover): skip tiny real outputs in missed-savings estimate#2676

Open
wilmerdooley wants to merge 1 commit into
rtk-ai:developfrom
wilmerdooley:oss/issue-2130
Open

feat(discover): skip tiny real outputs in missed-savings estimate#2676
wilmerdooley wants to merge 1 commit into
rtk-ai:developfrom
wilmerdooley:oss/issue-2130

Conversation

@wilmerdooley

@wilmerdooley wilmerdooley commented Jun 28, 2026

Copy link
Copy Markdown

Resolves #2130.

Summary

rtk discover flags commands RTK handles but cannot profitably compress as missed savings, even when the real output was tiny. For example, a session with many small git push outputs was reported as thousands of saveable tokens.

  • When the measured output size is known (output_len), discover now skips a supported command whose output is below MIN_DISCOVER_FALLBACK_OUTPUT_TOKENS (100 tokens), so genuinely small outputs no longer inflate the estimate.
  • When the output size is unknown, the existing category-average estimate is unchanged.

This narrows the false positives the issue describes. It does not yet add the persisted fallback-size logging or the --accurate mode the issue also proposes, and the estimate still uses category averages when real output size is unavailable. Happy to follow up on those if you would like them in this PR or a separate one.

Test plan

  • cargo fmt --all -- --check, cargo clippy --all-targets: clean.
  • cargo test discover::: 428 passed, 0 failed.
  • Behavioral check: a discover run over a log with a small-output git push reported it as saveable before the change and omits it after.
  • New unit tests cover the threshold boundary (below is skipped, at or above is kept) and the unknown-size category-average fallback.

@wilmerdooley wilmerdooley changed the title feat: discover: add output-size logging to fallback path for accurate feat(discover): skip tiny real outputs in missed-savings estimate Jun 28, 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.

discover: add output-size logging to fallback path for accurate missed-savings estimates

1 participant