Skip to content

fix(ensure): stop re-asking cheaper /compact models when already set - #213

Merged
fkiene merged 1 commit into
mainfrom
fix/ensure-compact-reprompt
Jul 23, 2026
Merged

fix(ensure): stop re-asking cheaper /compact models when already set#213
fkiene merged 1 commit into
mainfrom
fix/ensure-compact-reprompt

Conversation

@fkiene

@fkiene fkiene commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • compact_models_configured() always returned false on a real config.toml because it used str::parse::<toml::Value>(). In toml 1.x that is a single-value parser; multi-key documents fail with "unexpected content, expected nothing", and .ok() swallowed the error.
  • llmtrim ensure / doctor therefore always thought [compact].models was missing and re-prompted Use cheaper models for Claude Code /compact (Haiku → Sonnet)? even when it was already configured. compact status and the proxy were fine — they already used toml::from_str.
  • Parse with toml::from_str (same as every other config reader), extract a pure helper for the check, and add a regression test that includes a multi-key document.

Test plan

  • cargo test -p llmtrim-core --lib compact_models (8 passed, including new multi-key regression)
  • After merge/install: llmtrim doctor no longer warns about compact when ~/.config/llmtrim/config.toml has [compact] models = [...]
  • llmtrim ensure does not re-prompt the cheaper /compact models question when already configured

@fkiene
fkiene enabled auto-merge (squash) July 23, 2026 10:32
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/llmtrim-core/src/config.rs 85.71% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

compact_models_configured() used str::parse::<toml::Value>(), which in
toml 1.x only accepts a single value. Real config.toml files failed that
parse, the error was swallowed, and ensure/doctor always re-prompted for
cheaper /compact models even when [compact].models was already set.
Parse with toml::from_str like the rest of the config loaders.

Signed-off-by: François Kiene <46886660+fkiene@users.noreply.github.com>
@fkiene
fkiene force-pushed the fix/ensure-compact-reprompt branch from ab7fb5d to 81749c2 Compare July 23, 2026 10:38
@fkiene
fkiene merged commit 8187d7f into main Jul 23, 2026
31 checks passed
@fkiene
fkiene deleted the fix/ensure-compact-reprompt branch July 23, 2026 10:44
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.

1 participant