Skip to content

Release 0.8.17 review, round 1: retry only after the response began, log outages as outages - #588

Merged
neuromechanist merged 3 commits into
developfrom
fix/release-0.8.17-review-1
Oct 7, 2026
Merged

neuromechanist merged 3 commits into
developfrom
fix/release-0.8.17-review-1

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

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

  • The retry multiplied calls for an outage (found independently by three reviewers; one measured 3 requests become 6).
    worth_retrying_now retried a failure from before the response began, which botocore and the Anthropic SDK had already retried with backoff.
    ModelFailure now says mid_stream, read from what raised it: a service exception event inside a stream, a stream that ended with no messageStop, 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.
  • The same outage logged at two levels.
    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.
  • Bad token counts log one line with no traceback (the counts are in it), and a defect in the price table logs at ERROR, since it would take the usage line from every reply.
  • A throttle on the caller's own key says "The provider is rate limiting your API key. Wait a moment and try again.", since another model would be limited the same way.
  • The cancel log names the model, the session and the failure that started the wait.
  • 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 (3,000,001 values, compared again).
  • The CLI's print_error escapes its message: a custom model id such as foo[/bar] raised in Rich.
  • The changelog names both old error strings (/ask and /chat), says which clients retry throttles (OpenRouter's does not), says one request on develop stalled and not production, that -o json has usage in 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.
  • Tests: retried failures are now staged as in-stream errors (a botocore connection error was a failure before the response), 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, 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.
  • Tracking: NWB: remove the temporary docs PR preview origins once their pull requests merge #587 removes the six temporary NWB preview origins once their pull requests merge.

Not changed, and why

  • A per-process sliding-window counter that escalates a sustained failure: more machinery than this deployment needs; the ERROR level above makes an outage visible.
  • Rate limiting the bad-count warning: it is one line a reply, and how often it recurs is the number worth seeing.
  • A retried column on the request log: a retry that works is visible in the logs (Retrying ... and The 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.
  • Retrying the non-streamed /ask and /chat, and giving them the new wording: they still return the generic HTTP 500, as before; stated in the changelog.
  • A CLI-specific hint: the CLI sends no model, so "choose another model" cannot be acted on there; the message is the one chosen for every client.
  • Declaring 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_core and test_frontend, and every widget suite passes.
The 19 test_chat_resume_endpoint.py tests fail with 401 identically on a clean develop here, and tests/test_core/test_tagged_citations.py::TestLongWhitespaceRuns is a timing test that is flaky on develop too.

…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.
@neuromechanist neuromechanist added bug Something isn't working operations Operations, monitoring, and observability labels Oct 7, 2026
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.
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://fix-release-0.8.17-review-1-demo.osc.earth
Branch fix/release-0.8.17-review-1
Commit ba834e8

This preview will be updated automatically when you push new commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working operations Operations, monitoring, and observability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant