feat(providers): add Grok and Ollama usage telemetry - #67
Merged
Conversation
Expand runtime providers through safe local/official sources only: Grok reads ~/.grok/auth.json and grok.com/rest/subscriptions as plan-only; Ollama probes loopback OLLAMA_HOST for availability/model counts without fabricating quota. Keep usage-json schema v1 additive and headless-safe.
…tion Mirror the float capsule guard: keep a tray ring when remaining_percent is set or details.status is not "parsed". Healthy plan-absent Ollama snapshots no longer permanently occupy the tray as empty unknown rings; genuine error/no-data rows still rotate.
Path-based auth loading and an injectable subscriptions URL/client let tests drive missing/malformed auth, 401, other non-200, malformed body, and timeout through the existing NotConfigured/ParseFailed/LoginRequired/NetworkUnavailable taxonomy via a loopback mock server.
Run due provider refreshes in parallel and join in registration order so headless usage --json pays roughly the max per-provider timeout instead of the sequential sum on offline credentialed installs. Per-provider timeouts are unchanged.
The golden compares parsed Values, not raw bytes. Also note the tray filter, concurrent headless refresh, and Grok transport failure coverage.
Grok/Ollama are runtime providers but never own managed browser sessions. Startup orphan scan must key off supports_managed_browser, not is_runtime, so legacy deferred rows for those services stay ignored.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands telemetry to Grok and Ollama through safe authoritative sources only, per the release-plan contract:
grok.cli):~/.grok/auth.jsonbearer → official subscriptions API; represents plan tier + billing period end honestly, quota % stays null (quotaSupported: false) — never inventedollama.local): loopback-gated daemon probe (OLLAMA_HOSThonored, non-loopback rejected asunsafe_path,0.0.0.0coerced on-box); availability + model counts + optional Cloud plan, never a fabricated percentusage --jsonrefreshes independent providers concurrently (offline worst case drops from ~50s to per-provider max) and remains GTK/Tauri-freeCloses #29. Defaults on for fresh/missing-key configs (tested migration).
Validation
cargo test --all-targets: 320/28 — the 28 verified as the documented macOS baseline; one intermittent extra is the documented sidecar backpressure flake (classified independently by review)Local review: serious risk class — Opus 4.8 (security/trust: clean incl. loopback-gate bypass matrix), Sonnet 5 (correctness/schema: P1 tray fix), GPT-5.6 Sol (tests/operational: transport seam + latency P2s); all adjudicated findings fixed; targeted fix-verification clean with formal guard-equivalence proof. KISS keep.