Repository navigation
feat: optionally stagger periodic usage probes after 5h reset - #497
Merged
dofastted merged 3 commits intoOct 17, 2026
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
1 task done
cursor
Bot
force-pushed
the
feat/usage-reset-probe-stagger
branch
from
October 17, 2026 02:38
20ec772 to
e3ea556
Compare
cursor
Bot
force-pushed
the
feat/usage-reset-probe-stagger
branch
from
October 17, 2026 02:43
e3ea556 to
83e7037
Compare
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.
Summary
Related to #488 (partial scheduling support, not a claim that provider-side 5h windows are now desynchronized).
usage_probe.reset_delay_secandreset_jitter_sec(each 0–3600 seconds, default 0).reset + delay + stable(account identity, reset) offset. No sleeping worker, per-tick random redraw, new probe, or new mutable scheduler state./api/panel/probe, eventprobeNow, and the separate Messages health monitor. Expose pendingnext_probe_atin the existing usage-probe snapshot.Trace and scope
server.mjswirescreateUsageProbeMonitortobuildProbeOne.buildProbeOneruns the existing official usage/Fable decision path. The normal lookup uses official usage GET, but existing entitlement-recheck conditions can also run Fable Messages. This change only gates entry into that periodic chain after a known Extra 5h reset; it does not alter entitlement-probe conditions or the independent Messages health scheduler.It does not guarantee distinct upstream window start/reset times. Whether a plain official usage GET starts an upstream window was not verified; real traffic, event/manual probes, and independent Messages health checks may run earlier. Timer granularity and hash collisions can still put several accounts on the same tick. Delaying the quota read also delays panel/recovery freshness. The proposal therefore references, rather than automatically closes, #488.
Example routing patch:
{"usage_probe":{"enabled":true,"reset_delay_sec":120,"reset_jitter_sec":600}}This sets an earliest eligibility time 120–720 seconds after the Extra 5h reset, still subject to the existing timer/concurrency/backoff. Defaults retain existing behavior.
Validation
Pinned upstream base:
4fe27cfa96408c0504c59830f1788f01dddccdfb.git diff --checkpass.Tests ran with synthetic HOME/TMPDIR/KIN_HOME inside network/mount namespaces, loopback only and
/run//optmasked. No production state, real accounts, paid probes, or deployments were used.