Skip to content

The agent that grows with you

refactor(compression): trim the fallback-authority salvage to its production path

Tekniumeb8b9618a09d
diff --git a/agent/context_compressor_summary.py b/agent/context_compressor_summary.py
index 90400ffdb8f..98cd03ce733 100644
--- a/agent/context_compressor_summary.py
+++ b/agent/context_compressor_summary.py
@@ -35,30 +35,20 @@ class SummaryDispatchMixin:
is refused, so every later attempt aborts (#123362). Name the main runtime explicitly.
A stall-fallback ``pinned`` route replaces the whole route: merged over the main runtime, the
main api_key/base_url would ride into the fallback entry's call (to its host, or instead of it).
-
- A main-model fallback is a *complete* route even when some of its fields are intentionally
- empty. Mark its task as authoritative so the auxiliary resolver keeps compression policy
- (timeout, concurrency, progress bounds and fallback chain) but cannot fill unset endpoint,
- credential, wire-mode or reasoning fields from the route that just failed (#113322, #130895).
+ The main route is complete even with empty fields: an authoritative task keeps compression
+ policy but never fills an unset endpoint/key/wire mode from the failed aux route (#130895).
"""
if pinned:
- route = dict(pinned)
- authoritative = route.pop("authoritative", False) is True
# Clear first: a keyless pin (local server) resolves its own credential, never the main one.
for key in ("provider", "model", "base_url", "api_key", "api_mode"):
call_kwargs.pop(key, None)
- call_kwargs.update(route)
- if authoritative:
- from agent.auxiliary_task_config import authoritative_auxiliary_task
-
- call_kwargs["task"] = authoritative_auxiliary_task(call_kwargs.get("task") or "compression")
+ call_kwargs.update(pinned)
return
if self.summary_model:
call_kwargs["model"] = self.summary_model
return
if not getattr(self, "_summary_model_fallen_back", False):
return
-
from agent.auxiliary_task_config import authoritative_auxiliary_task
call_kwargs["task"] = authoritative_auxiliary_task(call_kwargs.get("task") or "compression")
diff --git a/tests/agent/test_compression_aux_fallback_authority.py b/tests/agent/test_compression_aux_fallback_authority.py
index b6a9d109565..9012bddb3a0 100644
--- a/tests/agent/test_compression_aux_fallback_authority.py
+++ b/tests/agent/test_compression_aux_fallback_authority.py
@@ -15,7 +15,6 @@ from agent.auxiliary_task_config import (
authoritative_auxiliary_task,
)
from agent.context_compressor import ContextCompressor
-from agent.context_compressor_summary import SummaryDispatchMixin
CONFLICTING_COMPRESSION = {
@@ -82,29 +81,6 @@ def test_authoritative_task_strips_only_destination_fields():
assert resolved == ("openrouter", "main-model", None, "main-key", None)
-def test_fallen_back_summary_marks_task_route_authoritative():
- compressor = SimpleNamespace(
- summary_model="",
- _summary_model_fallen_back=True,
- provider="openrouter",
- model="main-model",
- base_url=None,
- api_key="main-key",
- api_mode="",
- )
- call_kwargs = {"task": "compression", "messages": []}
-
- SummaryDispatchMixin._apply_summary_route(compressor, call_kwargs)
-
- assert isinstance(call_kwargs["task"], AuthoritativeAuxiliaryTask)
- assert call_kwargs["task"] == "compression"
- assert call_kwargs["provider"] == "openrouter"
- assert call_kwargs["model"] == "main-model"
- assert call_kwargs["api_key"] == "main-key"
- assert "base_url" not in call_kwargs
- assert "api_mode" not in call_kwargs
-
-
def test_truncated_aux_summary_retries_on_complete_main_route():
with patch("agent.context_compressor.get_model_context_length", return_value=100_000):
compressor = ContextCompressor(
@@ -149,24 +125,3 @@ def test_truncated_aux_summary_retries_on_complete_main_route():
base_url=retry.get("base_url"),
api_key=retry.get("api_key"),
) == ("openrouter", "main-model", None, "main-key", None)
-
-
-def test_authoritative_pinned_route_does_not_leak_marker_to_call_llm():
- compressor = SimpleNamespace(summary_model="", _summary_model_fallen_back=False)
- call_kwargs = {"task": "compression", "messages": []}
-
- SummaryDispatchMixin._apply_summary_route(
- compressor,
- call_kwargs,
- {
- "provider": "openrouter",
- "model": "main-model",
- "api_key": "main-key",
- "authoritative": True,
- },
- )
-
- assert isinstance(call_kwargs["task"], AuthoritativeAuxiliaryTask)
- assert call_kwargs["provider"] == "openrouter"
- assert call_kwargs["model"] == "main-model"
- assert "authoritative" not in call_kwargs