The -900k alias fix hand-rolled a second copy of the Astra slug set and its vendor-prefix normalization. agent/reasoning_effort.py::is_astra_model is the documented single home for that set (picker, effort vocabulary and request sanitizer already key off it), so the gate now calls it and a future Astra alias stays a one-line edit. The gpt-5.6 marker check is back to main's exact form. Tests move into the existing parametrized Astra gate table, which checks both the capability resolver and the per-request gate: -900k on official Codex OAuth is eligible; -900k through a relay or on provider openai is not. Docs and the config example no longer say "exact gpt-6-astra".
53 lines
2.4 KiB
Python
53 lines
2.4 KiB
Python
"""gpt-6-astra (and its ``-900k`` picker alias) is native-compaction eligible only on official
|
|
Codex OAuth (#103720).
|
|
|
|
Both the destination capability (``resolve_native_compaction_capabilities``) and the
|
|
per-request gate (``native_compaction_context_management``) must agree, and the request
|
|
gate must exclude Astra relays even when a trusted proxy advertises native compaction.
|
|
"""
|
|
|
|
from types import SimpleNamespace
|
|
|
|
import pytest
|
|
|
|
from agent.native_compaction import (
|
|
native_compaction_context_management,
|
|
resolve_native_compaction_capabilities,
|
|
)
|
|
|
|
_CODEX = "https://chatgpt.com/backend-api/codex"
|
|
|
|
|
|
@pytest.mark.parametrize("model,provider,base_url,eligible", [
|
|
("gpt-6-astra", "openai-codex", _CODEX, True),
|
|
("GPT-6-ASTRA", "openai-codex", "https://chatgpt.com:443/backend-api/codex/", True),
|
|
("gpt-6-astra-900k", "openai-codex", _CODEX, True),
|
|
("gpt-6-astra-900k", "openai-codex", "https://relay.example/v1", False),
|
|
("gpt-6-astra-900k", "openai", "https://api.openai.com/v1", False),
|
|
("gpt-6-astra", "openai", "https://api.openai.com/v1", False),
|
|
("gpt-6-astra", "openai", _CODEX, False),
|
|
("gpt-6-astra", "openai-codex", "https://relay.example/v1", False),
|
|
("gpt-6-astra", "openai-codex", "https://chatgpt.com.example/backend-api/codex", False),
|
|
("gpt-6-astra", "openai-codex", "http://chatgpt.com/backend-api/codex", False),
|
|
("gpt-6-astra", "openai-codex", None, False),
|
|
("gpt-6-astra-mini", "openai-codex", _CODEX, False),
|
|
("gpt-6-other", "openai-codex", _CODEX, False),
|
|
("gpt-5.6", "openai", "https://api.openai.com/v1", True),
|
|
("gpt-5.6", "openai-codex", _CODEX, True),
|
|
])
|
|
def test_astra_capability_and_request_gate_agree(model, provider, base_url, eligible):
|
|
is_codex = provider == "openai-codex"
|
|
resolved = resolve_native_compaction_capabilities(
|
|
model=model, provider=provider, base_url=base_url, is_codex_backend=is_codex,
|
|
)
|
|
assert resolved["native_compaction"] is eligible
|
|
agent = SimpleNamespace(
|
|
model=model, provider=provider, base_url=base_url,
|
|
codex_responses_native_compaction=True, compression_enabled=True,
|
|
capabilities={"openai_native_compaction": True},
|
|
)
|
|
for runtime in (None, resolved):
|
|
agent.runtime_capabilities = runtime
|
|
payload = native_compaction_context_management(agent, is_codex_backend=is_codex)
|
|
assert (payload is not None) is eligible
|