Files
splinter/docs
lotherk 6358fcf42a openai: every streamed turn asks for usage, so compaction can fire
openai_stream passed the request options only when c->have_gen was set,
and only openai_server.c (splinter as a server, relaying a client's
request) ever set it. A normal turn therefore sent no
stream_options.include_usage, a provider that follows the OpenAI
contract returned no usage, reply.tokens_in stayed 0, last_in stayed 0,
and compact_threshold could never fire - a session grew monotonically to
250k tokens with the threshold at 128000.

The transport now always asks, with a local option block; the gateway
path keeps its caller's settings. Verified against a strict endpoint
that sends usage only when asked: before the fix two turns went 82->86
messages with no compaction, after it the second turn is 8 messages and
21 KB.

tests/test_usage_request.sh starts that strict endpoint (its usage is
emitted only when the request opts in) and asserts the request carries
the option and that the second turn is compacted. It fails without the
transport change.
2026-11-22 08:25:42 +00:00
..
2026-11-17 20:00:38 +00:00