Commit Graph
22 Commits
Author SHA1 Message Date
9qeklajc 9e9c2bde57 fix: buffer-based SSE parser for all supported providers
Replace the fragile `re.split(b"data: ")` streaming parser with a
buffered, event-delimited parser in both the chat-completion and
Responses-API streamers. Events are accumulated until the SSE blank-line
delimiter, so parsing is independent of network chunk boundaries.

Fixes:
- OpenRouter `: OPENROUTER PROCESSING` keepalive comments no longer leak
  to clients as `data: : ...` (the `Unexpected token ':'` client crash).
- JSON payloads split across TCP reads are reassembled before parsing.
- CRLF framing (Gemini native alt=sse) handled.
- Combined content+usage chunks (Gemini thinking models over the
  OpenAI-compat endpoint) forward content once and still report usage in
  the cost trailer, instead of dropping the assistant message.
- Multi-line non-JSON `data` blocks are re-prefixed per line so they stay
  valid SSE framing for the client.

Adds tests/unit/test_streaming_sse_providers.py driving the real
generator against per-provider on-the-wire framing, and switches the
integration token-mint fallback to secrets.token_hex to kill a
PRNG/clock collision flake.
2026-06-07 12:58:54 +02:00
9qeklajc a637acd8f4 use db fixture 2026-04-09 23:08:01 +02:00
Shroominic 50c43e9b07 fix vision prompt discounted max_cost calculation 2025-11-13 16:47:26 +08:00
Shroominic 855061cc49 fix tests due to refactor 2025-10-22 12:18:28 +08:00
Shroominic 384a149600 fix tests 2025-10-04 20:52:15 +08:00
Shroominic 6d1525748d fix tests 2025-09-09 18:27:48 +01:00
Shroominic 496900baa6 test: update tests to patch settings and use fixed pricing flags 2025-09-08 10:53:23 +01:00
Cursor Agentanddb2002dominic 06050196d4 Add pytest coverage and XML reporting configuration
Co-authored-by: db2002dominic <db2002dominic@gmail.com>
2025-08-22 21:00:18 +00:00
Shroominic 503e861621 change dir 'router' -> 'routstr' 2025-08-09 14:55:26 -03:00
Shroominic e5e4888dba makefile + test improvements 2025-08-09 12:44:21 -03:00
Kyle 8bb2191fcc ruff check 2025-08-08 23:35:55 -04:00
Kyle 1036a6d85a fix edge cases for tests 2025-08-08 19:00:59 -04:00
Kyle 580dd375b6 test fixes 2025-08-08 18:26:25 -04:00
Kyle f0bb897f75 test fixes 2025-08-06 23:48:13 -04:00
Kyle 2aebef7722 test fixes 2025-08-06 23:38:18 -04:00
Shroominic eb5d832719 fix mypy + ruff linting 2025-08-06 23:25:06 -03:00
Kyle 00b8933758 cleanup 2025-08-06 21:44:49 -04:00
Kyle 2918548990 cleanup 2025-08-06 21:33:00 -04:00
Shroominic 0558270c05 dump wip stash 2025-08-06 20:31:55 -03:00
Shroominic 5dce680d11 merge 2025-08-05 12:50:27 -03:00
Kyle Santiago bd354ac3e8 pydantic v1 + import fixes 2025-08-04 19:26:19 -04:00
Kyle Santiago d253195d06 feat: Implement Comprehensive Integration Tests 2025-07-26 14:53:59 -04:00