Skip to content

Report pace for the window actually running hot - #256

Merged
btsouth merged 2 commits into
mainfrom
fix/pace-picks-hottest-window
Aug 11, 2026
Merged

btsouth merged 2 commits into
mainfrom
fix/pace-picks-hottest-window

Conversation

@btsouth

@btsouth btsouth commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • select the pace window by risk instead of by cadence: every window the provider reports is a candidate, and the one running hottest against its own clock wins
  • consider the tertiary slot and extra windows, not just primary/secondary — monthly quotas live in the tertiary slot and were unreachable
  • drop the fourteen-day ceiling on the cadence test, which would have rejected a monthly window even if it had been passed in
  • keep the twelve-hour floor, matching the rule the expected-usage markers already use

Why

Reported from an OpenCode Go pane. The weekly window sits at 0% while the monthly quota is 61% used against ~46% elapsed. The pane read "Weekly pace · Far below budget · -15.0%" directly beneath a monthly bar whose own marker showed it fifteen points over. Both statements were true and about different windows; the one carrying the words was the one that did not matter.

An exact tie keeps the window the UI lists first, so the verdict does not hop between equally-hot windows across refreshes.

Scope

This is the displayed verdict only. Predictive pace notifications (commands/providers.rs:960) and ceiling usage (cli/usage.rs:467) still read the primary and secondary slots alone, so a hot monthly quota cannot yet raise a warning. Deliberately left for a follow-up rather than changing notification behavior inside a release.

Validation

  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml (484 passed; +4 covering the reported case, the short-window skip, the promoted-weekly case, and tie-breaking)
  • cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings
  • cargo fmt --all --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml -- --check

Frontend is unchanged — ProviderDetailView already renders {pace.windowLabel} pace, so the heading becomes "Monthly pace" on its own.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Pace selection now evaluates all eligible long-duration windows, including monthly and other extended periods.
    • The window with the greatest pace change is selected, providing more accurate pacing information.
    • Short windows of 12 hours or less are excluded from selection.
    • Provider snapshots now display the selected window’s label and pace consistently.
    • Tied results are handled deterministically for more predictable behavior.

A provider that reports both a weekly and a monthly quota could show a
reassuring verdict about the window nobody is spending. OpenCode Go is
the clear case: the weekly window sits at 0% while the monthly quota is
61% used against roughly 46% elapsed, and the pane read "Weekly pace ·
Far below budget · -15.0%" directly beneath a monthly bar whose own
marker showed it fifteen points over.

The monthly window was doubly unreachable. Pace looked only at the
primary and secondary slots, and monthly quotas live in the tertiary
slot; even passed in, the cadence test capped at fourteen days and would
have rejected it.

Selection is now by risk rather than by cadence. Every window the
provider reports is a candidate, and the one running hottest against its
own clock wins. The twelve-hour floor stays, matching the rule the
expected-usage markers already use, so a five-hour session still gets no
verdict rather than a meaningless one. The upper bound is gone. An exact
tie keeps the window the UI lists first, so the verdict does not hop
between refreshes.

This is the displayed verdict only. Predictive pace notifications
(commands/providers.rs) and `ceiling usage` (cli/usage.rs) still read
the primary and secondary slots alone, so a hot monthly quota cannot yet
raise a warning. Left for a follow-up rather than changing notification
behavior in a release.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 11, 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 74e5a4a Commit Preview URL

Branch Preview URL
Aug 11 2026, 01:43 AM

@coderabbitai

coderabbitai Bot commented Aug 11, 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: 45 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 Plus

Run ID: 250bff8a-14af-45e1-8b72-1000ab6d984b

📥 Commits

Reviewing files that changed from the base of the PR and between 5380ab0 and 74e5a4a.

📒 Files selected for processing (1)
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs
📝 Walkthrough

Walkthrough

Pace selection now evaluates all windows longer than 12 hours, selects the highest pace delta, and uses that window’s label and pace in provider snapshots. Tests cover selection order, short-window exclusion, and ties.

Changes

Pace selection and snapshots

Layer / File(s) Summary
Eligible window selection
apps/desktop-tauri/src-tauri/src/commands/bridge.rs
The selection logic evaluates tertiary and extra windows, excludes windows of 12 hours or less, selects the highest pace delta, and preserves the first window on ties.
Snapshot integration and validation
apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Provider snapshots use the selected window label and pace. Tests cover monthly selection, weekly promotion, short-window exclusion, and deterministic tie-breaking.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • tsouth89/ceiling#197: Both changes modify pace-window selection and labeling in commands/bridge.rs.

Suggested reviewers: finesssee, 0reki, darknight105

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: reporting pace for the quota window with the highest relative usage rate.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pace-picks-hottest-window

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop-tauri/src-tauri/src/commands/bridge.rs`:
- Around line 241-244: Use a single captured Utc::now() timestamp for all
usage-pace comparisons and tests: at
apps/desktop-tauri/src-tauri/src/commands/bridge.rs lines 241-244, pass the
shared timestamp to each UsagePace::weekly call; at lines 904-910, pass it to
window_at; and at lines 960-967, use it when building both tie candidates. Run
focused tests, cargo fmt --all, and Clippy with -D warnings, reporting any
skipped checks.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 271d58a3-1f4a-4e7d-ba14-f1110125fd59

📥 Commits

Reviewing files that changed from the base of the PR and between 9c6ecf3 and 5380ab0.

📒 Files selected for processing (1)
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs

Comment thread apps/desktop-tauri/src-tauri/src/commands/bridge.rs
@github-actions

Copy link
Copy Markdown

Automated review

Found 5 issues:

  1. Secondary pace candidate always labeled "Weekly" even when cadence is not weekly

    apps/desktop-tauri/src-tauri/src/commands/bridge.rs:281 · disposition: fix-if-quick · confidence: high · severity: medium · quick win

    pace_candidates chains usage.secondary with (metadata.weekly_label, window) unconditionally. If a provider reports secondary as non-weekly (e.g., 14-day 20160m or monthly 43200m promoted to secondary), is_paceable_cadence keeps it (>720) and preferred_pace will compute its delta but display window_label as "Weekly". Trigger: secondary window_minutes != 10080 and it is the hottest paceable window — UI shows "Weekly: +15%" when the hot quota is actually monthly/14-day.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/commands/bridge.rs around line 281: Label secondary from its own metadata (e.g., usage.secondary_label if exists) or derive from window.window_minutes, falling back to metadata.weekly_label only when window_minutes is weekly. Add test with secondary=43200m as hottest and assert label != "Weekly". Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

  2. Tertiary fallback hardcodes "Monthly" and mislabels non-monthly tertiary windows

    apps/desktop-tauri/src-tauri/src/commands/bridge.rs:274 · disposition: fix-if-quick · confidence: high · severity: medium · quick win

    let tertiary_label = usage.tertiary_label.as_deref().unwrap_or("Monthly") is used as the pace label for usage.tertiary. If tertiary_label is None and the tertiary window is not monthly (e.g., 20160m 14-day or 10080m weekly demoted to tertiary), the pace verdict will be shown as "Monthly: +X%" for the wrong quota. Trigger: provider with tertiary Some(window_minutes=20160) and tertiary_label=None that becomes the hottest paceable window.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/commands/bridge.rs around line 274: Fallback to a generic label like "Tertiary" or derive from window.window_minutes (e.g., format as days) instead of hardcoding "Monthly". Add test where tertiary is 20160m and assert label is not "Monthly". Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

  3. Monthly/extra windows paced via UsagePace::weekly(..., 10080) with hardcoded weekly period

    apps/desktop-tauri/src-tauri/src/commands/bridge.rs:238 · disposition: fix-if-quick · confidence: medium · severity: medium · quick win

    preferred_pace calls UsagePace::weekly(window, None, 10080) for every paceable window, including 43200m monthly and arbitrary extra_rate_windows. If UsagePace::weekly uses the third argument as the period length (its name and old call-site suggest weekly-specific logic), a monthly window's expected usage will be computed against 10080m instead of 43200m, yielding a wildly wrong delta_percent (elapsed >1, negative delta) and wrong will_last_to_reset. The new test passes only if the implementation ignores the third arg when window.window_minutes is Some, which is not guaranteed by the name. Trigger: monthly window 61% at 46% elapsed should be +15% over; with period 10080 it computes as far under.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/commands/bridge.rs around line 238: Verify UsagePace::weekly uses window.window_minutes when Some; if not, pass window.window_minutes.unwrap_or(10080) or add UsagePace::for_window. Add test that asserts monthly delta matches window_minutes-based expectation, not 10080-based. Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

  4. Twelve-hour floor off-by-one excludes exactly 720m windows

    apps/desktop-tauri/src-tauri/src/commands/bridge.rs:222 · disposition: fix-if-quick · confidence: high · severity: low · quick win

    is_paceable_cadence uses minutes > 720 while the comment says "same twelve-hour floor the expected-usage markers use". If markers include 720m (12h exactly), a 720m window will show markers but no pace verdict, an inconsistent UI. Trigger: provider reports window_minutes Some(720) with resets_at — markers render but preferred_pace filters it out.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/commands/bridge.rs around line 222: Change to minutes >= 720 or update comment/marker threshold to document strict >720. Add test for 720m window pacing. Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

  5. Extra windows with empty title produce blank pace label

    apps/desktop-tauri/src-tauri/src/commands/bridge.rs:290 · disposition: fix-if-quick · confidence: high · severity: low · quick win

    extra_rate_windows.iter().map(|extra| (extra.title.as_str(), &extra.window)) uses title verbatim. If a provider returns an extra window with empty title, PaceSnapshot.window_label becomes "" and the UI shows a pace verdict with no window name. Trigger: extra window with title="" that is the hottest paceable window — pace card shows ": +X%" with blank label.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/commands/bridge.rs around line 290: Filter out empty titles or fallback to a derived label (e.g., format window_minutes as days or "Extra"). Add test with empty title extra window. Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

For coding agents: fix BLOCK and FIX IF QUICK findings now; everything else is tracked or informational; never exceed one CodeRev fix round per PR.

Advisory. Findings generated by grok-subscription and muse-spark-1.2-contributor, each filtered through a 3-vote deepseek-v4-flash refutation panel with the changed code in evidence.

Comment thread apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Comment thread apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Comment thread apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Comment thread apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Comment thread apps/desktop-tauri/src-tauri/src/commands/bridge.rs
Compare every candidate against one captured instant. Each call read the
clock separately, so two windows could be judged microseconds apart —
harmless in the app, but it meant the tie-break test never built an exact
tie and passed for the wrong reason.

Name an unnamed window "Extra", the way the bars already do. The tertiary
fallback said "Monthly", which would have labeled a verdict for a
fourteen-day or weekly window sitting in that slot as monthly, disagreeing
with the bar right beside it. Blank provider-supplied titles take the same
fallback rather than rendering a verdict with no name.

Pace a window of exactly twelve hours. The floor is documented as matching
the expected-usage markers, and `expectedPace.ts` skips `minutes < 12 * 60`,
so exactly twelve hours draws a marker; a strict `> 720` would have shown
that marker with no verdict beside it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@btsouth
btsouth merged commit 5b90a13 into main Aug 11, 2026
11 checks passed
@btsouth
btsouth deleted the fix/pace-picks-hottest-window branch August 11, 2026 01:47
btsouth added a commit that referenced this pull request Aug 11, 2026
## Summary
Cuts 1.5.27 and supersedes the 1.5.26 draft, which was built and signed
but never published — its Claude account-isolation fix ships here rather
than sitting in a draft nobody can install. The stale draft release has
been deleted; the `v1.5.26` tag stays as a marker of what was built.

Version bumped in all five locations from `VERSIONING.md`,
`BUILD_NUMBER=129`, `Cargo.lock` regenerated.

## What's in it
Six user-facing entries covering everything merged since the `v1.5.26`
tag:

- **Cursor on-demand at a glance** (#254, reported in #191) — the reason
for cutting this now
- **Codex no longer overcharges `gpt-5.1-codex-mini`** (#250) — billed
at $1.25/M instead of $0.25/M
- **Pace describes the window actually running hot** (#256)
- **Concurrent writes can no longer lose settings or credentials**
(#245)
- **Configured Claude accounts no longer collapse onto one session**
(from the unpublished 1.5.26)
- **Tab strips can be driven from the keyboard** (#255, closes #219)

Browser cookie import (#247) is written up under **Changed** rather than
buried in Fixed, since it removes a capability: it says plainly that a
provider authenticated that way will ask to be set up again, and that
CLI, IDE, OAuth, and Claude Desktop detection are unaffected.

The date reads 2026-08-11, matching the established pattern — 1.5.22,
1.5.24, 1.5.25 and 1.5.26 all use the UTC date of their tag, and each
was cut late-evening local.

## Validation
`scripts\local-check.ps1 -All -Version 1.5.27` passed in full: clippy
and tests on both Rust manifests, frontend tests and build, store
submission preparation, and release doctor. Release doctor's 3 warnings
are all "tag / assets / GitHub release do not exist yet", which is
expected before tagging.

Two flakes on earlier runs of that script, both confirmed environmental
and not regressions:
- `cli::tty_runner::tests::test_run_sends_script_through_pty` resolves
npm's `cmd` shim as the PTY shell and fails with Windows error 193
unless System32 leads PATH — the same failure recorded in #245 and #247.
Worth a follow-up to resolve `cmd.exe` from `%SystemRoot%` rather than
PATH.
- `TokenAccountsPanel.test.tsx` timed out on a `findByText` under load;
it passes in 144ms on its own, against a 1000ms default timeout.

## Not in this release
Predictive pace notifications and `ceiling usage` still do not see
monthly quotas. Follow-up PR next.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
btsouth pushed a commit that referenced this pull request Aug 11, 2026
Follow-up to #256, which fixed the displayed verdict but not the toast.

Predictive pace warnings looked at the primary and secondary slots
alone. A provider reports its monthly quota in the tertiary slot, so a
month on course to run dry before it reset could never say so, while the
weekly window beside it warned freely. Everything else was already in
place: PredictiveWarningWindow::Monthly exists, predictive_window_for
already maps anything past fourteen days onto it, and the dedup key
includes window_minutes, so a tertiary window cannot collide with the
secondary.

The candidate list moved out of the loop into predictive_pace_candidates
so the set of windows a warning can come from is testable on its own,
rather than only observable by emitting a toast.

Extra windows stay excluded. The displayed verdict can weigh every
window because it shows one; here each candidate raises its own toast,
and the extras are supplementary lanes that would multiply warnings
rather than add information.

`ceiling usage` is still weekly-only, but for a different reason: the
CLI never renders tertiary or extra windows at all, so its pace line
matches what it prints. Making the CLI monthly-aware means new output
lines and belongs on its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
btsouth added a commit that referenced this pull request Aug 12, 2026
## Summary
Follow-up to #256, which fixed the displayed pace verdict but not the
toast.

- add the tertiary slot to the windows a predictive pace warning can
come from
- extract `predictive_pace_candidates` so that set is testable on its
own, rather than only observable by emitting a toast

## Why
Predictive pace warnings looked at `primary` and `secondary` alone. A
provider reports its monthly quota in the **tertiary** slot, so a month
on course to run dry before it reset could never say so — while the
weekly window beside it warned freely. That is the same blind spot #256
fixed for the on-screen verdict.

Everything else was already in place: `PredictiveWarningWindow::Monthly`
exists, `predictive_window_for` already maps anything past fourteen days
onto it, and the dedup key includes `window_minutes`
(`notifications.rs:52`), so a tertiary window cannot collide with the
secondary.

## Deliberately not included
**Extra windows.** The displayed verdict can weigh every window because
it renders one; here each candidate raises its own toast, and the extras
are supplementary lanes (Codex Spark, pooled team usage) that would
multiply warnings rather than add information. Easy to widen if you'd
rather.

**The twelve-hour floor.** Display pace skips windows under twelve hours
because a marker on a bursty window is meaningless. An explicit "on
course to be exhausted before it resets" toast is still actionable for a
five-hour session, so warnings keep their existing reach.

**`ceiling usage`.** Still weekly-only, but for a different reason than
I first thought: the CLI never renders tertiary or extra windows at all
(`cli/usage.rs:433-434`), so its pace line is consistent with what it
prints. Making it monthly-aware means new output lines and belongs on
its own.

## Validation
- `cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml`
(489 passed; +3 covering the monthly case, absent slots, and
cadence-over-slot naming)
- `cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml
--all-targets -- -D warnings`
- `cargo fmt --all --manifest-path
apps/desktop-tauri/src-tauri/Cargo.toml`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@btsouth btsouth mentioned this pull request Aug 12, 2026
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.

1 participant