Repository navigation
fix: repair the defects a fourth audit found - #5
Merged
Merged
Conversation
Every item was reproduced or read in the code before it was changed, and each one has a test that fails without the fix. Gateway and engine - a caller abort is no longer classified as a timeout, and an exhausted attempt budget reports 504 instead of 502 (invariant 3's "before the first byte") - a reset or an edit mid-stream keeps the provider's in-flight count, so a second request cannot be admitted into a provider that is still streaming - queue_wait_ms is assigned from the original wait rather than added per attempt, and a waiter that loses a slot race re-queues at the head - RETRY_AFTER_CAP_MS = 0 means "ignore Retry-After", matching every other zero - a 2xx with an empty body answers 502 upstream_error, never a 200 with no body - a quoted .env value keeps its inline `#`, and persist() stops rewriting keys the operator never decided about - credential-shaped names (pass, pat, key, mfa) are masked again, while error_code, block_code and key_prefix stay readable Database and admin API - a route id is digits only, so /api/logs/0x10 is 404 instead of log 16 - a model id containing `%` is neither double-decoded nor a 500 - the log range is a Map, so ?range=constructor no longer queries the whole retention window - the CSV export streams to the socket instead of buffering 100k rows, and a cell starting with a tab, a carriage return, `=`, `+`, `-` or `@` is defused - the log's transfer detail (bytes, injected bytes, terminator) is stored instead of assembled and dropped; migration 6 adds the column Performance and dashboard - model hints are cached against the model table's revision, and one instant is read per evaluation pass - the provider list is grouped once, not rescanned per model - the dashboard renders the retry chain, a clear-filters control, the real eligibility label, a failed-detail state, and stops polling after unmount The key-limiter map is swept by the maintenance job, a per-key 429 carries x-ratelimit-limit/remaining, and the documented test counts and Docker defaults match the code.
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 this is
The fourth audit of the router, implemented: every defect, improvement and feature the report
listed, each with a test that fails without the change.
Verification
pnpm run check— cleanpnpm run typecheck— cleanpnpm run test:unit— 1004 checks across six filespnpm run test:smoke— 344 checksSMOKE_SLOW=1 pnpm run test:smoke— 348 checksGET /health200,GET /v1/models200 without a key, a chat completion with andwithout
stream: trueagainsttest/stub-provider.mjsSIGINTlogs[info] shutdown complete {"signal":"SIGINT"}and exits 0pnpm run check:commits main..HEAD— cleanNotes
request_logs.extra, the transfer detail the gateway already assembled andthe insert dropped.
UNION ALLrewrite of the log provider filter: SQLiteshort-circuits the
ORper row, so the JSON is only parsed for rows the direct branch missed.The reasoning is recorded in the comment at the filter instead.