#607
Share API readings across panes of the same widget: github-actions, github-prs, github, linear
When several panes of the same widget run on one machine, each pane asks the API for the same data. N panes make N requests. stealth-factory/opscope#613 fixed this for agent-usage: panes share one store, and one pane fetches each reading while the others read its result. This applies the same model to github-actions, github-prs, github and linear.
Context / problem
- github-actions: with 3 accounts and 48 repos, one pane makes at least 2,880 REST requests an hour against GitHub's 5,000. Two panes go over the limit.
- github-prs: a large board takes about 40 GraphQL requests per pass and can take minutes. Every pane repeats it.
- github: about 1 + 2 requests per account per pass, plus the expensive merged-PR timing walk.
- linear: 6 to 20 requests per pass, workspace-wide. Four or five panes on a large workspace reach Linear's 2,500 requests an hour.
- None of these widgets backs off today. A refused pass is retried every
refresh, by every pane.
Model (from stealth-factory/opscope#613)
- One SQLite store per widget, under the opscope state directory, mode 0600.
- Leadership per reading, not per pane. A pane claims a short lease for one reading, fetches it, and publishes it. Other panes read the published value.
- No heartbeat. A pane that dies leaves a lease that expires; the next pane that finds the reading stale takes over.
- The newest reading wins, by when it was taken.
- A rate-limit refusal is stored with its reset time, so no pane of that widget asks again before then.
- Each pane says how fresh its data is and which pane fetched it.
Decisions (William, 2026-11-15)
- One store file per widget, not per API. Widgets stay isolated from each other and can be developed separately. So the three GitHub widgets do not share an identity reading or a rate-limit record; each learns about a spent limit from its own response headers.
- Titles may be written to disk. PR, issue and run titles go in the store at 0600, are forgotten after 2 hours, and are documented in each README.
share_readings: falseturns sharing off. - A spent rate limit stops every pane of that widget until the reset time, and the pane says when it will ask again.
- vercel-deployments is out. Vercel allows 1,000 deployment-list requests a minute, and no pane comes close.
Issues
In order. Each is one pull request.
- core: move the shared-readings store out of agent-usage into
tc::readings - core: readings that take more than one request
- github-actions
- linear
- github-prs
- github: board aggregates
- github: day counts and landed timing
- agent-usage: finish what stealth-factory/opscope#613 described
Open questions
- Where should "not sharing readings: " go when a pane cannot open the store and polls alone: a row in the pane, as agent-usage has today, or a notice on the
!screen? Recommended: a notice, because it does not explain a number on screen. pane 48213(the process id) names the pane that fetched. Recommended: keep it for now.- Should a long fetch publish partial results? Recommended: not in the first version; other panes keep the last complete reading and say which pane is asking.
Agent notes
Spec written by Claude Fable 5.2 on 2026-11-15 from origin/main at 9d33157 (v2.15.0). The per-issue sections are in each sub-issue's agent notes. Findings about the stealth-factory/opscope#613 code that the core issues must fix before reuse:
- A busy timeout on claim, publish or load stops sharing for 10 minutes (
shared.rsheld_for → stop_sharing;main.rsSHARE_RETRY = 600 s). Only wait_for_holder retries on busy. - A version mismatch deletes the store file (
sharing.rsopen). Panes that still have it open keep using the deleted file, so old and new binaries split silently. - One lease length (
lease.rsLEASE = 90 s), sized for one request. A GitHub or Linear pass is many requests. - wait_for_holder blocks the poller for up to 95 s per key.
- Keys for six vendors use std DefaultHasher, which is not guaranteed stable across Rust releases.
- Only six vendors register their token with the secret guard. Claude, Codex, Cursor and Antigravity do not.
- publish() returns Ok(false) for a value over 2 MB or one holding a secret, and the caller ignores it.
- The per-section freshness wording from the stealth-factory/opscope#613 issue was never built; only a pane-level "readings shared" row exists.
OPS-282