Repository navigation
Conversation
|
Good diagnosis: swapping Two things worth a closer look before porting:
No forbidden paths touched, diff is small and self-contained, and the repro plus regression test make the intent to port easy to verify. Worth a maintainer's time once the above is confirmed. |
|
I checked both points against the PR head and reproduced a timing failure in the original HTTP fixture on the first local repeat. The updated fixture removes the 20 ms wait. For the completed response, the server cuts the gzip body only after the consumer observes the raw usage frame; the provider has already recorded usage in that synchronous transform, after the preceding finish frame. For the partial response, it cuts after the text delta is observed. The gzip trailer remains unfinished in both cases. The revised regression still fails against unmodified upstream production code. With this patch, it passed 20 separate-process runs on Windows/Bun 1.3.14; all 9 tests in the provider file and the provider TypeScript check pass. This is local repetition evidence, not cross-platform CI evidence: Public CI is still awaiting approval. The accumulator field names also match the gate: the accumulator declares promptTokens/completionTokens, the transform assigns them from prompt_tokens/completion_tokens, and flush maps them to inputTokens/outputTokens. The completion check reads that same accumulator. No production-code change was needed for this follow-up. |
Refs #1656.
Bun can report
ZlibErrorafter a chat-completions response has already delivered its answer, a recognized finish reason, and token usage. The provider'spipeThroughaborts the converter beforeflush, discarding that completion metadata. A real loopback reproduction on main then makespromptAiSdkStreamemitstream-interruptedand request continuation of an already completed answer.Allow the converter to close normally on a gzip/br decompression error only after a recognized finish status and finite usage have been parsed. Incomplete responses and other failures still abort the converter. Downstream cancellation continues to cancel the upstream body.
One regression serves a complete SSE answer with an unfinished gzip trailer and checks that text, finish status, and usage survive. Its partial-response control still rejects for the existing bounded recovery. The same final test fails on current main (
05e1006dc) and passes with the patch.Rechecked on Windows, Bun 1.3.14, using a temporary merge of current main (
05e1006dc) and this branch:git diff --checkpassed.Scope: this prevents an unnecessary continuation. Bun may still print its own decompression diagnostic to stderr, so this does not claim to resolve every symptom in #1656. No authenticated provider/TUI session or Linux/macOS build was run.