Repository navigation
feat(menubar): cache-read usage and quota pace in the Capacity Dock - #1314
Merged
Merged
Conversation
Main took render revision 6 for `sessionCountBasis` and changed the provider-slice session fold from a sum to a per-day max. Both had to survive the merge, so the resolutions are unions rather than sides: - `addProviderSlice` keeps main's `Math.max` for `sessions` (per-day ticks are not distinct identities) and adds the cache-read sum beside it, with a comment saying why one is additive and the other is not. - `ProviderSliceTotal`, `ProviderCost`, `providerDetails` and the Swift `ProviderDetail` carry both `sessionCountBasis` and `cacheReadTokens`. - The snapshot revision stays 7, which is still the next free number above main's 6. Its doc comment said v6 was PR1265's per-model counts; it is main's `sessionCountBasis`, so the comment now says that. The status-menubar suite hard-codes render revisions. Main's assertion that a rejected v5 snapshot is rewritten as `:render-6:` auto-merged cleanly while this branch moved the current revision to 7, which would have failed silently on the next bump too. Those assertions now derive the tag from `STATUS_SNAPSHOT_RENDER_VERSION`, so the current and previous revisions follow the constant; the deliberately historical `:render-5:` and `:render-2:` plants stay literal.
Ports the two parts of #1287 the maintainer asked to keep, expressed through this branch's `QuotaPacePresentation` rather than through `QuotaPace.Verdict`: - Placement: `QuotaDetailRow` in the agent-tab quota hover card becomes a VStack and draws the pace line under the bar, indented past the label column, with the three tones the dock already uses. The card is fitted, so a silent caption collapses there instead of reserving a slot the way the dock's computed frame must. - Wording: the long-window caption drops "est. N% at reset" / "est. out in X" for the plain "Lasts until reset" / "Runs out in X", and the exhausted state becomes "Limit reached". The projected percentage it came from stays in the hover text, which has room for the reasoning. Short windows keep the on-pace / deficit / reserve stage (#726), and the freshness, connection and duration gates are untouched. `QuotaPace.inferredWindowSeconds(label:)` is deliberately NOT ported. Grok Build chooses its window label from the distance to the reset, so a monthly cycle passing through the 4-12 day band is labeled "Weekly" and a label round trip paces a month's budget against seven days. The adapter's real `windowSeconds` is the only source here, and a new test pins that shape: 72% used with six days to a monthly reset reads "Lasts until reset", while the same sample against an inferred 7-day window overflows and would have printed "Runs out in 9h 20m". The same test asserts a window with no duration metadata stays silent rather than falling back to its label. Verified with a standalone swiftc harness over QuotaPace, QuotaPacePresentation and QuotaSummary: this host has Command Line Tools only, so `swift test` cannot load the Testing module. Closes #1267
Widening the on-pace band from 2 to 20 points, or flipping the six-hour ETA suppression from <= to <, left all 528 tests green. Both are the thresholds the caption is about.
… doing Reserving the pace slot only while connected made the panel relayout on every refresh: the slot collapsed and the staleness band appeared. The reservation is a property of the window shape, so it no longer asks the connection. Windows block on the real Claude shapes, connected vs stale: 91/77 -> 91/91 at one and two windows, 164/136 -> 164/164 at three. A Claude or Codex summary now reads stale on sample age alone, and the manual cadence never refreshes, so "Last known usage - refreshing" and the Settings "Refreshing..." became permanent lies. Both now ask whether a fetch is actually in flight.
iamtoruk
force-pushed
the
fix/dock-pace-followups
branch
from
September 12, 2026 19:32
8e7e603 to
d5e2d22
Compare
This was referenced Sep 12, 2026
iamtoruk
added a commit
that referenced
this pull request
Sep 12, 2026
Rebase resolution for #1289 onto main (#1306, #1313, #1314, #1315, #1328, #1329). Conflicts kept both intents: main's second-row title composition, glance-window accessibility actions, cache-read line, host field and merged Notifications section keep their behaviour and now resolve through L(…). Adds 14 keys to both tables, drops 4 that no longer have a call site, and retranslates the two Copilot explanations main rewrote.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #1267 by @ozymandiashh. Same commits, unchanged, plus three of mine on top. Close #1267 in favour of this.
What is here
1267 as authored: provider-scoped cache-read tokens in the Capacity Dock's Today row, and a pace caption under every quota window in the dock panel and the agent-tab hover card, computed from a real window length the adapter reports.
Then:
test(menubar): two escaped mutations. Widening the on-pace band from 2 points to 20, or flipping the six-hour ETA suppression from<=to<, left all 528 tests green. Both are the thresholds the caption is about.fix(menubar): the pace slot reserved height only while connected, so the panel relaid out on every refresh, which is the opposite of what 1267's own changelog promises. Reservation is now a property of the window shape. And a Claude or Codex summary now reads stale on sample age alone, which the manual refresh cadence makes permanent, so "Last known usage - refreshing" and Settings' "Refreshing..." became standing lies. Both now ask whether a fetch is really in flight.Panel height, real Claude shapes, connected vs stale
Windows block, then whole panel. Before is 1267 as authored.
The windows block no longer moves. The panel still differs by 27, which is
CapacityDockGlance.noticeHeight: the staleness band is its own reserved section and predates this branch. Removing that last 27 means not demotingconnectionon sample age at all, which would unwind the refresh state machine, so it is left alone.Pace, on real data
quota --format jsonon a real machine,now = 2026-09-12T18:59:50Z, every window fed through the shipped function:Only Claude and Codex carry a validated duration. Every other adapter builds its windows with the nil default and stays silent, including Cursor's exhausted API window, since the duration guard runs before the exhausted branch.
Silent as required on: u=0 e=0, e below the 3% floor, u>1, negative, NaN, infinity, missing reset, reset in the past, reset beyond one window, missing or zero or negative duration with the label reading "Weekly", an 11 minute old sample, nil or future
fetchedAt, and stale, loading or transient-failure connections.Cache read changes no price
Both CLIs run against a frozen past-day range, full structural diff of the payloads, with a main-versus-main run as the volatility baseline:
Costs identical to the digit, total and per provider. Absent stays unknown rather than becoming zero, a known zero prints as zero, and multi-id tiles (cursor plus cursor-agent) keep the 1237 folding rule with a stricter one for the new field.
Checks
No Timer, Task, await, TimelineView or onReceive added anywhere under the views, so no new polling. A user who never hovers sees nothing new: the whole detail panel, Today row included, is behind
model.hoveredProvider.One doc nit left for the author: the changelog says four quota windows move to a two-column grid, but
windowColumnCountismin(count, 2), so three windows wrap too.