Skip to content

The agent that grows with you

fix(compression): enable native compaction for Astra 900K alias

qqx60b99e1932b9
diff --git a/agent/native_compaction.py b/agent/native_compaction.py
index d8ae08348a4..f5224cb0e52 100644
--- a/agent/native_compaction.py
+++ b/agent/native_compaction.py
@@ -26,15 +26,22 @@ LOCAL_TRIGGER_SAFETY_MARGIN = 8_192
DEFAULT_COMPACT_THRESHOLD = 200_000
# Substring match so dated snapshots and variants (gpt-5.6-mini) stay eligible.
_ELIGIBLE_MODEL_MARKER = "gpt-5.6"
+_ASTRA_NATIVE_COMPACTION_MODELS = frozenset({"gpt-6-astra", "gpt-6-astra-900k"})
def is_native_compaction_model(
model: Optional[str], *, provider: Optional[str] = None, base_url: Optional[str] = None,
) -> bool:
- """Preserve gpt-5.6 eligibility; Astra additionally requires official Codex OAuth."""
- model_name = (model or "").lower()
+ """Preserve gpt-5.6 eligibility; Astra additionally requires official Codex OAuth.
+
+ ``-900k`` is Hermes' local picker alias and is stripped before the request is
+ sent. It must retain the same native-compaction eligibility as the bare
+ Astra wire model; otherwise enabling the feature in a 900K session is a
+ silent no-op.
+ """
+ model_name = (model or "").strip().lower().rsplit("/", 1)[-1]
return _ELIGIBLE_MODEL_MARKER in model_name or (
- model_name == "gpt-6-astra"
+ model_name in _ASTRA_NATIVE_COMPACTION_MODELS
and (provider or "").strip().lower() == "openai-codex"
and is_official_codex_base_url(base_url or "")
)
diff --git a/tests/agent/test_native_compaction.py b/tests/agent/test_native_compaction.py
index a6fc0197115..5810fa6731c 100644
--- a/tests/agent/test_native_compaction.py
+++ b/tests/agent/test_native_compaction.py
@@ -46,6 +46,13 @@ class TestModelGate:
assert is_native_compaction_model("gpt-5.6-mini")
assert is_native_compaction_model("GPT-5.6-2026-07-15")
+ def test_astra_900k_picker_alias_is_eligible_on_official_codex_oauth(self):
+ assert is_native_compaction_model(
+ "gpt-6-astra-900k",
+ provider="openai-codex",
+ base_url="https://chatgpt.com/backend-api/codex",
+ )
+
def test_other_models_ineligible(self):
# gpt-5.1/5.2 fail server-side on context_management (live-verified);
# gpt-5.3-codex works upstream but is outside the supported set.