Skip to content

Show tertiary window label instead of 'Extra' for OpenCode Go monthly bar - #197

Merged
btsouth merged 2 commits into
mainfrom
fix/tertiary-label
Aug 3, 2026
Merged

btsouth merged 2 commits into
mainfrom
fix/tertiary-label

Conversation

@btsouth

@btsouth btsouth commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

The tertiary (monthly) bar in the Activity timeline showed "Extra" as its label instead of the window's actual purpose. This was because the tertiary rate window had no label field in the data model to carry a display name, unlike the primary and secondary windows.

Changes

  • Added tertiary_label: Option<String> to UsageSnapshot with a with_tertiary_label() builder
  • Set tertiary_label = "Monthly" in the OpenCode Go provider when monthly usage is available
  • Wired tertiary_label through the Tauri bridge to the frontend as tertiaryLabel
  • Updated the frontend capacityPresentation.ts to use the provider-defined label, falling back to "Extra" when not set

Verification

  • cargo fmt and cargo clippy: clean (both crates)
  • cargo test (codexbar): 780 passed
  • cargo test (tauri app): 464 passed
  • TypeScript typecheck: clean

Summary by CodeRabbit

  • New Features

    • Added support for custom labels on tertiary usage-rate windows.
    • Tertiary windows now display provider-specific labels when available.
    • Monthly usage windows are explicitly labeled “Monthly.”
  • Bug Fixes

    • Corrected tertiary window labeling to avoid always displaying a generic fallback.

Copilot AI review requested due to automatic review settings August 2, 2026 07:18
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 2, 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 21e3e83 Commit Preview URL

Branch Preview URL
Aug 03 2026, 04:12 AM

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d8fedcf3-263e-468d-96a9-4b91e86eccab

📥 Commits

Reviewing files that changed from the base of the PR and between 0ff91b3 and 21e3e83.

📒 Files selected for processing (1)
  • rust/src/providers/opencodego/mod.rs
📝 Walkthrough

Walkthrough

The change adds optional tertiary usage-window labels to Rust snapshots, bridge payloads, and TypeScript presentation. OpenCodeGo labels its monthly window as “Monthly”. Desktop test fixtures initialize the new field.

Changes

Tertiary label propagation

Layer / File(s) Summary
Usage label contract
rust/src/core/usage_snapshot.rs, rust/src/providers/opencodego/mod.rs
UsageSnapshot supports an optional tertiary label through initialization and a builder method. OpenCodeGo assigns "Monthly" to its monthly window.
Bridge and presentation propagation
apps/desktop-tauri/src-tauri/src/commands/bridge.rs, apps/desktop-tauri/src/types/bridge.ts, apps/desktop-tauri/src/lib/capacityPresentation.ts
The bridge copies tertiary_label into ProviderUsageSnapshot. The presentation uses tertiaryLabel and falls back to "Extra".
Snapshot fixture alignment
apps/desktop-tauri/src-tauri/src/{auto_refresh,capacity_events,enforcement,powertoys,quota_run_history,taskbar_widget,tray_bridge}.rs
Test snapshot fixtures initialize tertiary_label to None.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenCodeGo
  participant UsageSnapshot
  participant Bridge
  participant capacityPresentation
  OpenCodeGo->>UsageSnapshot: assign "Monthly" tertiary label
  UsageSnapshot->>Bridge: serialize tertiary_label
  Bridge->>capacityPresentation: provide tertiaryLabel
  capacityPresentation-->>capacityPresentation: display label or "Extra"
Loading

Possibly related PRs

  • tsouth89/ceiling#4: Both changes modify ProviderUsageSnapshot and usage-window label handling.
  • tsouth89/ceiling#137: Both changes add provider-specific usage-window labels and related snapshot/UI plumbing.

Suggested reviewers: copilot, finesssee

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. 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 summarizes the main change: displaying the OpenCode Go tertiary window as “Monthly” instead of “Extra”.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tertiary-label

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Ready to approve

The new tertiary label field is correctly added to the shared model, serialized through the camelCase bridge, and consumed by the UI with an appropriate fallback, with no issues found in the reviewed diffs.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR fixes the Activity timeline’s tertiary (monthly) bar label for the OpenCode Go provider by introducing a dedicated tertiary label field in the shared Rust usage model and wiring it through the Tauri bridge to the React frontend, so the UI can display a provider-defined name instead of the generic “Extra” fallback.

Changes:

  • Added tertiary_label: Option<String> to UsageSnapshot plus a with_tertiary_label() builder.
  • Set the OpenCode Go monthly window’s label to "Monthly" when monthly usage is present.
  • Plumbed the new field through the Rust→TS bridge (tertiary_label → tertiaryLabel) and updated the frontend presentation logic to prefer it over the “Extra” fallback.
File summaries
File Description
rust/src/providers/opencodego/mod.rs Sets the tertiary window label to "Monthly" when monthly usage is available.
rust/src/core/usage_snapshot.rs Adds tertiary_label to the shared usage snapshot model and a builder to set it.
apps/desktop-tauri/src/types/bridge.ts Extends the TS bridge type to include tertiaryLabel?: string.
apps/desktop-tauri/src/lib/capacityPresentation.ts Uses provider.tertiaryLabel when computing the tertiary window label, falling back to "Extra".
apps/desktop-tauri/src-tauri/src/commands/bridge.rs Adds tertiary_label to the Rust bridge struct and maps it from UsageSnapshot.
apps/desktop-tauri/src-tauri/src/tray_bridge.rs Updates test snapshots/fixtures to include tertiary_label: None.
apps/desktop-tauri/src-tauri/src/taskbar_widget.rs Updates test snapshots/fixtures to include tertiary_label: None.
apps/desktop-tauri/src-tauri/src/quota_run_history.rs Updates test snapshots/fixtures to include tertiary_label: None.
apps/desktop-tauri/src-tauri/src/powertoys.rs Updates test snapshots/fixtures to include tertiary_label: None in two test fixtures.
apps/desktop-tauri/src-tauri/src/enforcement.rs Updates test snapshots/fixtures to include tertiary_label: None.
apps/desktop-tauri/src-tauri/src/capacity_events.rs Updates test snapshots/fixtures to include tertiary_label: None.
apps/desktop-tauri/src-tauri/src/auto_refresh.rs Updates test snapshots/fixtures to include tertiary_label: None (including a fixture with a tertiary window).
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 0
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@btsouth
btsouth merged commit 3894962 into main Aug 3, 2026
11 checks passed
@btsouth
btsouth deleted the fix/tertiary-label branch August 3, 2026 04:38
@btsouth btsouth mentioned this pull request Aug 3, 2026
btsouth added a commit that referenced this pull request Aug 3, 2026
## Summary

Prepares **Ceiling 1.5.22**, carrying three changes merged since
v1.5.21:

- **#198** - Fix 1% usage reading as 100% across providers (OpenCode Go,
OpenCode, Qoder, Chutes, Sakana)
- **#197** - OpenCode Go monthly bar labeled "Monthly" instead of
"Extra"
- **#196** - Fix Microsoft Store installer parameters (40-char Partner
Center limit)

Bumps all version sources to 1.5.22 (build 124), moves the Unreleased
CHANGELOG section into a versioned 1.5.22 entry (adding the missing
#196/#197 notes), and adds `.github/release-notes-1.5.22.md`.

## Changes

- `CHANGELOG.md` - retitle Unreleased to `[Ceiling] 1.5.22 -
2026-08-03`, add #196/#197 entries
- `version.env` - `MARKETING_VERSION=1.5.22`, `BUILD_NUMBER=124`
- `rust/Cargo.toml`, `apps/desktop-tauri/src-tauri/Cargo.toml`,
`apps/desktop-tauri/package.json`,
`apps/desktop-tauri/src-tauri/tauri.conf.json`, `Cargo.lock` - version
1.5.22
- `.github/release-notes-1.5.22.md` - new release notes

## Validation

`powershell.exe -ExecutionPolicy Bypass -NoProfile -File
scripts\local-check.ps1 -All -Version 1.5.22` passes, including the
release doctor for 1.5.22 (all version sources consistent, CHANGELOG
mentions 1.5.22) and the Store submission preparation test. Expected
pre-tag warnings only: local tag v1.5.22, local release assets, and
GitHub release not found yet.

After this merges and checks are green, push annotated tag `v1.5.22` to
trigger the `Signed Windows Release` workflow.

Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>
btsouth added a commit that referenced this pull request Aug 3, 2026
## Summary

The taskbar strip picks the constraining usage window and shows its
label, but for the tertiary window it hardcoded the label to `"Extra"`
and ignored the `tertiary_label` that #197 added to the data model.
OpenCode Go's monthly bar therefore still read "Extra" on the taskbar
even though the React surfaces (flyout, activity timeline) correctly
showed "Monthly".

The native `taskbar_widget.rs` is the mirror of
`capacityPresentation.ts`'s `constrainingWindow` (SOU-288); #197 updated
the frontend but not this mirror. This change aligns them: the strip now
uses `snapshot.tertiary_label` with `"Extra"` as the fallback when no
label is set.

## Changes

- `apps/desktop-tauri/src-tauri/src/taskbar_widget.rs` - use
`tertiary_label.as_deref().or(Some("Extra"))` in `constraining_readout`;
add regression tests for both the labeled ("Monthly") and unnamed (falls
back to "Extra") tertiary paths.

## Validation

- `cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml`:
466 passed (taskbar_widget: 28 passed, including the 2 new regression
tests, which fail against the old hardcode).
- `cargo fmt --all` clean; `cargo clippy --all-targets -- -D warnings`
clean.

Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>
btsouth added a commit that referenced this pull request Sep 25, 2026
## Summary

OpenCode migrated their web workspace UI to a new Console API surface
(`/console/api/...`). Accounts that migrated no longer get usable data
from the old `/workspace/<id>/go` scraper this fork's OpenCode Go
provider used exclusively, so usage fetches were breaking for those
accounts.

This ports the Console fallback from
[Win-CodexBar#600](nesszer/Win-CodexBar#600)
(merged upstream 2026-09-22, unreleased): the provider now tries the
Console API first and falls back to the legacy scraper only when a
legacy `auth` cookie is present and the Console attempt fails
recoverably.

**Scoped down from the upstream port** — this fork doesn't have the
`local`/`usage_api` SourceMode infrastructure (local-SQLite reads,
API-key mode) that upstream's PR #600 builds on, so those aren't
included here. This only adds the Console-first + legacy-fallback +
fail-closed-on-malformed-data behavior, fetched synchronously (no
background Zen-balance task scheduling like upstream's F15 concurrency
work).

## What's preserved

This fork has 5 independent local fixes on the same file that upstream's
history doesn't share. All are re-applied to the new Console path too,
not just kept on the legacy path:

- Percent-scale ambiguity handling (#198)
- "Monthly" tertiary label instead of generic "Extra" (#197)
- "Rolling (5h)" session label (#201)
- Not reporting the Zen balance as spend — it's remaining credit, not
cost (#208)
- Missing reset time stays `None` instead of fabricating "resets now"
(#213)

## Structure

Split `mod.rs` into:
- `console.rs` — the new Console API (workspace discovery, usage,
billing)
- `legacy.rs` — the prior scraper, relocated with its fixes intact
- `mod.rs` — orchestrates Console-first with legacy fallback

Also improves error reporting: when both Console and legacy fail, the
surfaced error now includes both failure reasons instead of silently
preferring one and hiding the other — this caught a live diagnosis issue
during testing where the real Console failure was hidden behind a
generic legacy error.

## Test plan

- `cargo test --manifest-path rust/Cargo.toml --lib` — 1283 passed, 0
failed
- `cargo clippy --manifest-path rust/Cargo.toml --lib --tests -- -D
warnings` — clean
- `cargo fmt --all -- --check` — clean
- Verified live against a migrated OpenCode Go account (Console fetch
now succeeds)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* OpenCode Go usage and balance information is available for accounts
using either the Console or legacy experience.
* Workspace selection is supported, and available Zen balance appears
alongside usage information.
* **Bug Fixes**
* Usage retrieval can fall back to the legacy experience when Console
requests encounter recoverable errors and a legacy login is available.
* Balance lookup failures no longer prevent usage information from being
retrieved.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible
markers, and the markers themselves will not be visible in the GitHub
rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's
description, Macroscope will append its summary at the bottom of the
description. -->
> [!NOTE]
> ### Add OpenCode Go Console API path with legacy fallback
> - Ports the OpenCode Go Console usage path from Win-CodexBar. Cookie
fetches now try the Console API first (usage, balance, workspace
discovery) and only retry the legacy page scraper when a recoverable
failure occurs and a legacy auth cookie exists. A Console
no-subscription result is terminal.
> - Splits the legacy implementation into
[legacy.rs](https://github.com/tsouth89/ceiling/pull/465/files#diff-e392af3466d20d33f57a3cf028fe5a14f5d12b6b5fee799b8b484fc47bc2aaa1)
and the new Console client into
[console.rs](https://github.com/tsouth89/ceiling/pull/465/files#diff-913e7c7295e626402e2490579eaca77e8c561671e5664477b3b9f936a83a17e9);
orchestration stays in
[mod.rs](https://github.com/tsouth89/ceiling/pull/465/files#diff-9dea407bc92536ed25c9c92a8485cdab1e291dbfa64f306211b75eedde52189e).
> - Console usage parses microcent meters into rolling, weekly, monthly,
and renewal windows, and reports prepaid balances only for explicit
pay-as-you-go accounts.
> - Workspace ID overrides now accept validated `wrk_`/`org_` IDs or
matching OpenCode URLs; invalid values are rejected instead of passed
through.
> - Behavioral Change: dual authentication failure now returns a
combined error that preserves `AuthRequired`; legacy fallback requires a
legacy cookie (`auth` or `__Host-auth`), and `org_` overrides force
legacy workspace discovery.
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized
8b8308f.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- Macroscope's pull request summary ends here -->

---------

Co-authored-by: Tyler <tsouth2@gmail.com>
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