fix(compression): enable native compaction for Astra 900K alias
(cherry picked from commit 8ce2851f0495db8afb44118928f4c3695bb12e06)
This commit is contained in:
@@ -26,15 +26,22 @@ LOCAL_TRIGGER_SAFETY_MARGIN = 8_192
|
|||||||
DEFAULT_COMPACT_THRESHOLD = 200_000
|
DEFAULT_COMPACT_THRESHOLD = 200_000
|
||||||
# Substring match so dated snapshots and variants (gpt-5.6-mini) stay eligible.
|
# Substring match so dated snapshots and variants (gpt-5.6-mini) stay eligible.
|
||||||
_ELIGIBLE_MODEL_MARKER = "gpt-5.6"
|
_ELIGIBLE_MODEL_MARKER = "gpt-5.6"
|
||||||
|
_ASTRA_NATIVE_COMPACTION_MODELS = frozenset({"gpt-6-astra", "gpt-6-astra-900k"})
|
||||||
|
|
||||||
|
|
||||||
def is_native_compaction_model(
|
def is_native_compaction_model(
|
||||||
model: Optional[str], *, provider: Optional[str] = None, base_url: Optional[str] = None,
|
model: Optional[str], *, provider: Optional[str] = None, base_url: Optional[str] = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Preserve gpt-5.6 eligibility; Astra additionally requires official Codex OAuth."""
|
"""Preserve gpt-5.6 eligibility; Astra additionally requires official Codex OAuth.
|
||||||
model_name = (model or "").lower()
|
|
||||||
|
``-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 (
|
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 (provider or "").strip().lower() == "openai-codex"
|
||||||
and is_official_codex_base_url(base_url or "")
|
and is_official_codex_base_url(base_url or "")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ class TestModelGate:
|
|||||||
assert is_native_compaction_model("gpt-5.6-mini")
|
assert is_native_compaction_model("gpt-5.6-mini")
|
||||||
assert is_native_compaction_model("GPT-5.6-2026-07-15")
|
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):
|
def test_other_models_ineligible(self):
|
||||||
# gpt-5.1/5.2 fail server-side on context_management (live-verified);
|
# 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.
|
# gpt-5.3-codex works upstream but is outside the supported set.
|
||||||
|
|||||||
Reference in New Issue
Block a user