4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
70 lines
2.7 KiB
Python
70 lines
2.7 KiB
Python
from __future__ import annotations
|
|
|
|
from core.context_budget import context_budget_ceiling_for_model, strip_internal_message_markers
|
|
|
|
|
|
class TestGpt56ContextWindow:
|
|
"""GPT-5.6 ships a 1M-token window, unlike the 128k-pinned gpt-5 family (#3931)."""
|
|
|
|
def test_sol_reclaims_the_million_token_window(self) -> None:
|
|
# 1_000_000 window - 16_000 response headroom.
|
|
assert context_budget_ceiling_for_model("gpt-5.6-sol") == 984_000
|
|
|
|
def test_all_tiers_share_the_family_window(self) -> None:
|
|
sol = context_budget_ceiling_for_model("gpt-5.6-sol")
|
|
assert context_budget_ceiling_for_model("gpt-5.6-terra") == sol
|
|
assert context_budget_ceiling_for_model("gpt-5.6-luna") == sol
|
|
assert context_budget_ceiling_for_model("gpt-5.6") == sol
|
|
|
|
def test_gpt56_is_not_shadowed_by_the_gpt5_catch_all(self) -> None:
|
|
# ``_MODEL_CONTEXT_WINDOWS`` is matched by substring in insertion
|
|
# order with a break, so moving the ``gpt-5.6`` key below ``gpt-5``
|
|
# would silently pin 5.6 back to 128k. Nothing else would fail.
|
|
assert context_budget_ceiling_for_model("gpt-5.6-sol") > context_budget_ceiling_for_model(
|
|
"gpt-5.5"
|
|
)
|
|
|
|
def test_older_gpt5_models_keep_their_conservative_pin(self) -> None:
|
|
# 128_000 window - 16_000 response headroom.
|
|
assert context_budget_ceiling_for_model("gpt-5.5") == 112_000
|
|
assert context_budget_ceiling_for_model("gpt-5") == 112_000
|
|
|
|
|
|
def test_strip_internal_message_markers_removes_opensre_keys() -> None:
|
|
messages = [
|
|
{"role": "user", "content": "alert"},
|
|
{
|
|
"role": "assistant",
|
|
"content": [{"type": "tool_use", "id": "seed", "name": "n", "input": {}}],
|
|
"_opensre_seed": True,
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": [{"type": "tool_result", "tool_use_id": "seed", "content": "ok"}],
|
|
"_opensre_seed": True,
|
|
"_opensre_duplicate_result": True,
|
|
},
|
|
]
|
|
|
|
cleaned = strip_internal_message_markers(messages)
|
|
|
|
assert cleaned[0] == messages[0]
|
|
assert cleaned[1] == {
|
|
"role": "assistant",
|
|
"content": [{"type": "tool_use", "id": "seed", "name": "n", "input": {}}],
|
|
}
|
|
assert cleaned[2] == {
|
|
"role": "user",
|
|
"content": [{"type": "tool_result", "tool_use_id": "seed", "content": "ok"}],
|
|
}
|
|
assert messages[1]["_opensre_seed"] is True
|
|
assert messages[2]["_opensre_duplicate_result"] is True
|
|
|
|
|
|
def test_strip_internal_message_markers_preserves_other_underscore_keys() -> None:
|
|
messages = [{"role": "user", "content": "hi", "_custom": "keep"}]
|
|
|
|
cleaned = strip_internal_message_markers(messages)
|
|
|
|
assert cleaned == [{"role": "user", "content": "hi", "_custom": "keep"}]
|