Repository navigation
fix: accept data-only SSE streams in responses adapter (#549) - #550
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-550Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr550.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] 🏷 Review complete — LGTM, ready for human merge (merging stays human-only per repo rules). Bug verification (independent, before touching code) Semantics audit
Pre-flight (re-run independently on branch
Scope is clean: single commit, 2 files (+56/−3), no version change. No duplicate open issues/PRs found covering this fix. |
|
简述这个主要是啥问题 |
[bot] 🏷 一句话:上游 SSE 流没带 展开一点:
修复:帧上没有 |
What changed
src/loop/adapter-responses.ts—parseStreamnow falls back to thetypefield inside thedata:JSON payload when a frame carries no explicitevent:line.Per the WHATWG SSE spec
event:is optional (defaults tomessage), and many OpenAI-compatible gateways emit puredata:frames. Previously every such frame was skipped (if (!type || !dataLine) continue;), so no terminal event was ever observed and a cleanly-finished upstream stream produced the syntheticresponse.failed/ "upstream returned no response" error reported in #549.event:line still wins over the payloadtype.typeare still skipped exactly as before.extractEventType(same semantics as the patch proposed in the issue, without the double parse).Tests
Three regression tests added in
tests/loop-adapters.test.ts(F8):done/completed, not a synthetic truncation failure;event:takes precedence over the payloadtype;response.completedand never "upstream returned no response".Verified tests 1 and 3 fail against the unfixed code.
Note:
parseAnthropicSseinsrc/loop/adapter-anthropic.tshas the same strictness (requires anevent:line). Left unchanged — Anthropic streams always carry event lines and no compatible gateway omitting them has been reported; flagged for awareness.Pre-flight
npm run typecheck: passnpm test: 949/950 pass; the single failure (resolveClientCommand: codex/claude resolve to themselves) fails identically on the clean tree in this environment (client binaries not installed) — unrelatednpm run build: pass