Repository navigation
fix: keep the bots running through rare API and write failures - #199
Merged
Merged
Conversation
A repeated or missing endCursor now raises instead of refetching the same page until the job times out, and a REST page that isn't a list raises instead of yielding a dict's keys as items. Multi-page tests for both. Closes #43
A redirect with no Location raises a GitHubError, and a relative one is resolved against the request. Retry-After as an HTTP date is parsed, and an unreadable one waits a minute. A network error left after the retries is raised as a GitHubError, so callers that skip one item on API errors skip it on these too; which requests retry is unchanged. A GraphQL error entry that isn't an object raises instead of crashing, and the test fake stops a redirect cycle after the real client's hop limit.
A run whose flags.json write fails after it opened issues now leaves a way back: the next run adopts the bot's own open Like issues, and its open aggregate, by title instead of opening them again. A failed aggregate PATCH is logged and the sync goes on; an aggregate closed or deleted mid-edit gets a fresh issue for the new entries, so they aren't marked reviewed unseen. One failed issue lookup skips only that record. Closes #39
When rot's finish couldn't move a renamed entry's key in discussions.json, nothing tried again, and the hourly on_merge opened a second thread for the new name. Finish now records renames.json before the key move and retitles the thread either way; on_merge replays renames.json onto the mapping before creating anything, so the next run finishes the move, including after a rename collision. An old name that is listed again keeps its own key. Closes #37
Only a renames.json record that rot marked pending, because its discussions.json move failed, is replayed, and on_merge clears the mark once it has. A finished rename can no longer pull its thread back after the old name is relisted and unlisted. Threads are retitled only when their key is stored or will be: a rename needs the key move or its pending record, a drop needs its key removed.
ssl and http.client errors now count as network errors, so they retry and raise as GitHubError like the rest. An adopted aggregate keeps the entries its body already lists. A 404 on a review lookup reads as a deleted issue, like a 410. The test fake's paginate raises on a routed page that isn't a list, as the real client does.
4 of 5 tasks
This was referenced Nov 6, 2026
4 of 5 tasks
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.
Four reliability fixes, one commit per issue, plus two commits from review.
#43 Pagination.
list_discussionsstops with an error on a repeated or missingendCursorinstead of looping until the job times out.GitHub.paginateraises when a page isn't a list, rather than yielding a dict's keys. The test fake does the same for any routed page that isn't a list. Multi-page tests for both.#47 Odd API answers. A redirect with no
Locationraises, and a relative one resolves against the request.Retry-Aftergiven as an HTTP date is parsed; an unreadable one waits a minute. Network errors now mean anyOSError(ssl included) orhttp.client.HTTPException. One left after the retries is raised asGitHubError(0)with the cause kept, so callers that skip one item on API errors skip it on these too. Which requests retry is unchanged: POSTs and mutations still go out once unless the connection was refused or DNS failed. A GraphQL error entry that isn't an object raises instead of crashing. The fake stops a redirect cycle atMAX_HOPS.GraphQL
RATE_LIMITEDalready raisesRateLimited. Retrying it in place is left for later, so #47 stays open for that.#39 Like-burst state. If
flags.jsonfails to write after issues were opened, the next run adopts the bot's own open Like issues by title instead of opening them again. It adopts the open aggregate the same way and keeps the entries its body already lists. Only bot-authored issues count, so a title can't be forged. A failed aggregate PATCH is logged and the run continues. An aggregate closed or deleted mid-edit gets a fresh issue for the new entries, so they aren't marked reviewed unseen. One failed issue lookup skips only that record, and a 404 or 410 there reads as deleted.Known gap: re-adoption only sees open issues. If
flags.jsonis lost and a maintainer has already closed the burst issue, the next run can flag that entry and open a new issue for it.#37 Failed rename key move. If
finishcan't move a renamed key indiscussions.json, it writes therenames.jsonrecord markedpending.on_mergereplays pending records onto the mapping before creating threads, then clears the mark, so the next hourly run finishes the move instead of opening a second thread. That includes the rename-collision case, where the stored new key points at the dropped entry's thread. A completed rename is never replayed: relisting and then unlisting the old name can't pull the thread back. A rename's thread is retitled only if the key move or its pending record landed. A drop's thread becomes "Removed: ..." only once its key is gone. If both writes fail, titles and keys stay as they were.Closes #43
Closes #39
Closes #37
Refs #47