diff --git a/src/openenv/harbor/deepseek_harness.py b/src/openenv/harbor/deepseek_harness.py index d8eb948286..c0a8ad6b02 100644 --- a/src/openenv/harbor/deepseek_harness.py +++ b/src/openenv/harbor/deepseek_harness.py @@ -7,13 +7,13 @@ - the same package and pin (npm `@deepseek-ai/dsh` 0.2.2-rc.1, every release a prerelease), on Node 24 through nvm; - the same command, `dsh headless --patch --json --permission-mode danger-full-access -- ` (no sandbox, no approvals, as every harness runs), with a fresh `DSH_HOME` per trial; -- the same three-entry profile patch: the route model as a custom `openai-completions` provider of its pi-ai adapter - (the model's context window and longest reply, the run's effort, the system prompt as role `system`), that model as - the agent's default, and its web search off (it needs a DeepSeek platform key the sandbox does not hold). +- the same model routing and web search settings: a custom `openai-completions` provider in the pi-ai adapter sets + the model's context window, longest reply, reasoning effort and system role. The profile selects that model as + the default and disables web search (it needs a DeepSeek platform key the sandbox does not hold). What differs from the board: the provider's base URL is the capture proxy and its key the capture session; the input is text only (vLLM serves the language model alone); the model's limits are the run's (`--max-model-len`, -`--max-output-tokens`), not the model's own. +`--max-output-tokens`), not the model's own. The compaction policy drops extra headroom for smaller context windows. The `deepseek-harness` seam (`seams.py`) points its `import_path` here. The run's effort and limits come from `OPENENV_DSH_EFFORT`, `OPENENV_DSH_CONTEXT_WINDOW` and `OPENENV_DSH_MAX_TOKENS` where the server runs (read in @@ -99,6 +99,11 @@ def profile_patch( "id": "tool-web", "config": {"search": False, "fetch": web_fetch, "searchTimeoutMs": 60000}, }, + # Zero headroom requires an explicit summary limit. Bound dsh's default by the route's reply budget. + { + "id": "compaction-basic", + "config": {"headroomTokens": 0, "maxTokens": min(65_536, max_tokens)}, + }, ] diff --git a/tests/envs/test_harbor_deepseek_harness.py b/tests/envs/test_harbor_deepseek_harness.py index bace77fab3..23debce6cd 100644 --- a/tests/envs/test_harbor_deepseek_harness.py +++ b/tests/envs/test_harbor_deepseek_harness.py @@ -78,6 +78,19 @@ def test_profile_routes_the_model_to_the_proxy(): assert by_id["tool-web"]["search"] is False +@pytest.mark.parametrize( + "window,max_tokens,summary_limit", + [(65_536, 32_768, 32_768), (131_072, 32_768, 32_768), (1_048_576, 131_072, 65_536)], +) +def test_profile_removes_extra_compaction_headroom(window, max_tokens, summary_limit): + patch = dsh.profile_patch("m", "http://proxy", "high", window, max_tokens) + by_id = {entry["id"]: entry["config"] for entry in patch} + assert by_id["compaction-basic"] == { + "headroomTokens": 0, + "maxTokens": summary_limit, + } + + def test_effort_none_is_dsh_off(): patch = dsh.profile_patch("m", "http://proxy", "none", 65536, 32768) route = patch[0]["config"]["providers"][dsh.DSH_PROVIDER]