Skip to content

Commit 1d8a725

Browse files
authored
fix(smokes): track the dsh runner's reasoning_effort keyword (#4484)
The adapter has supplied reasoning_effort since the managed execution profile landed, but two hermetic fake-runner fixtures still declared the older keyword set. The falsifier was main's own public smoke: the built-in dsh host e2e failed with an unattributed host_failure, whose cause was `TypeError: run_dsh_turn() got an unexpected keyword argument 'reasoning_effort'` inside the fake runner. The fake runner now comes from one place -- FAKE_DSH_RUNNER_SIGNATURE in the generic-cli e2e smoke, which the built-in host smoke and the adapter smoke both already reuse -- so the next adapter keyword lands once instead of drifting in each caller. The emitted runner also asserts the resolved provider/model/effort it is handed, so a dropped profile fails at the seam instead of at the endpoint. Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com> Co-authored-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
1 parent edcddc7 commit 1d8a725

2 files changed

Lines changed: 33 additions & 11 deletions

File tree

‎examples/dsh-turn-host-adapter-smoke.py‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from __future__ import annotations
1010

1111
from hashlib import sha256
12+
import importlib.util
1213
import json
1314
import subprocess
1415
import sys
@@ -21,6 +22,16 @@
2122
if path not in sys.path:
2223
sys.path.insert(0, path)
2324

25+
# The generic-cli e2e smoke owns the fake runner source every host smoke reuses,
26+
# because a fake runner whose keyword signature lags the adapter turns into an
27+
# unattributed ``host_failure`` instead of naming the seam that moved.
28+
_BASE_PATH = REPO_ROOT / "examples" / "loopx-turn-dsh-e2e-smoke.py"
29+
_SPEC = importlib.util.spec_from_file_location("loopx_turn_dsh_e2e_smoke", _BASE_PATH)
30+
assert _SPEC is not None and _SPEC.loader is not None
31+
_base = importlib.util.module_from_spec(_SPEC)
32+
sys.modules[_SPEC.name] = _base
33+
_SPEC.loader.exec_module(_base)
34+
2435
import dsh_turn_host_adapter as adapter # noqa: E402
2536
from loopx.control_plane.turn_driver.executor import ( # noqa: E402
2637
validate_loopx_turn_host_result,
@@ -284,11 +295,10 @@ def test_subprocess_adapter_roundtrip_with_fake_dsh_runner() -> None:
284295
)
285296
runner.write_text(
286297
"import json, pathlib, sys\n"
287-
"def run_dsh_turn(*, prompt, session_id, workspace, session_root,\n"
288-
" provider, model, max_tokens, cordis, runtime_bin,\n"
289-
" request_timeout_seconds):\n"
290-
f" pathlib.Path({str(marker)!r}).write_text(prompt, encoding='utf-8')\n"
291-
f" return {block!r}\n",
298+
+ _base.FAKE_DSH_RUNNER_SIGNATURE
299+
+ f" pathlib.Path({str(marker)!r}).write_text(prompt, "
300+
+ "encoding='utf-8')\n"
301+
+ f" return {block!r}\n",
292302
encoding="utf-8",
293303
)
294304

‎examples/loopx-turn-dsh-e2e-smoke.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@
3636
MARKER_VALUE = "loopx-turn-dsh-e2e-step-1"
3737
ADAPTER = REPO_ROOT / "scripts" / "dsh_turn_host_adapter.py"
3838

39+
# The fake runner stands in for the DeepSeek Harness host, so its keyword
40+
# signature must track the keyword set the adapter supplies, which
41+
# ``loopx.dsh_goal_mode.turn_host_adapter.load_dsh_runner`` documents. Three
42+
# smokes load a fake runner, so the signature is emitted from this one place: a
43+
# fixture that lags the adapter otherwise surfaces as an unattributed
44+
# ``host_failure`` instead of a readable error at the seam that moved.
45+
FAKE_DSH_RUNNER_SIGNATURE = (
46+
"def run_dsh_turn(*, prompt, session_id, workspace, session_root,\n"
47+
" provider, model, reasoning_effort, max_tokens, cordis,\n"
48+
" runtime_bin, request_timeout_seconds):\n"
49+
" assert provider and model and reasoning_effort, (\n"
50+
" 'the adapter must hand over the resolved execution profile')\n"
51+
)
52+
3953

4054
def _write_fixture(root: Path) -> tuple[Path, Path, Path, Path]:
4155
project = root / "project"
@@ -127,12 +141,10 @@ def _write_fake_dsh_runner(root: Path, workspace: Path) -> Path:
127141
)
128142
runner.write_text(
129143
"import pathlib\n"
130-
"def run_dsh_turn(*, prompt, session_id, workspace, session_root,\n"
131-
" provider, model, max_tokens, cordis, runtime_bin,\n"
132-
" request_timeout_seconds):\n"
133-
f" pathlib.Path({str(workspace)!r}).joinpath({MARKER_NAME!r}).write_text("
134-
f"{MARKER_VALUE!r}, encoding='utf-8')\n"
135-
f" return {block!r}\n",
144+
+ FAKE_DSH_RUNNER_SIGNATURE
145+
+ f" pathlib.Path({str(workspace)!r}).joinpath({MARKER_NAME!r}).write_text("
146+
+ f"{MARKER_VALUE!r}, encoding='utf-8')\n"
147+
+ f" return {block!r}\n",
136148
encoding="utf-8",
137149
)
138150
return runner

0 commit comments

Comments
 (0)