Repository navigation
perf(github): writes are paced by a budget - #281
Merged
Merged
Conversation
* perf(github): writes are paced by a budget Writes used to pay a fixed one-second pause after each one, so a run's first dozen writes cost twelve seconds of dead time. The content governor now keeps a token bucket instead: `write_burst` tokens (12 by default, the new `github.writeBurst` setting, 1 to 20) refilling one a second, one token taken when a write starts. The first burst goes out without a pause — no minute can hold more than burst + 60 writes, 72 by default, inside GitHub's documented 80 — and the 500-an-hour queue is unchanged. Writes still run one at a time across all client clones: the permit is the bucket lock held for the request. A secondary-rate-limit answer cuts the budget's capacity to one token for the next hour — the one write a second GitHub asks for — and logs a warning; the existing secondary cooldown is unchanged. M0 full-write at N=100: wall_ms 9998 → 2991 on boat.dev. The receipt-log CLI test's subscriber is now global rather than a scoped default: a callsite first registered on a thread with no dispatcher caches Interest::never, and other tests exercise the same write path in parallel, so its events could silently never reach the scoped subscriber. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | adbf820 | Commit Preview URL Branch Preview URL |
Nov 12 2026, 07:02 PM |
The CLI's token path rebuilt its GitHub options from the defaults and dropped the operator's burst. A burst of 20 allowed exactly GitHub's documented 80 writes a minute; the cap is now 19, so writeBurst + 60 stays under it.
sweepies
force-pushed
the
perf/write-budget
branch
from
November 12, 2026 19:02
cbf92c3 to
adbf820
Compare
Merged
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.
Consult 7, PR 6. Every GitHub write waited a second after the previous one returned, so every run that writes had a floor of about ten seconds. Writes are now paced by a budget.
burst, one token a second, one token per write counted from the write's start. Still one write in flight at a time, and still at most 500 writes an hour.github.writeBurst, default 12, range 1–19 (PatchulaSettings.pkl,reference/settings.mdx), honoured by server and CLI runs alike. Any minute allows at mostwriteBurst+ 60 writes: 72 by default, at most 79, under GitHub's documented 80. One new pull request (six writes) or two (eleven) pay no pause; a large run settles at one a second.Behaviour change: the first dozen writes of a run go out without the one-second pause (
internals/github-client.md, "Writes").Proof:
a_token_run_honours_the_write_burst: the CLI's token path uses the operator's burst.offline.rs's serial-cooldown test pinswrite_burst: 1so its one-second assertion still means something.Also fixed:
cli_run_reopens_disk_receipts…intermittently lost itswrite receipts saved/restoredlog lines. tracing caches each callsite's interest process-wide, and a parallel test that first hit the samereceiptscallsites without a subscriber cachednever. The test now installs a global subscriber (try_init).Benchmark (VM, release, M0 harness, full write with 100 historical pull requests): 9,998 ms → 2,991 ms.
The one-hour fallback lives in memory, like the governor's other limits, so a restart restores the burst.