Skip to content

Align reset countdown formatters at 24h and the last minute (SBS-927) - #324

Merged
tsouth89 merged 4 commits into
mainfrom
fix/sbs-927-reset-countdown-agree
Aug 18, 2026
Merged

Align reset countdown formatters at 24h and the last minute (SBS-927)#324
tsouth89 merged 4 commits into
mainfrom
fix/sbs-927-reset-countdown-agree

Conversation

@tsouth89

@tsouth89 tsouth89 commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Shared floor-and-clamp / 1440-minute reset countdown (SBS-927).
  • CLI 24h Xm and tooltip 0m now agree with tray/TS: 24h1s is 1d 0h, 30s is 1m.

User-visible result

Tray, CLI, and tooltip at 24h 1s show 1d 0h (or Resets in 1d). At 30s they show 1m, never 0m.

Quality gate

  • rust fmt passed. cargo test: 1003 passed, 6 pre-existing Linux/WSL failures. New SBS-927 tests passed.
  • clippy -D warnings failed on pre-existing unused items in secure_file.rs and updater.rs. Not fixed.
  • Desktop crate missing glib-2.0 here. Frontend install blocked; helper assertions run via Node strip-types.

Fail-without-fix

  • hours > 24 helper: left Some(24h 0m) right Some(1d 0h).
  • TS clamp removed: formatResetCountdown(30000) => 0m.

Sweep

Aligned: RateWindow, tooltip_short_reset, bridge label, Codex, UsagePace, Z.ai, StepFun, TS hooks, TaskbarFlyout.
Left different: PaceSection/PaceVerdict formatEta (GitHub 79, pace not reset). Locale sentence drops 0h (Resets in 1d).

What this makes more likely

Codex reset_description now keeps a zero unit (1d 0h / 2h 0m). Compact tray status no longer zero-pads minutes.

Gaps

Desktop rust tests and full frontend suite not run here. Issue left In Progress. Not merged.

Linear: https://linear.app/southboundsoftware/issue/SBS-927/reset-countdown-formatters-disagree-at-the-24-hour-and-last-minute

Note

Align reset countdown formatting across CLI, tray, tooltip, and TypeScript hooks at 24h and last minute

  • Introduces shared remainingCountdownParts / remaining_countdown_parts helpers in TypeScript and Rust that floor total minutes, clamp sub-minute future remainders to 1m, and cut days at 1440 minutes (24h → 1d 0h).
  • Updates all countdown display surfaces — CLI, tray icon, tooltip, taskbar flyout, and useFormattedResetTime / useResetCountdown hooks — to use these shared helpers instead of ad-hoc math.
  • Fixes 0m appearing in the last minute and incorrect day boundaries (e.g. 25h previously not showing as 1d 1h) across Codex, Stepfun, and Z.ai providers.
  • Behavioral Change: countdowns that previously showed 2m for 61–119s now show 1m; sub-minute remainders show 1m instead of 0m; 24h+ε now renders as 1d 0h everywhere.

Macroscope summarized afdf896.

CLI hours > 24 printed 24h Xm where tray and the TypeScript hooks already said 1d 0h, and tooltip_short_reset floored a still-future 30s remainder to 0m. One shared floor-and-clamp / 1440-minute breakdown now feeds every reset surface (SBS-927).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 17, 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 afdf896 Commit Preview URL

Branch Preview URL
Aug 18 2026, 02:27 AM

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tsouth89, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: 7f84f099-71f0-40ac-8158-1bce003e5e86

📥 Commits

Reviewing files that changed from the base of the PR and between cafd020 and afdf896.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs
  • apps/desktop-tauri/src-tauri/src/tray_bridge.rs
  • apps/desktop-tauri/src/hooks/useFormattedResetTime.test.tsx
  • apps/desktop-tauri/src/hooks/useFormattedResetTime.ts
  • apps/desktop-tauri/src/lib/resetCountdown.test.ts
  • apps/desktop-tauri/src/lib/resetCountdown.ts
  • apps/desktop-tauri/src/surfaces/TaskbarFlyout.tsx
  • apps/desktop-tauri/src/surfaces/tray/useResetCountdown.test.tsx
  • apps/desktop-tauri/src/surfaces/tray/useResetCountdown.ts
  • rust/src/core/rate_window.rs
  • rust/src/core/usage_pace.rs
  • rust/src/providers/codex/api.rs
  • rust/src/providers/stepfun/mod.rs
  • rust/src/providers/zai/mcp_details.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

Automated review

New in this pass: 1 issue.

  1. ETA truncates fractional seconds to 0m instead of clamping to 1m

    rust/src/core/usage_pace.rs:187 · disposition: fix-if-quick · confidence: high · severity: medium · quick win

    format_eta does Duration::seconds(secs as i64) which truncates toward zero. For eta_seconds = 0.5, secs as i64 is 0, so format_remaining_countdown sees Duration::seconds(0) and returns "0m". Every other reset surface clamps a still-future sub-minute remainder to "1m" via max(1) (SBS-927). An ETA just under a second therefore shows "0m" while tray/tooltip/CLI show "1m" for the same instant.

    Prompt for AI agents

    In rust/src/core/usage_pace.rs around line 187: Convert via milliseconds so the shared clamp applies: Duration::milliseconds((secs * 1000.0) as i64) (or ceil) instead of Duration::seconds(secs as i64). Add test asserting pace(0.5).format_eta()==Some("1m") and pace(0.0)==Some("0m"). Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

Resolved since the previous pass: 3.

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 refutation panel with the changed code in evidence.

Comment thread rust/src/core/rate_window.rs Outdated
Comment thread apps/desktop-tauri/src-tauri/src/tray_bridge.rs
Every caller proves the reset is still in the future, then handed the gap
to the shared helper as num_seconds(). That truncates the last 999ms to
zero, and the helper reads a zero remainder as due, so the CLI
statusline, the MCP reset countdown, the native tooltip, the taskbar
strip, and the compact tray status all printed "0m" for the final second
of a window. The TypeScript hooks work in milliseconds and printed "1m"
for the same instant, so the two surfaces disagreed.

The helper now takes a Duration, which keeps the unit in the type rather
than in a convention every caller has to remember. Only a remainder that
is genuinely due or past reads as zero.
Comment thread rust/src/core/usage_pace.rs Outdated
format_eta cast a float count of seconds to i64, so half a second
remaining truncated to zero and printed "0m" while the tray, tooltip,
and CLI read the same instant as "1m".
@tsouth89
tsouth89 merged commit b596ebb into main Aug 18, 2026
11 of 12 checks passed
@tsouth89
tsouth89 deleted the fix/sbs-927-reset-countdown-agree branch August 18, 2026 02:31
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