Repository navigation
Conversation
…fetch failed
Each catalog page that answers 429, 5xx, or a network error is tried up to
three times with a doubling wait that honors Retry-After. A single slow
page no longer fails a 247-page Replicate scan. The fetch-failure alarm
summary carries a safe reason ("HTTP 401 on page 1", "timeout on page 12",
"more than 20000 models"), since Slack hides fields when a summary is set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
BenchmarksNo unaccepted regressions. 74 benchmarks: 0 regressed, 0 accepted, 0 improved, 0 new, 0 removed. All benchmarks
|
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
404oops
marked this pull request as ready for review
December 2, 2026 22:02
…to fix/ai-model-monitor-page-retry
Salazareo
reviewed
Dec 4, 2026
Salazareo
left a comment
Member
There was a problem hiding this comment.
- A connection drop mid-page isn't retried. axios 1.20 attaches the response when the socket drops partway through the body (both the
abortedand streamerrorhandlers passresponse). A truncated page therefore hasresponse.status === 200.fetchPagetreats it as non-retryable, and the alarm saysHTTP 200 on page N. That's one of the failures this PR is meant to absorb. Only classify by status when it's 4xx or 5xx. Treat a response error with a 2xx status as a network failure: retry it, and give the reason asnetwork error. - Minor:
new URL(body.next, url)throws aTypeErroron a malformednextsuch ashttp://[, which ends up asunknown error. Wrap it and throwCatalogError('invalid page URL').
This PR doesn't depend on the chat routing PRs below it, so it could be rebased onto main and merged on its own.
This branch has not been deployed
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.
What
extensions/aiModelMonitor.tsretries each catalog page that answers 429, 5xx, or a network error, up to three attempts. It waits 1 s, then 2 s, or theRetry-Aftervalue capped at 10 s. The wait stops when the job loses its lease. A 4xx other than 429, or a response over the size cap, is not retried.Replicate model catalog could not be fetched (HTTP 401 on page 1). The same string goes in the alarm'sreasonfield. Slack hides fields when an alarm has a summary, so before this change the alert never said why. Reasons are built from the HTTP status, the axios error code, or the monitor's own checks. Upstream response bodies and keys are never included.doc/alarms.mddescribes the retries and the reason.Why
Replicate's
/v1/modelstakes 247 sequential requests at 25 models per page, about 2 minutes. Every 30 minutes, one 429, one 5xx, or one 15 s stall on any of those pages failed the whole scan. That raised an alarm that looked the same as a revoked key.Verification
extensions/aiModelMonitor.test.tspasses 41 tests. The 8 tests that cover the new behavior fail onmain: retry on 429 and on 503, reasons in the summary, and abort during the retry wait.api.replicate.comwith a local key: a full scan of 6,153 models, about 141 s, no alarm. An invalid key producedReplicate model catalog could not be fetched (HTTP 401 on page 1)after one request.npm run check: type check, tests, and benchmarks pass. Lint passes after formatting.🤖 Generated with Claude Code