Skip to content

Treat Vertex usage fetch failures as errors, not 0% - #406

Open
tsouth89 wants to merge 2 commits into
mainfrom
cursor/vertex-fail-open-zero-5671
Open

Treat Vertex usage fetch failures as errors, not 0%#406
tsouth89 wants to merge 2 commits into
mainfrom
cursor/vertex-fail-open-zero-5671

Conversation

@tsouth89

@tsouth89 tsouth89 commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

Vertex AI always looked empty/healthy because Resource Manager metadata and HTTP failures collapsed into RateWindow::new(0.0). Fetch, decode, and metadata-without-usage paths now return an error instead of inventing 0%. Overview, Activity, and MCP/statusline skip that dummy 0% as well.

Sibling Auto probe_cli / missing-field fail-open-to-zero paths in Amp, MiniMax, and Kiro are fail-closed the same way. Tests panic if those paths report Ok(0%) again.

Related issue

Fixes SBS-1061

Affected areas

  • Tray panel
  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior
  • Installer / release packaging
  • Startup / background behavior
  • Documentation
  • Other: glance meters, widget snapshot / MCP get_status

Validation

Hosted CI (required gate) — green on 0b5908ba

https://github.com/tsouth89/ceiling/actions/runs/32670749822

Job Result
Frontend pass (1m6s)
Rust / shared (fmt --check, cargo test rust/Cargo.toml, clippy -D warnings) pass (3m7s)
Rust / desktop (cargo test + clippy -D warnings on the Tauri crate) pass (3m17s)
Rust (aggregate) pass
CodeQL / Analyze pass

Local gate (Linux agent)

cargo fmt --all --check
# FMT_OK

cargo test --manifest-path rust/Cargo.toml
# test result: ok. 1197 passed; 0 failed (lib)
# test result: ok. 32 passed; 0 failed (other targets)

# clippy on this change is clean. Two pre-existing Linux-only lints
# (`secure_file.rs` unused `error` off Windows; `updater.rs`
# `verify_installer_signature_or_delete` unused off Windows) are used
# on windows-latest CI, which passed above.

pnpm --dir apps/desktop-tauri test
# Test Files  93 passed (93)
# Tests  742 passed (742)

pnpm --dir apps/desktop-tauri run build
# tsc --noEmit && vite build OK

Windows scripts\local-check.ps1 is not available on this host. Hosted Rust / desktop covers that crate.

Tests prove failure is not 0%; they fail without the fix

Restoring the old fail-open (Ok(RateWindow::new(0.0))) on the Resource Manager HTTP/metadata mappers panics:

cargo test --lib resource_manager_metadata_is_not_reported_as_zero_percent
# panicked at rust/src/providers/vertexai/mod.rs:367:13:
# failure must not be reported as 0% used
# FAILED

cargo test --lib http_failure_is_not_reported_as_zero_percent
# panicked at rust/src/providers/vertexai/mod.rs:367:13:
# failure must not be reported as 0% used
# FAILED

Those two were reverted after the proof. The same helper is used for Amp/MiniMax/Kiro sibling paths.

New tests that stay green:

  • providers::vertexai::tests::http_failure_is_not_reported_as_zero_percent

  • providers::vertexai::tests::http_decode_failure_is_not_reported_as_zero_percent

  • providers::vertexai::tests::resource_manager_metadata_is_not_reported_as_zero_percent

  • providers::vertexai::tests::decode_failure_is_not_reported_as_zero_percent

  • providers::vertexai::tests::cli_presence_is_not_reported_as_zero_percent

  • Amp/MiniMax configured-probe + missing-field tests

  • Kiro CLI-without-metrics test

  • capacityPresentation Vertex error snapshot does not invent 0%

  • widget_snapshot_omits_an_errored_vertex_zero_percent (passed on hosted Rust / desktop)

  • powershell.exe -ExecutionPolicy Bypass -NoProfile -File scripts\local-check.ps1 (Windows-only; not available here)

  • Other: hosted CI + matching local commands above

UI / tray proof

  • Not applicable (error/unavailable state; no new chrome)

Notes for reviewers

  • The old Vertex HTTP _ => Ok(0%) arm is gone. usage_from_resource_manager_http / usage_from_resource_manager_metadata / usage_from_cli_presence are the fail-closed mapping.
  • Resource Manager projects.get is still not a quota API. A 200 with project metadata is now a Parse error, not a healthy 0%.
  • Amp/MiniMax Auto used to hide a failed fetch behind "configured → 0%". Kiro did the same when CLI output had a plan name and no metrics.
  • from_error still stores a dummy 0% primary (existing contract). Glance meters, allMeasuredWindows, and widget/MCP entry writing now refuse to publish it.
  • Do not merge.
Open in Web Open in Cursor 

Note

Treat Vertex, Amp, Kiro, and MiniMax usage fetch failures as errors, not 0%

  • Removes synthetic 0% usage snapshots across all provider backends: vertexai, amp, kiro, and minimax now return ProviderError (Parse, AuthRequired, Other, or NotInstalled) when metrics are missing, HTTP fails, or only CLI presence/config is detected
  • Adds strict field validation in each provider's parsing path (e.g. usage_from_amp_payload, usage_from_resource_manager_http, MiniMaxProvider.parse_usage_response) so missing used/limit or non-positive quotas produce parse errors rather than defaults
  • Desktop frontend (glanceMeters, allMeasuredWindows, widget_entry_from_usage_snapshot) now early-returns null/empty when provider.error is set, preventing 0% readings in glance meters, Activity timelines, and widget entries
  • Risk: any caller that relied on receiving a 0% snapshot during partial failures or config-only states will now receive None or an error; check consumers of UsageSnapshot and WidgetProviderEntry in providers.rs and capacityPresentation.ts

Macroscope summarized 0b5908b.

Resource Manager metadata, HTTP errors, and sibling Auto probe
fallbacks no longer invent a healthy 0% reading (SBS-1061).

Co-authored-by: Tyler <tyler@southboundsoftware.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ceiling 0b5908b Commit Preview URL

Branch Preview URL
Aug 23 2026, 10:30 PM

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 45 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ecea807-c24e-45d0-a49f-3e57c9b8dfc8

📥 Commits

Reviewing files that changed from the base of the PR and between 5bae231 and 0b5908b.

📒 Files selected for processing (7)
  • apps/desktop-tauri/src-tauri/src/commands/providers.rs
  • apps/desktop-tauri/src/lib/capacityPresentation.test.ts
  • apps/desktop-tauri/src/lib/capacityPresentation.ts
  • rust/src/providers/amp/mod.rs
  • rust/src/providers/kiro/mod.rs
  • rust/src/providers/minimax/mod.rs
  • rust/src/providers/vertexai/mod.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Co-authored-by: Tyler <tyler@southboundsoftware.com>
@tsouth89
tsouth89 marked this pull request as ready for review August 23, 2026 22:34
@cursor

cursor Bot commented Aug 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_94180784-177d-4da4-830a-9da6f2afb00b)

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