Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

Add Fable quota and compact Codex/Claude dashboard - #44

Merged
ElbertePlinio merged 9 commits into
mainfrom
feat/fable-four-provider-dashboard
Jul 13, 2026
Merged

ElbertePlinio merged 9 commits into
mainfrom
feat/fable-four-provider-dashboard

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Jul 12, 2026 •

Copy link
Copy Markdown
Member

Changed

  • parse Claude's labeled current-session, weekly all-models, and separate Fable allowance without exposing page content
  • replace oversized dashboard dials with a compact responsive Codex and Claude quota board
  • keep settings saves and supported login launches off the UI thread
  • validate Codex window duration before labeling a five-hour quota
  • remove Grok and Ollama from runtime, headless JSON, dashboard, settings, and the floating capsule while preserving inert legacy config compatibility
  • resize the floating capsule to a fixed 168×56 two-ring layout
  • remove deferred-provider browser, credential, daemon, and session-recovery paths
  • refresh focused state, overflow, parser-boundary, responsive, and reduced-motion coverage

Validated

  • bun run check
  • bun run test — 71 frontend tests and 18 Playwright sidecar tests
  • bun run test:browser-preview — two-provider dashboard/settings at 1000px, 820px, 680px, and 390px plus exact 168×56 capsule geometry
  • cargo test --manifest-path src-tauri/Cargo.toml --locked --all-targets — 252 passed
  • legacy config smoke: grok=true and ollama=true still deserialize but emit only Codex and Claude
  • browser-rendered inspection at 1000×700 plus the two-ring capsule
  • Grok-first local review clean; GitHub Codex review not requested

Not tested

  • production app bundle, installer, updater, or cross-platform smoke checks
  • cargo fmt --check because rustfmt is not installed in the current toolchain
  • live authenticated Claude usage page; the privacy-safe parser is covered with sanitized representative page text

Closes #43

Leave this PR draft and unmerged until manual app testing is complete.

@ElbertePlinio

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbdf2e1ba2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +297 to +298
if let Some(fable) = fable {
object.insert("fable".into(), fable);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expose Fable in the usage JSON serializer

This stores the parsed Claude Fable allowance under details.windows.fable, but pickgauge usage --json still serializes UsageJsonWindows with only five_hour and week in src-tauri/src/usage_cli.rs, so the new Fable reading is silently dropped from the documented CLI JSON output. Add a fable field to the CLI window struct and populate it from detail_window(snapshot, "fable") so consumers can actually receive the allowance parsed here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f7923b2: usage --json now serializes windows.fable, with the golden fixture covering a populated allowance.

const weeklyUsed = usedPercentFollowingLabel(text, /\ball\s+models\b/iu);
const fableUsed = usedPercentFollowingLabel(text, /\bfable(?:\s+5)?(?:\s+only)?\b/iu);
const fallback = visiblePercentages(text);
const usedPercent = labelIsPresent(text, sessionLabel) ? sessionUsed : fallback.usedPercent;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve remaining-only Claude fallback readings

When the Claude page does not include the Current session label and exposes only an NN% remaining value, the generic fallback parser can still find fallback.remainingPercent, but this assignment keeps only fallback.usedPercent. In that UI variant the returned headline remains null, causing the backend to report missing data despite a valid visible quota; keep fallback.remainingPercent in the no-label path or derive usedPercent only when needed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f7923b2: the no-label fallback now preserves explicit remaining-only readings and avoids treating the generic word “usage” as a used-value label. Added a regression test.

@ElbertePlinio

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7923b2192

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +548 to +552
const remainingPercent = hasSessionLabel
? sessionUsed === null
? null
: 100 - sessionUsed
: fallback.remainingPercent;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve weekly/Fable quotas when session is unavailable

When Claude shows the Current session label but no % used value (the added sidecar test covers this with “Temporarily unavailable”), this sets the headline percentages to null even if All models and Fable were parsed. The Rust handoff then returns missing_visible_percentage before copying weekly/fable into details.windows (parse_visible_usage requires a headline percentage first), so the valid weekly/Fable allowances are discarded instead of shown. Consider falling back the headline to a valid secondary window, as the Ollama path does, or allowing secondary-only Claude windows through.

Useful? React with 👍 / 👎.

@ElbertePlinio ElbertePlinio Jul 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f94c227: Claude secondary windows now provide a valid headline when the session meter is unavailable, while the windows detail omits the missing five-hour row so the UI does not mislabel or duplicate weekly usage. Added Rust and frontend regressions.

Comment thread src/lib/views/Dashboard.svelte Outdated
) {
return "bad";
}
if (snapshot.remainingPercent !== null || status === "parsed") return "ok";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Classify web fallback failures before marking gauges healthy

When a web refresh fails but a local/fake fallback still has a percentage (web_unavailable_fallback_snapshot sets details.webStatus while preserving remainingPercent), this branch returns ok for statuses such as network_unavailable, timed_out, unexpected_ui, or captcha_or_bot_check because the fallback percentage is non-null. The new status dot/state styling therefore marks the provider healthy while providerStatusMessage is showing an official-web failure; classify known failure webStatus values before the percentage shortcut.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f94c227: provider health now classifies official web failures before considering cached fallback percentages. Network/timeouts/unexpected UI render as failures; login/MFA/verification gates render as warnings. Added focused frontend tests.

Comment on lines +588 to +591
const used = percentNearLabel(text, /\b(used|consumed)\b/iu);

return {
remainingPercent: remaining ?? (used === null ? firstPercentValue(text) : null),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Claude fallback usage percentages as used

If Claude serves an older/alternate page without the new Current session label and labels a value as % usage (for example 42% usage), this fallback no longer treats usage as a used-percent label. It then falls through to firstPercentValue as remainingPercent, so the app reports 42% remaining instead of deriving 58% remaining from 42% used; the generic parser handled usage as used before this Claude-specific path.

Useful? React with 👍 / 👎.

@ElbertePlinio ElbertePlinio Jul 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f94c227: the Claude fallback recognizes the bounded legacy form “NN% usage” as used, while prose such as “plan usage … NN% remaining” remains a remaining value. Added a sidecar regression.

@ElbertePlinio

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f94c22793f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/web_provider.rs Outdated
.second_window
.as_ref()
.and_then(window_values)
.or_else(|| input.fable_window.as_ref().and_then(window_values))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Fable-only quota out of the headline

When Claude's current-session and all-models rows are unavailable but the Fable row is parseable, this fallback promotes the separate Fable allowance into snapshot.remaining_percent. That top-level field drives the tray icon and low-quota threshold cues, so users can see a model-specific Fable quota as overall Claude availability. Keep Fable only in details.windows.fable and leave the headline unknown unless current-session or all-models data is present.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in afb893a: Fable-only data remains in the Fable detail window with no top-level Claude percentage, so it cannot drive the tray or overall low-quota cues. Added a Rust regression.

const fableUsed = usedPercentFollowingLabel(text, /\bfable(?:\s+5)?(?:\s+only)?\b/iu);
const fallback = claudeFallbackPercentages(text);
const hasSessionLabel = labelIsPresent(text, sessionLabel);
const usedPercent = hasSessionLabel ? sessionUsed : fallback.usedPercent;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip fallback when secondary Claude rows are present

If the Claude page lacks the Current session label but still contains labeled All models or Fable rows, this fallback reads the secondary row's % used as top-level Claude usage. The backend then converts that used-only value into a headline remaining percent and the dashboard renders it as the 5-hour/current-session bar, duplicating weekly usage or treating Fable as the primary quota. Suppress the generic fallback when those secondary labels are present, or strip those sections before falling back to legacy text parsing.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in afb893a: generic Claude fallback parsing is suppressed whenever labeled All models or Fable rows are present, preventing secondary rows from being duplicated as session usage. Added a sidecar regression.

? `Grok Build ${Math.round(grokBuildUsage(snapshot) ?? 0)}% used`
: ""))}
</span>
{#if loginPromptVisible(snapshot)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Hide unusable Grok CLI login action

When Grok is using the CLI provider and web readings are disabled, a login_required snapshot now satisfies this condition, so the card shows a disabled Start login action under the Sign in with the Grok CLI message. The previous footer was guarded by snapshot.service !== "grok" || config.providers.webEnabled, so this confusing desktop-web login action did not appear for the CLI-only Grok flow; keep the action hidden unless a managed web login can actually be started.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in afb893a: the login action remains hidden for Grok CLI snapshots unless managed web readings are enabled.

Comment thread src/lib/views/Dashboard.svelte Outdated
Comment on lines +453 to +455
{providerStatusMessage(snapshot) ??
(snapshotIsStale(snapshot)
? "Stale data"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Keep stale status visible with provider errors

When a stale snapshot also has a provider status message (for example a local fallback with a failed web refresh), this expression chooses the provider message first and no longer renders Stale data; the previous layout showed both notes. Users can then see only the login/network error and miss that the displayed quota itself is older than the refresh interval, so render stale separately or combine the messages.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in afb893a: stale state is now combined with the provider error instead of being replaced by it.

@ElbertePlinio

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afb893a26d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.as_ref()
.and_then(window_values)
.is_some();
if headline.is_none() && !(input.service == Service::Claude && has_fable_window) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Fable-only web readings during display merge

When Claude exposes only the Fable row, this new exception produces a parsed web snapshot with details.windows.fable but no top-level remaining_percent/used_percent. The display merge still treats any web snapshot without a top-level percent as unavailable and replaces it with the local/fake fallback (merge_service_snapshots), which drops the Fable window, so users with local Claude activity never see a Fable-only official reading. Treat a valid window as usable for merge purposes or carry the web windows into the fallback snapshot.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5e0a83e: parsed window-only web snapshots now bypass unavailable fallback merging, preserve the Fable detail window, and keep the top-level Claude percentage unknown. Added a merge regression with local Claude activity.

Comment thread src/lib/usage.ts
Comment on lines +147 to +151
status === "network_unavailable" ||
status === "timed_out" ||
status === "unexpected_ui" ||
status === "unsafe_path" ||
status === "internal"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Mark unavailable providers as bad

When a snapshot reports status/webStatus: "unavailable", the dashboard now shows the Provider unavailable state text but this new status classifier falls through to idle, so the status dot and state row are rendered neutral instead of as an outage. Add unavailable to the bad-status branch so provider outages are not visually downgraded in the compact board.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5e0a83e: unavailable now maps to the bad provider status, with a frontend regression.

Keep provider login and settings saves responsive while removing unsupported Grok and Ollama browser automation.\n\nRefs #43
Keep detached refreshes from restoring removed providers and report disabled Ollama reads truthfully.\n\nRefs #43
Ship the Fable dashboard as a focused Codex and Claude experience while keeping legacy provider config inert.\n\nRefs #43
@ElbertePlinio ElbertePlinio changed the title Add Fable quota and compact four-provider dashboard Add Fable quota and compact Codex/Claude dashboard Jul 13, 2026
@ElbertePlinio
ElbertePlinio marked this pull request as ready for review July 13, 2026 03:43
@ElbertePlinio
ElbertePlinio merged commit c35d8ee into main Jul 13, 2026
1 check passed
@ElbertePlinio
ElbertePlinio deleted the feat/fable-four-provider-dashboard branch July 13, 2026 03:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Fable quota and overhaul the four-provider dashboard

1 participant