Repository navigation
Release 0.8.17 review, round 1: retry only after the response began, log outages as outages - #588
Merged
Merged
Conversation
…s as outages Release review round 1 on #585: - the retry covered a failure before the response began, which botocore and the Anthropic SDK had already retried with backoff, so an outage could cost four to six calls per request; ModelFailure now says mid_stream (an exception event inside a stream, a stream ended with no messageStop, a dropped connection, an error event in a 200 stream) and only those are retried - a failure that was worth a retry and reached the reader anyway is logged at ERROR; it was a warning for a reply that had used a tool and an error for one that had not - bad token counts log one line with no traceback; a price-table defect logs at ERROR; a throttle on the caller's own key says the key is rate limited - the cancel log names the model, session and failure kind - the cost line rounded up to a cent or a dollar kept one decimal too many ($0.0100, $1.000); both formatters now judge the tier after rounding, and still print identical text for every whole micro-dollar from 0 to 3,000,000 - print_error escapes its message, since a model name with a bracket raised - tests: retried failures are staged as in-stream errors, with a control that the same failure with no output is retried, request counts for a refused Bedrock request, usage and partial after a retry, and a cancel test that waits for the retry instead of a fixed sleep Refs #578, #582. Tested: 3494 Python tests pass across test_api, test_metrics, test_cli, test_core and test_frontend (the 19 chat-resume 401s fail identically on develop, and tests/test_core/test_tagged_citations.py's reading-time test is flaky on develop too); every widget suite passes.
Both old error strings, the mid-stream scope of the retry, which clients retry throttles, one develop stall and not a production one, -o json, the NEMAR rule as the prompt states it, and that the wording and retry are for streamed replies. Not code: the changelog only.
The widget aborts its request at 120 s, which fires before Bedrock's 120 s read timeout (counted from the last byte), so a widget reader sees Connection timeout and an API or CLI client sees the unavailable message. Not code: the changelog only.
Contributor
Preview Deployment
This preview will be updated automatically when you push new commits. |
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.
Fixes from round 1 of the release review of #585 (four reviewers: code, error handling, tests, comments), applied before the release.
Refs #578, #582, #587.
What the review found, and what changed
worth_retrying_nowretried a failure from before the response began, which botocore and the Anthropic SDK had already retried with backoff.ModelFailurenow saysmid_stream, read from what raised it: a service exception event inside a stream, a stream that ended with nomessageStop, a dropped connection, an error event inside a 200 stream, and the Anthropic SDK's raw httpx errors.Only those are retried; each has a twin that is not (a 503 refusal, a connection that never opened, a 529 answer) in the tests.
OpenRouter is therefore no longer retried, since its failures cannot be told apart; a test pins it.
A failure that was worth a retry and reached the reader anyway (the retry failed, or a tool had run so there was none to make) is now logged at ERROR with its traceback.
Before, it was an ERROR for a reply that used no tool and a WARNING for one that did, so an alert on ERROR would see the minority.
$0.0100,$1.000).Both formatters now judge the tier after rounding, and still print identical text for every whole micro-dollar from $0 to $3 (3,000,001 values, compared again).
print_errorescapes its message: a custom model id such asfoo[/bar]raised in Rich./askand/chat), says which clients retry throttles (OpenRouter's does not), says one request on develop stalled and not production, that-o jsonhasusagein the JSON, and that the NEMAR rule is "noisy only when the dropped-epoch count supports it".It also says the retry and the new wording are for streamed replies.
partialafter a retry, for Anthropic too, matched to the request's row; the router cancel test waits for the retry instead of a fixed sleep; the by-hand price tests read the price table.Not changed, and why
retriedcolumn on the request log: a retry that works is visible in the logs (Retrying ...andThe second try ... succeeded) and not in the request metrics, which stays a known limitation; the extra row column and dashboard change are not for a release./askand/chat, and giving them the new wording: they still return the generic HTTP 500, as before; stated in the changelog.urllib3: botocore requires it, and a comment says so next to the import.Testing
3494 Python tests pass across
tests/test_api,test_metrics,test_cli,test_coreandtest_frontend, and every widget suite passes.The 19
test_chat_resume_endpoint.pytests fail with 401 identically on a clean develop here, andtests/test_core/test_tagged_citations.py::TestLongWhitespaceRunsis a timing test that is flaky on develop too.