Repository navigation
0.2.16
Changes since the last Release
Fixed
-
chunk_by_sentencesnever terminated when the chunk window was too small to carry an overlap. After emitting a packed chunk the loop walks back from the packed range to find the smallest tail worthoverlap_tokens, then restarts the next pack there. When only one sentence fits at a time -- the next one pushes the window overchunk_tokens-- that walk-back always lands onfirst, the sentence the chunk just started with, so the identical singleton was emitted forever while the output vector grew without bound. Two 6-token sentences withchunk_tokens = 10and any positive overlap is the minimal reproduction. The guard now requires strict forward progress (back > first), dropping the overlap for that one chunk rather than looping; a window that cannot hold two sentences cannot carry an overlap between them either. Reachable remotely:POST /v1/vector_stores/:name/fileschunks with the collection's stored window, so a collection created with a smallchunk_tokenshung the request thread and exhausted memory. -
The WAV parser sized an allocation from an unvalidated chunk header.
parse_wav_streamread the 32-bitchunk_sizeoff the wire and calledpcm_bytes.resize(chunk_size)before checking that the declared bytes were present, so a ~50-byte multipart upload declaring a 4 GiBdatachunk forced the allocation --std::bad_allocor the OOM killer, depending on the box, and onchimera servethat takes the whole server down rather than one request. The parser now measures the stream once up front and rejects any chunk claiming more than what remains, and a short read ondatais an error rather than a silently zero-filled tail. Rejecting rather than clamping is deliberate: a truncated buffer of zeroes transcribes as plausible silence, which is a worse failure than a 4xx. -
The text-only chat path prepended a second BOS. The comment above the call says chat templates emit
<|begin_of_text|>themselves and thatadd_specialmust therefore be false -- the multimodal path two branches up passesfalsefor exactly this reason -- but the text path passedtrue.chimera tokenizeshows the result directly: a Llama-3 templated prompt came back with128000 <|begin_of_text|>twice. Llama-3 reacts by emitting a stray<|start_header_id|>assistant<|end_header_id|>and losing track of the user turn. Nowfalse, matching both the comment and the mtmd path. -
RAG ingestion was neither atomic nor safely retryable. Each chunk was inserted in its own transaction, so a failed embed or insert partway through one request left the leading chunks committed while the caller saw an error -- and since nothing keys on
source_uri, retrying the same file duplicated everything that had already landed. One file (CLI) / one request (HTTP) is now one transaction.insert_documentmoved fromBEGIN/COMMITto a savepoint so it nests inside the caller's rather than failing with "cannot start a transaction within a transaction", and the newchimera_vector_store::Transactionis an RAII savepoint that rolls back unlesscommit()ran. -
Row iteration reported a failed query as a short result.
search_semanticloopedwhile (sqlite3_step(...) == SQLITE_ROW)and returned whatever it had collected, soSQLITE_BUSY,SQLITE_IOERRorSQLITE_CORRUPTmid-iteration surfaced as a valid partial answer -- and in a hybrid search, as the whole semantic leg silently vanishing. The siblingsearch_lexical_rawalready checked its terminal status; that pattern is now applied tosearch_semantic,list(collections),list_chats,load_messagesandlist_tables.find(collection by name) had the same shape in a different guise: it treated every non-SQLITE_ROWstatus as "no such collection", so a database error was reported as a missing row; it now distinguishesSQLITE_DONEfrom a genuine failure. -
Persisted media paths were interpolated into JSON rather than serialized. Interactive chat built
media_jsonby concatenating paths between quote characters, so any path containing a quote, a backslash (i.e. every Windows path) or a control character produced a body no JSON reader accepts -- losing the metadata the column exists to carry. It now builds anlohmann::jsonarray and dumps it. -
response_formatvalues outside the documented set were silently accepted. Anything that was nottext,srt,vttorverbose_jsonfell through to the default{"text": ...}body with HTTP 200, so a client that typo'dsrthad no way to notice. Unsupported values now return 400 naming the accepted set.
Added
-
Application-level request limits on the audio, image and RAG routes. The staged cpp-httplib already carries a 256 MB per-request payload cap (
_patch_server_http_payload_cap), but that is a floor rather than a policy: 256 MB of WAV still decodes to gigabytes of float samples, and the expensive parameters -- image batch count, image dimensions -- are small numbers in a small body that no payload cap can bound. Each route now checks its own bound before committing memory or the model worker: audio upload size (CHIMERA_MAX_AUDIO_BYTES, 256 MB), imagen(CHIMERA_MAX_IMAGE_BATCH, 16) and per-side dimensions (CHIMERA_MAX_IMAGE_DIM, 4096), and RAG document size (CHIMERA_MAX_RAG_TEXT_BYTES, 64 MB) plus chunk count (CHIMERA_MAX_RAG_CHUNKS, 100k -- chunk count follows the collection's window, not the request, so the byte cap does not bound it). All are-D-overridable at configure time and set far above any legitimate use; the point is that the pathological case fails fast with a 4xx instead of occupying the single-threaded sd or whisper worker indefinitely. -
A startup warning when the server is reachable off-host with no
--api-key. Upstream'smiddleware_validate_api_keygates every route except/healthand the UI assets -- chimera's own routes included -- soPOST /v1/chimera/shutdownand the/v1/chatshistory endpoints are protected whenever a key is configured. But it is opt-in, and with no key anyone who can reach the port can stop the process, or read prompts, reasoning and chat contents by walking/v1/chats/:id(ids are sequential rowids, authorized by existence alone). That is a defensible default on loopback and a bad surprise off it, so binding to a non-loopback address without a key now says so once on stderr instead of leaving it to the docs. -
Regression tests for the three defects the suite could not have caught. An over-declared WAV
datachunk and an unknownresponse_formatare driven throughPOST /v1/audio/transcriptions(the server surviving the first is half the assertion); the chunker case ingests 6-token sentences into a collection with a 10-token window and a positive overlap, where the timeout is the assertion -- before the fix that ingest never returned.