Fixes OPS-288 · Fixes OPS-289 · Part of OPS-282
Summary
Several github panes on one machine now share five readings through tc::readings, in a store file of their own (~/.local/state/opscope/github.sqlite, 0600):
gh.who: who the token belongs to. Key: host, with the token as a fingerprint. Held 6 h, andrdoes not re-ask it.gh.calendar: the contribution calendar. Key: host and token. It does not depend on the window, so panes on different windows share it.gh.board: every account's aggregates (the 8-aliasbuild_queryper account) as one reading. Key: host, a fingerprint of the sorted accounts, the window in days, today's date, and the token. One reading, so every account is counted against the same pinnedrolling_now. A failed account is stored inside it as{"failed": why}. On every pane it is named in the error line and loses its 24h pair; it never lands as zeros. An account missing from the reading is treated the same way.gh.days(OPS-289): one account's per-day counts, as one map of day →[merged, created]for every window. Key: host, account, token. Held for the pane'srefresh. The pane that wins the lease reads only the days the map has never held plus the trailingFRESH_DAYS(2), and merges them into the stored map. So a second pane on a 90-day window makes no day-count requests when the first already has them, and a narrower window is free. A fresh map that cannot draw a pane's window (a wider window, or a new day after midnight) is claimed again for just the missing days.gh.timing(OPS-289): one account's merged-PR timing (R24 / T2D) per window. Key: host, account, window days, token. It stays good while the merged count it was read for still matches the board's count, not on a timer. When the count moves, it is claimed again, so it is fetched once per change in the count across all panes. A reading where a request failed (retry) is asked for again after arefresh, as before. The 6 h hold is only a ceiling. A timing the account's own screen read isrecorded into the store, not fetched again.
How the code is laid out:
one_passruns the shared part on everyFOLLOW_EVERY(5 s) tick. It callstakefor who, calendar and board. Thenday_countsandmerged_timingeach make oneclaim_many, fetch what they won, and make oneanswer_many. Before a request they callrenew_allonce a third of the lease has gone, so a long pass keeps all its leases. A map or timing the pane has not finished is given back withrelease. If another pane takes a lease over mid-fetch, this pane drops its answer.r: the pane that pressed itrecords a clear request (gh.clear, host and token) in the store. Whichever pane next wins each day map's lease rebuilds that map from nothing. A map read in the last 30 s is not rebuilt until it is older (ASKED_FLOOR).ralso still re-asks every reading older than the floor in the pane that pressed it.- The pane that fetches still fills its own rows account by account. The store hears the whole pass in one commit.
- Out of scope, as the issue says: the oldest-PR lookup (
fetch_oldest) stays per pane. So does the org discovery for an emptyaccounts. - A board cut short by the rate limit is refused until GitHub's reset, not shared. A board cut short because another pane took the lease over is dropped, and the other pane's board is the one shown.
- Rate limit:
graphqlusespost_answer, so it sees a refusal's status and headers.parse::parse_rate_headersandparse::parse_rate_spentare always compiled and tested. A spent budget ends inshuton a gate for that host and token, and every github pane on them stops until the reset. The pane saysGitHub's rate limit is spent · next ask in 41m. - "updated … ago" is the newest
taken_atamong the readings on screen. The freshness line comes fromtc::readings::sharing_rowsand now covers the day maps as well as the calendar and board. Timing is left off it on purpose: it is valid by count, so its age says nothing about staleness and would only make the line read hours old. - New setting
share_readings, on by default.config.example.jsonis regenerated. README, help, CONFIGURE and the settings text say what is shared. - The store keeps account and org names, counts and timing figures. It never stores a token or a PR title. It uses the default
Caps. - Core: one small change in
core/src/readings/store.rs. An existing store file is reset to 0600 when it is opened, and a test covers it. OPS-289 made no further core change.
Evidence
cargo testfrom the root: all green, includingcheck.rs.- OPS-289 tests (two panes on one temporary store, with a local stand-in for GitHub that counts requests):
a_second_pane_on_a_ninety_day_window_asks_for_no_day_counts: the first pane makes 5 chunked requests. The second pane on 90 days, and a third on 14 days, make none. The second pane's provenance names the first pane.a_stale_map_asks_again_for_only_the_trailing_days: the single request carriesm0/m1and nom2. Both panes then draw the merged map.an_r_in_one_pane_is_honoured_by_the_pane_that_holds_the_lease: pane B records the clear. Pane A rebuilds the map in one request, and neither pane asks again.an_r_inside_the_floor_waits_rather_than_askingtiming_is_asked_once_per_merged_count_between_panes: one request for count 3 across both panes. One more when the count moves to 4, made by whichever pane asks first. Another window is another reading.a_timing_the_detail_screen_read_is_shared_not_asked_againday_count_chunks_stop_when_the_first_answer_spends_the_rate_limit, moved onto the new pass.parse.rs: round trips for the stored day map and timing.- Mutation checks: if timing ignores the merged count, the timing test fails. If a clear request is ignored, the
rtest fails.
- OPS-288 tests:
two_panes_on_one_window_share_one_board_and_its_failures,panes_on_different_windows_still_share_who_and_the_calendar,a_refused_reading_does_not_land_and_an_absent_account_is_not_zero,a_pane_alone_says_why_on_the_freshness_line, and fourparse_rate_*tests. - Live two-pane run against a real token: 10 discovered accounts, an 18-day window, release build, isolated
XDG_STATE_HOME. Pane B started 100 s after pane A. I counted requests from the curl configs each pane wrote:- Day counts across both panes came to one request per account per refresh, split between the panes. B's first minute asked for only the 2 maps that had gone stale, not 10.
- Timing was fetched once, by A, for all 10 accounts. Every
gh.timingrow stayed at A's firsttaken_atfor the whole run, because no merged count moved. - During A's own first pass (day counts and timing) its freshness line stayed empty. The
cached 1m agothat #658 showed during a pane's own long day-count pass is gone. - The line still reads
cached 2m ago · pane N asking nowfor the few seconds the other pane spends refreshing the trailing days. That is accurate.
- Store writes, one pane, nothing changing (
disk.py 150 600 110 50): about 8 MiB/hour (4.1 MiB togithub.sqliteplus 4.2 MiB to its journal). The OPS-288-only build (c3b735b), run beside it at the same time, measured 8.0 MiB/hour, so sharing two more readings adds nothing measurable. A first version of this work measured 20 MiB/hour: a lease renew before every request was most of the writing. Renews now happen only once a third of the 45 s lease is gone (Renewal), which still covers a request's 30 s timeout. That applies to the board pass too. - macOS: no Mac was available. The hosted
macosCI job is the check. Nothing here is behind acfg.
Merge Danger
- Medium. This is the largest of the set.
one_passis split into the shared board pass and two shared batch passes. The poller wakes every 5 s, and a tick with nothing stale makes no request and no store write. Day counts and timing are now asked on whichever tick finds them stale, not only on this pane's fullrefreshpass. rnow rebuilds the day maps in every pane on the token, not only in the pane that pressed it. That is the point of OPS-289, but it costs a full window of day requests, at most once per 30 s.- A long timing walk (a merged count change on a busy account) still blocks the pane doing it. Only that pane is blocked; the others show
· pane N asking now. - Each new reading has its own key, so builds without sharing are not affected.
Activity
66Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
|---|---|---|---|
| 📝 Code Review | ✅ Completed 2026-11-18T06:23:50.002241Z | b349c23 | New commits |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6876413d3
ℹ️ 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".
Summary by CodeRabbit
rrebuilds daily counts across panes.Walkthrough
The GitHub widget now shares identity, contribution calendars, board totals, day counts and merged-PR timing between panes. It coordinates fetches through shared leases and rate-limit state. The widget displays reading provenance and wait status, and provides a setting to disable sharing.
Changes
GitHub shared readings
core/src/readings.rs,core/src/readings/store.rs0600.widgets/src/widgets/github/parse.rs,widgets/src/widgets/github/main.rswidgets/src/widgets/github/main.rsconfig.example.json,widgets/src/widgets/github/settings.json,widgets/src/widgets/github/CONFIGURE.md,widgets/src/widgets/github/README.md,widgets/src/widgets/github/help.txt,widgets/src/widgets/github/main.rsshare_readingssetting defaults to enabled. The widget displays reading provenance and rate-limit wait information. Documentation describes sharing scope, stored data, expiry and refresh behaviour.Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Feature
Sequence Diagram(s)
Possibly related issues
Possibly related PRs
Suggested reviewers:
greptile-appsMerge Risk: Low · previous review
37fa2Panes now share GitHub readings and respect a shared rate-limit pause. A few narrow gaps remain: a detail timing fetch can send extra requests after another pane hits the limit, partial day-count progress is discarded when a rate-limit stop interrupts a refresh, and the "updated" time can lag behind newer shared timing. These cost extra requests or a stale label, not data, so the change is reasonably safe to merge with follow-up.
Security architecture risk: Minimal · up to
37fa2The change adds local persistence and coordination between panes, but the inspected paths preserve credential separation, owner-only file access and publication fencing. No introduced or worsened risk materially affecting security, failure containment or ownership was established.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Pre-merge checks: 4
Full details: Title check
Explanation
The title names the main change: GitHub panes now share identity, contribution calendar, board totals, day counts and landed timing. The raw summary confirms cross-pane sharing of readings through a readings store, which matches. The title is long at 95 characters, but it is specific and on topic.
Full details: Description check
Explanation
The description is closely related to the changeset. It describes the five shared readings (gh.who, gh.calendar, gh.board, gh.days, gh.timing), the share_readings setting, the 0600 store file, the rate-limit gate, the freshness line, and the core store permission change. This matches the raw summary and the PR objectives.
Finishing Touches
Generate unit tests (beta)
Simplify code
A rabbit checks the board at dawn,
Shared counts arrive, then hop along.
A lease is held; a wait is shown,
Fresh readings cross panes of their own.
With carrots near, the charts look bright,
The rabbit rests until the next poll’s flight.