fix(llm): commit the staged head hash unconditionally on a recorded response

An unchained request with no system message staged None, and the record
step skipped the commit, so the previous head hash survived a transcript
that never received a head; a later chained request restoring that head
would have omitted it. The staged value is now committed as-is, None
included. Also pins each rejection predicate of is_usable_compression_point
with its own test.
This commit is contained in:
Alex committed 2026-09-05 11:26:25 +01:00
1 parent 5837c300df
commit 427d85d737
3 files changed
+51 -4

No files matched your search

+6 -4
View File
@@ -1423,10 +1423,12 @@ class OpenAILLM(BaseLLM):
if rid:
self._last_response_id = rid
# The provider recorded this request, so the head it carried (or
# kept) is now the chain's head.
if self._pending_system_hash is not None:
self._chain_system_hash = self._pending_system_hash
self._pending_system_hash = None
# kept) is now the chain's head — including "no head at all", when
# an unchained request went out without a system message: a stale
# hash would let a later chained request omit a head this
# transcript never received.
self._chain_system_hash = self._pending_system_hash
self._pending_system_hash = None
self._last_response_call_ids = self._function_call_ids(response)
usage = getattr(response, "usage", None)
if usage is not None: