Skip to content

Commit 0584bee

Browse files
authored
Merge pull request #5142 from modelcontextprotocol/v2/docs/5133-pace-github-writes
docs: add an AGENTS.md rule for pacing bulk GitHub writes
2 parents 7f4922b + 810ec72 commit 0584bee

5 files changed

Lines changed: 48 additions & 16 deletions

File tree

‎.claude/skills/board-ops/SKILL.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,17 @@ if [ -s "$BOARD_TMP/lost-ids.json" ]; then
429429
gh project item-edit --project-id PVT_kwDOCt2Azc4BcZgq --id "$id" \
430430
--field-id PVTSSF_lADOCt2Azc4BcZgqzhXCpm0 --single-select-option-id <NEW_OPTION_ID> \
431431
|| { echo "item-edit failed on $id — stopping; re-run step 1 to see what is left" >&2; break; }
432-
sleep 0.4
432+
sleep 8 # a sustained loop: see AGENTS.md "Pacing GitHub writes"
433433
done
434434
else
435435
echo "no lost-ids.json — step 1 did not complete; nothing re-applied" >&2
436436
fi
437437
```
438438

439+
Step 3 is a sustained loop, so it sleeps 8 s between edits, long enough to stay
440+
inside every limit in `AGENTS.md` **Pacing GitHub writes** for as long as it
441+
runs: a restore of 250 cards takes about 35 minutes.
442+
439443
Step 1's join is the safety check: only a card that held the deleted option in
440444
the snapshot is re-applied, so you don't overwrite a card that was already blank
441445
or that someone legitimately cleared in the meantime. Read its "NOT restored"

‎.claude/skills/issue-triage/SKILL.md‎

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ reporter is notified of each one. So:
4242
manifest** that lists each item, its class, and the issue it will point at.
4343
A wrong class is cheap to fix in a file and expensive to fix after a
4444
notification went out. Closing a single item the maintainer named is fine.
45-
- **Pace every write loop**: a few seconds between calls, and **stop on the
46-
first failed call** rather than carrying on blind. GitHub's secondary rate
47-
limit on content creation trips well before its primary one, and a loop that
45+
- **Pace every write loop** by `AGENTS.md` **Pacing GitHub writes**, and
46+
**stop on the first failed call** rather than carrying on blind. GitHub's
47+
secondary rate limit trips well before its primary one, and a loop that
4848
keeps going after a 403 leaves a half-applied batch nobody can see.
4949
- **Never restate a vulnerability in public**, not even to summarize a report
5050
that was already filed publicly. See [Security reports](#security-reports).
@@ -86,14 +86,22 @@ D=${D:-$(mktemp -d)}
8686
# Copy the class's response from Canned responses into "$D/response.md" (the
8787
# text inside the quote, with #ORIGINAL or the SDK link filled in) first.
8888
# Close as not planned, with that response (body in a file, so quoting is
89-
# safe). NOT for a duplicate: post the Duplicate response with `gh issue
90-
# comment`, close it with the `board-ops` state_reason=duplicate call, and
91-
# delete its card if it has one (`board-ops`, Delete a card). An empty or missing response stops here instead of closing silently.
89+
# safe). The comment and the close are two writes (`gh issue close --comment`
90+
# sends them back to back), and a run closes several issues, so every write
91+
# here is followed by the PR-close loop's `sleep 8`, including the last one
92+
# before the next issue. NOT for a duplicate: post the Duplicate response with
93+
# `gh issue comment`, close it with the `board-ops` state_reason=duplicate
94+
# call, and delete its card if it has one (`board-ops`, Delete a card), with
95+
# the same `sleep 8` after each of those three writes. An empty or missing
96+
# response stops here instead of closing silently.
9297
BODY=$(cat "$D/response.md") && [ -n "$BODY" ] \
93-
&& gh issue close <N> --repo modelcontextprotocol/servers --reason "not planned" --comment "$BODY" \
94-
|| { echo "no response or close failed for #<N> — stop and check it" >&2; false; }
98+
&& gh issue comment <N> --repo modelcontextprotocol/servers --body "$BODY" \
99+
&& sleep 8 \
100+
&& gh issue close <N> --repo modelcontextprotocol/servers --reason "not planned" \
101+
&& sleep 8 \
102+
|| { echo "no response, or the comment or close failed for #<N> — look before retrying" >&2; false; }
95103
# Spam or empty, the one class with no response:
96-
gh issue close <N> --repo modelcontextprotocol/servers --reason "not planned"
104+
gh issue close <N> --repo modelcontextprotocol/servers --reason "not planned" && sleep 8
97105
```
98106

99107
## Pass 1 — sweep onto the board (no approval implied)
@@ -447,13 +455,22 @@ while IFS=$'\t' read -r PR CLASS ISSUE _; do
447455
if [ -n "$SWEEP_LABEL" ]; then
448456
gh pr edit "$PR" --repo modelcontextprotocol/servers --add-label "$SWEEP_LABEL" </dev/null \
449457
|| { echo "label FAILED on #$PR — stopping" >&2; break; }
458+
sleep 8
450459
fi
451-
gh pr close "$PR" --repo modelcontextprotocol/servers --comment "$BODY" </dev/null \
452-
|| { echo "close FAILED on #$PR — stopping; re-snapshot to see what is left" >&2; break; }
453-
sleep 5
460+
# Comment and close as two writes, so each is paced: `gh pr close --comment`
461+
# sends both back to back.
462+
gh pr comment "$PR" --repo modelcontextprotocol/servers --body "$BODY" </dev/null \
463+
|| { echo "comment FAILED on #$PR — stopping; look before retrying, it may have landed" >&2; break; }
464+
sleep 8
465+
gh pr close "$PR" --repo modelcontextprotocol/servers </dev/null \
466+
|| { echo "close FAILED on #$PR (its comment is posted; close it, do not re-comment) — stopping" >&2; break; }
467+
sleep 8
454468
done < "$D/manifest.tsv"
455469
```
456470

471+
Each `sleep 8` paces a sustained loop, long enough to stay inside every limit
472+
in `AGENTS.md` **Pacing GitHub writes** for as long as the batch runs.
473+
457474
The step 0 issue closes take the same two sweep additions during the backlog
458475
sweep: the close label (`gh issue edit <N> --add-label`) and the `#4875`
459476
sentence at the end of the response, in the original comment rather than a

‎.claude/skills/pr-flow/SKILL.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ worth doing on its own. Implementing a suggestion differently is fine.
338338
-f body='Fixed in <sha>: …'
339339
```
340340

341+
A round with many comments is a bulk write: send the replies one at a time,
342+
paced by `AGENTS.md` **Pacing GitHub writes**.
343+
341344
- ⚠️ **Then post a PR-level summary of the round, in addition, never instead.**
342345
Inline replies go hidden once the fix is pushed, because the threads become
343346
outdated, so the summary is what keeps the round readable afterwards. It does

‎AGENTS.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,14 @@ would not, burns turns, and buries the result under no-op turns.
600600
- ⚠️ **If a notifier is already armed, wait for it.** Re-checking by hand
601601
alongside it is the polling this rule forbids.
602602

603+
## Pacing GitHub writes
604+
605+
**Pace bulk GitHub writes: 1 s between requests, never in parallel, under 80 a
606+
minute and 500 an hour.** The secondary limit refuses while `gh api rate_limit`
607+
still shows quota, and most `gh` writes are GraphQL. After a refusal, wait out
608+
`retry-after`, or a minute without one; a refused create can still land, so
609+
look before retrying.
610+
603611
## MCP protocol
604612

605613
- **Look protocol questions up; do not answer them from memory.** The repo

‎docs/contribution-model.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ issue so triage can score it.
137137
### 3. Close
138138

139139
Close each outside PR with the comment for its class, naming the harvest issue
140-
where there is one. Pace the closes (a pause of a few seconds between them, in
141-
batches) to stay under GitHub's secondary rate limit on content creation, and
142-
stop on the first failed call rather than carrying on blind.
140+
where there is one. Pace the closes as
141+
[`AGENTS.md` **Pacing GitHub writes**](../AGENTS.md#pacing-github-writes) says,
142+
and stop on the first failed call rather than carrying on blind.
143143

144144
Closing a PR does not delete it: its branch, diff and discussion stay readable,
145145
and the harvest issue links it.

0 commit comments

Comments
 (0)