fix(compression): update _pre_msg_count after durable adoption
Update _pre_msg_count after adopting the durable transcript so the post-compression log reflects the correct pre-adoption message count. Also use the existing _live_child_id() helper in the updated test instead of hand-rolled child-id extraction. Follow-up to #72631.
This commit is contained in:
parent
74ae2d3bf2
commit
8eaaa5021c
|
|
@ -1737,6 +1737,7 @@ def compress_context(
|
|||
len(durable_parent),
|
||||
)
|
||||
messages = durable_parent
|
||||
_pre_msg_count = len(messages)
|
||||
# Token estimate was for the stale snapshot; clear it so
|
||||
# the compressor re-derives from the adopted transcript
|
||||
# instead of under-counting the newly visible rows.
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
kshitijk4poor
|
||||
|
|
@ -377,9 +377,8 @@ def test_durable_message_committed_before_lease_is_adopted(
|
|||
assert returned is not stale_snapshot
|
||||
assert returned[0]["content"] == "[CONTEXT COMPACTION] summary"
|
||||
assert agent.session_id != parent_sid
|
||||
child = db.find_live_compression_child(parent_sid)
|
||||
assert child is not None
|
||||
child_id = child["id"] if isinstance(child, dict) else child
|
||||
child_id = _live_child_id(db, parent_sid)
|
||||
assert child_id is not None
|
||||
assert child_id == agent.session_id
|
||||
|
||||
def test_skipped_compression_returns_messages_unchanged(tmp_path: Path) -> None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue