From c94fe7a259b53efd7ceed43ed14e995b29951079 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Tue, 22 Sep 2026 12:28:37 +0530 Subject: [PATCH] docs(agent): say sampled_chars counts display chars in _sample_summary_records The coverage docstring (agent/context_compressor.py:3510-3511) said the counters count "record content only", but `sampled_chars` sums the *display* records (post `_bound_oversized_record` truncation) while `input_chars` sums the raw records. Spell that out so telemetry consumers do not compute `omitted` two different ways (gate 2c suggestion, L3512-3513/3524-3525). --- agent/context_compressor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 030ad6a3e9..870717810a 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -3566,8 +3566,11 @@ Summary generation was unavailable, so this is a best-effort deterministic fallb def _sample_summary_records(cls, records: Sequence[str]) -> Tuple[str, Dict[str, int]]: """Sample complete serialized records while retaining the character bound. - Returns the bounded transcript and record-level coverage counters (chars count record - content only, not separators or elision markers) for compression telemetry. + Returns the bounded transcript and record-level coverage counters for compression + telemetry. `input_chars` counts raw serialized record content; `sampled_chars` counts the + *display* chars of retained records (after intra-record truncation by + `_bound_oversized_record`); neither includes separators or elision markers, so + `omitted_chars = input_chars - sampled_chars` also covers truncated-away bytes. """ input_chars = sum(len(r) for r in records)