Skip to content

Fix model pricing refresh without PowerToys integration - #442

Merged
Finesssee merged 1 commit into
nesszer:mainfrom
StreetJammer:fix/pricing-refresh-without-powertoys
Sep 8, 2026
Merged

Fix model pricing refresh without PowerToys integration#442
Finesssee merged 1 commit into
nesszer:mainfrom
StreetJammer:fix/pricing-refresh-without-powertoys

Conversation

@StreetJammer

@StreetJammer StreetJammer commented Sep 7, 2026

Copy link
Copy Markdown

Summary

Fix dynamic model-pricing refresh being incorrectly gated behind the optional PowerToys status pipe.

refresh_providers schedules local usage enrichment, but powertoys_local_usage_provider_ids returned an empty list whenever powertoys_status_pipe_enabled was false (the default). That enrichment path contains the only call to refresh_unknown_models_if_needed, so a normal installation without PowerToys integration could never download the models.dev pricing cache. Models absent from the bundled table, such as gpt-6-astra, remained marked unpriced even when models.dev already supplied their prices. Refreshing Usage & Spend only rescanned usage and did not fetch the missing catalog.

  • Select enabled Codex/Claude providers independently of the PowerToys setting; rename the helper to local_usage_provider_ids.
  • Preserve existing background-task coalescing and supported/enabled-provider filtering.
  • Keep the actual PowerToys pipe server opt-in; no settings or credentials are changed, and no model prices are hardcoded.
  • Add regression coverage for Codex with the pipe disabled and for supported/enabled-provider filtering with the pipe both off and on.

Related issue

No existing issue linked. Reproduced on v0.55.0; the same gate is present on current main.

Affected areas

  • Provider-specific behavior: local Codex/Claude pricing enrichment
  • Startup / background behavior
  • Other: Usage & Spend pricing completeness
  • No settings UI, installer, or dependency changes.

Validation

Native Windows validation against the patched tree:

  • Regression RED: the two new tests failed before the fix (empty provider lists instead of Codex/Claude).
  • Regression GREEN: both tests pass after removing the gate.
  • cargo fmt --all --check
  • cargo test --workspace --locked: 1,760 tests passed (1,396 shared library, 1 CLI, 363 desktop).
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • pnpm test: 291 tests passed across 47 files.
  • pnpm run build: locale check, TypeScript check, and Vite build passed.
  • pnpm run tauri:build: optimized Windows desktop executable built successfully.
  • Independent review: no code/spec/security blockers found.

The workspace emits an existing ignored member-profile warning; frontend tests emit existing React act/locale-test warnings. No test failures. Used the locked dependencies and pnpm 11.24.0; no lockfiles changed.

Runtime proof

On a Windows installation with Codex enabled, powertoys_status_pipe_enabled=false, and no model-pricing/models-dev-v1.json:

  1. The existing CLI reported gpt-6-astra in modelPricingCompleteness.partial.unpriced_models.
  2. Launching the freshly built patched desktop app automatically created the pricing cache containing Astra.
  3. The existing CLI then no longer reported Astra as unpriced; PowerToys remained disabled.

No caches were manually seeded or cleared. codex-auto-review remains unpriced; this change does not invent a price for unknown models.

UI / tray proof

No UI layout/control changes. Windows computer-use was unavailable (native helper pipe missing; CUA Driver not installed), so visual UI proof was not captured. The fresh Windows executable and the cache/CLI read-back above provide functional proof of the reported pricing issue, not visual proof.

Notes for reviewers

Local pricing enrichment now runs for enabled Codex/Claude providers even without PowerToys integration. It retains the existing single-flight guard, scan/cache logic, and pricing refresh throttles. The named-pipe server remains independently guarded in main.rs.

Summary by CodeRabbit

  • Bug Fixes
    • Local usage information now includes enabled Codex and Claude providers even when PowerToys status integration is unavailable or disabled.
    • Unsupported and disabled providers are excluded from local usage results, improving accuracy.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: c49aa599-d213-476b-8cf4-e309dadfa035

📥 Commits

Reviewing files that changed from the base of the PR and between 1e3d04c and b24b123.

📒 Files selected for processing (1)
  • apps/desktop-tauri/src-tauri/src/auto_refresh.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Local usage enrichment now selects enabled codex and claude providers without depending on the PowerToys status-pipe setting. Tests cover provider filtering and Codex enrichment when PowerToys is disabled.

Changes

Local usage enrichment

Layer / File(s) Summary
Provider selection and enrichment validation
apps/desktop-tauri/src-tauri/src/auto_refresh.rs
The provider-ID helper no longer checks PowerToys status. Refresh enrichment uses the shared provider list. Tests cover Codex enrichment without PowerToys and filter unsupported or disabled providers.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to b24b1

Enabled Codex and Claude providers can now refresh local usage and model pricing without PowerToys enabled, while unsupported and disabled providers remain excluded. No current merge-blocking risk is identified.

Suggested reviewers: finesssee

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing model pricing refresh when PowerToys integration is disabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Finesssee

Copy link
Copy Markdown
Collaborator

Hey, thanks for the PR. I will review it ASAP.

@Finesssee

Copy link
Copy Markdown
Collaborator

Thermo-nuclear review: APPROVE

No structural blocker found.

The fix removes an accidental PowerToys gate from a helper that is actually shared local-usage/pricing enrichment, keeps the PowerToys server itself independently opt-in, and adds focused tests for pipe-off/pipe-on plus supported/enabled provider filtering. The change is one file, deletes a special-case early return, and does not add a new abstraction or provider-specific branch.

1k/CUA: no 1,000-line threshold crossing; no UI/layout behavior changes, so CUA is not required for this diff.

mergeStateStatus: BLOCKED appears to be an external review/protection state, not a code-quality finding from this review.

@Finesssee
Finesssee merged commit 9e95a57 into nesszer:main Sep 8, 2026
5 checks passed
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.

2 participants