Skip to content

feat(providers): add Grok and Ollama usage telemetry - #67

Merged
ElbertePlinio merged 6 commits into
mainfrom
feat/providers-grok-ollama
Jul 23, 2026
Merged

feat(providers): add Grok and Ollama usage telemetry#67
ElbertePlinio merged 6 commits into
mainfrom
feat/providers-grok-ollama

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Summary

Expands telemetry to Grok and Ollama through safe authoritative sources only, per the release-plan contract:

  • Grok (grok.cli): ~/.grok/auth.json bearer → official subscriptions API; represents plan tier + billing period end honestly, quota % stays null (quotaSupported: false) — never invented
  • Ollama (ollama.local): loopback-gated daemon probe (OLLAMA_HOST honored, non-loopback rejected as unsafe_path, 0.0.0.0 coerced on-box); availability + model counts + optional Cloud plan, never a fabricated percent
  • no browser tokens/cookies/profiles anywhere; managed-browser actions stay Codex/Claude-only (backend-gated + UI-gated)
  • usage JSON schema v1 preserved — additive rows only, golden fixture byte-unchanged and fully asserted; float capsule stays percent-only (healthy availability-only rows excluded from tray rotation by a guard proven equivalent to the frontend contract)
  • headless usage --json refreshes independent providers concurrently (offline worst case drops from ~50s to per-provider max) and remains GTK/Tauri-free
  • injectable Grok transport seam with the full failure matrix tested (missing/malformed auth, 401, 500, bad body, timeout)

Closes #29. Defaults on for fresh/missing-key configs (tested migration).

Validation

  • focused Rust suites (tray/providers/usage-cli/config: 19 new tests + existing 65+), frontend 76+18, check/lint/coverage/build all green
  • 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)
  • real KDE tray/dashboard visual pass defers to the RC phase on Elberte-PC

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.

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.
@ElbertePlinio
ElbertePlinio merged commit fbcf052 into main Jul 23, 2026
1 check 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.

Honor OLLAMA_HOST for the ollama.local daemon probe

1 participant