From c7bee8f961b84a1dc4baeab647ae195bb33a1bfe Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 11 Jun 2026 22:40:26 -0700 Subject: [PATCH] refactor(agent): drop unused tail_start param from _derive_auto_focus_topic The parameter was reserved-but-unused (del'd immediately); YAGNI. Test call site updated. --- agent/context_compressor.py | 4 +--- tests/agent/test_compress_focus.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index a1dd7142166..f83c2fba7c4 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -1630,11 +1630,9 @@ This compaction should PRIORITISE preserving all information related to the focu def _derive_auto_focus_topic( cls, messages: List[Dict[str, Any]], - tail_start: int, ) -> Optional[str]: """Infer a compact focus hint from the most recent real user turns.""" candidates: list[str] = [] - del tail_start # Reserved for callers that already know the protected-tail boundary. for idx in range(len(messages) - 1, -1, -1): msg = messages[idx] if msg.get("role") != "user": @@ -2108,7 +2106,7 @@ This compaction should PRIORITISE preserving all information related to the focu ) # Phase 3: Generate structured summary - summary_focus_topic = focus_topic or self._derive_auto_focus_topic(messages, compress_end) + summary_focus_topic = focus_topic or self._derive_auto_focus_topic(messages) summary = self._generate_summary(turns_to_summarize, focus_topic=summary_focus_topic) # If summary generation failed, behavior splits on diff --git a/tests/agent/test_compress_focus.py b/tests/agent/test_compress_focus.py index 8ffc5e2e712..662030277b4 100644 --- a/tests/agent/test_compress_focus.py +++ b/tests/agent/test_compress_focus.py @@ -166,7 +166,7 @@ def test_auto_focus_skips_context_summary_handoff(): {"role": "assistant", "content": "Latest tail response"}, ] - focus_topic = compressor._derive_auto_focus_topic(messages, tail_start=1) + focus_topic = compressor._derive_auto_focus_topic(messages) assert "OpenViking" in focus_topic assert "Bybit" not in focus_topic