Repository navigation
Release 0.8.16 final review: mid-stream error classes, last-run answer check, long replies, docs - #575
Merged
Conversation
…'s unsupported stream event A stream that fails part way has already answered 200, so the SDK raises APIStatusError with status_code 200 and the kind only in the body (overloaded_error, rate_limit_error, ...). It classified as unknown: logged as an unexpected error with a traceback and sent with no retryable. It now reads the body's error type when the status says nothing. langchain-aws's ValueError for a stream event it has no parser for was answered as HTTP 400 'Invalid request' with the event dump; it is the provider's, so it now classifies as an unavailable provider failure. Tested: tests/test_core/test_model_errors.py 74 passed; the 10 new cases fail on the old classifier. The mid-stream errors come from the SDK's own SSE decoder.
…cord missing usage as NULL Final review of release 0.8.16. - A streamed reply was judged by the text of every model run, so a sentence written before a tool call made an empty last run look answered and the reader got a done holding only that sentence. It is now judged by the last run's text, as ModelRuns and the non-streamed paths already do; a last run cut off with no text is the 'ran out of room' error, not a cut-off warning. - A model's reply was held to the 10,000 characters a person may send, so a long reply (above all one cut off at the output limit) was refused after it was paid for: an error with no done when streamed, HTTP 500 when not. Replies may be 100,000 characters (MAX_ASSISTANT_MESSAGE_LENGTH); the streamed branch that still refuses one now carries the request id and writes its metrics row. - A non-streamed request with no reported usage recorded 0 tokens and a cost of 0.0; it now records NULL, as a streamed one does and as the warning says. - A non-streamed /chat answered a provider's ValueError as HTTP 400 with the provider's text; it is now logged with a traceback and answered as the generic 500. - A cut-off warning's metrics summary said 'with no answer' even with an answer. - Comments and docstrings corrected: the single-warning-element rationale (pinned embeds only), the SSE event lists, the Bedrock-era routing notes. Tested: the new cases fail on the old router and pass on this one. Full suite with the local-environment causes removed: see the pull request.
…ments A 502 for an empty or cut-off reply carries error_id and request_id in its JSON body. A streamed error showed the reference with a copy button; the non-streamed response path (streamingEnabled: false, or a non-SSE answer) dropped it. responseError now carries it on the error, so the persistent banner shows the same reference. Comments: a cut-off reply with no text and no code is an error from this server, not a warning plus done; 'centred' to 'centered'; the SSE event list in the header now has warning (with codes), error (error_id, request_id, retryable) and session. Tested: frontend/test-widget-paced-streaming.js 257 passed; the new reference checks fail on the old widget.
…ogged The loop over the logged records had no non-empty check, so a case that should log a community could log nothing and still pass. Both cases now assert the logged community ids equal the ids derived from the registry. Tested: tests/test_api/test_bedrock_deployments.py passes.
…a security entry, fix the fallback wording CHANGELOG: [Unreleased] becomes [0.8.16] with a new empty [Unreleased] above it. Entries for what the two review rounds shipped and the changelog lacked: an empty or cut-off reply is now an error or warning (HTTP 502 when not streamed, which a client that retries on 5xx will re-bill), classified stream failures, the unanswered message kept in the session, missing-usage logging, the CLI and widget changes, and the metrics rows of failed streams. A Security entry for #571 (unescaped model text in innerHTML, present in the 0.8.15 widget; pinned embeds stay exposed until re-pinned). Entries for this round's own fixes. The Luna fallback is described as the code does it: the deployment's Claude default with an error logged when the Bedrock key is missing, a warning for a caller's own key, OpenRouter or HTTP 500 with no ANTHROPIC_API_KEY. Luna is high by default, not never at maximum; the 27 s and 48 s figures are labeled. Also ADR 0014 and 0015, the ADR index titles, .context/api-structure.md (pointer at the top, fallback wording), the community config comments, deploy/Dockerfile, the bedrock_region description and two docstrings in core/config/community.py. Comments and documentation only; no config value changed. Tested: ruff check and format; the config and routing tests pass.
…widget's reply bound, one usage rule - A test for the streamed branch that still refuses a reply over the model limit: the error carries the request id, one 500 row is written with an error_message, the cost is kept, and nothing is stored. Removing the request id or the metrics call now fails it. - The widget's history check dropped a reply of exactly 100,000 characters, which the server keeps; it now accepts up to and including that length. - A non-streamed request's row is NULL when input plus output tokens are zero, the rule the streamed row and ModelRuns use, not the total field. - Docstrings: reply_problem's reply_text is the last run's text; _select_model names the platform's OpenRouter fallback. - Removed a duplicate TestRetiredEnvironmentVariables from test_bedrock_routing.py (tests/test_api/test_config.py has it); the hermetic fixture stays. Tested: the affected Python files (402 passed) and the widget suites.
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.
Replaces #573, which was squash-merged by mistake and undone (develop was reset to 600080f).
This one is to be merged with a merge commit, so the six commits stay in history.
Final review of release 0.8.16 (#562): fixes for what a third, differential review found.
Eight reviewers read the full
main...developdiff and the fixes of the first two rounds.None found a regression against
main; these are the defects and drift in the new code.Refs #569 (the rest of what the review found is added there as a comment).
Fixes
unknown: a stream that fails part way has already answered 200, so the SDK raisesAPIStatusErrorwith status 200 and the kind only in the body (overloaded_error).It was logged as an unexpected error with a traceback and sent with no
retryable. It is classified from the body's error type now.langchain-aws'sValueErrorfor a stream event it cannot parse is the provider's too (it was a 400 "Invalid request" carrying the event).ModelRunsand the non-streamed paths already did.A sentence written before a tool call ("Let me look that up") made an empty last run look answered, and the reader got a
doneholding only that sentence.The session held model text to the limit for a person's message, so a long reply, and above all one cut off at the output limit, ended a streamed chat in an
errorwith nodoneand no cut-off warning, and a non-streamed one in HTTP 500, after it was paid for.Replies may be 100,000 characters now (
MAX_ASSISTANT_MESSAGE_LENGTH); a person's message is still 10,000.This predates the release; Luna's 16,000-token output limit makes it likelier.
/chatanswered a provider'sValueErroras HTTP 400 with the provider's text; it is now logged with its traceback and answered as the generic 500.error_id) and copy button now show for a non-streamed 502, not only for a streamed error.ANTHROPIC_API_KEY), "never at maximum", the single-warning-element rationale, the SSE event lists, ADR index titles, a pointer at the top of.context/api-structure.md.ANTHROPIC_THINKING_BUDGET_TOKENS; the file is hermetic now.A deployment test that could pass with nothing logged now asserts the exact community ids.
No config value changed.
Testing
env -u ANTHROPIC_THINKING_BUDGET_TOKENS REQUIRE_API_AUTH=false uv run pytest tests: on the reviewing machine the retired variable is exported and the local.envturns API auth on, which fail 24 tests that pass in CI's environment).bunsuite CI runs,build-runtime-bundle.js --check,node --check: all pass.ruff check,ruff format --check: clean.ty: 49 diagnostics ondevelopand on this branch.donewith the streamed text equal to the final content.Not run live: the OpenRouter Haiku reasoning budget and
tests/test_integration/test_openrouter_citations.py.Before the release is published
AWS_BEARER_TOKEN_BEDROCK(checked read-only on the running container): set it, and recreate the container, or HED, EEGLAB, BIDS and NWB run Haiku with an error logged per request.ANTHROPIC_THINKING_BUDGET_TOKENSfrom the production env file: it is ignored now and logs a warning at startup..env.examplecannot be edited from the review session; lines 68-70 should read# Region the models are called in (default us-east-2, Ohio). Qwen3 Next runs in/# us-east-1 regardless: its Ohio endpoint does not answer., and lines 58-60 should say the Claude default runs "when ANTHROPIC_API_KEY is set (with none it goes to OpenRouter), with an error that names the community logged on every request that names no model".