mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-12 04:01:20 +00:00
feat(minimal): remove str_replace_editor from minimal profiles
This commit is contained in:
@@ -31,9 +31,8 @@ CODE_PROMPT = "Use run_code to compute the packaged worker smoke value."
|
||||
CODE_WORKER_TEXT = "code worker smoke ok"
|
||||
WORKFLOW_PROMPT = "Use workflow to compute the packaged worker smoke value without agents."
|
||||
WORKFLOW_WORKER_TEXT = "workflow worker smoke ok"
|
||||
MINIMAL_PROMPT = "Exercise the packaged minimal agent's persistent shell and string-replacement editor."
|
||||
MINIMAL_PROMPT = "Exercise the packaged minimal agent's persistent shell."
|
||||
MINIMAL_TEXT = "minimal agent smoke ok"
|
||||
MINIMAL_EDITOR_PATH_PREFIX = "Editor path: "
|
||||
FS_SEARCH_PROMPT = "Exercise the packaged filesystem search tools."
|
||||
FS_SEARCH_TEXT = "filesystem search smoke ok"
|
||||
FS_SEARCH_MARKER = "PACKAGED_FS_SEARCH_OK"
|
||||
@@ -324,7 +323,7 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]:
|
||||
spawn_node = spawn_node_tool_followup(call_id, tool_name, tool_text)
|
||||
if spawn_node is not None:
|
||||
return spawn_node
|
||||
minimal = minimal_tool_followup(body, call_id, tool_name, tool_text)
|
||||
minimal = minimal_tool_followup(call_id, tool_name, tool_text)
|
||||
if minimal is not None:
|
||||
return minimal
|
||||
advanced = advanced_tool_followup(body, call_id, tool_name, tool_text)
|
||||
@@ -343,14 +342,7 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]:
|
||||
for message in reversed(messages)
|
||||
if isinstance(message, dict) and message.get("role") == "user"
|
||||
]
|
||||
minimal_prompt = next(
|
||||
(
|
||||
prompt
|
||||
for prompt in user_prompts
|
||||
if prompt.startswith(f"{MINIMAL_PROMPT}\n{MINIMAL_EDITOR_PATH_PREFIX}")
|
||||
),
|
||||
None,
|
||||
)
|
||||
minimal_prompt = next((prompt for prompt in user_prompts if prompt == MINIMAL_PROMPT), None)
|
||||
# The minimal composition's assembled system prompt, advertised tool schemas, and
|
||||
# model-visible messages are pinned by its snapshot, not asserted here.
|
||||
if minimal_prompt is not None:
|
||||
@@ -523,12 +515,11 @@ def spawn_node_tool_followup(
|
||||
|
||||
|
||||
def minimal_tool_followup(
|
||||
body: dict[str, object],
|
||||
call_id: str,
|
||||
tool_name: str,
|
||||
tool_text: str,
|
||||
) -> list[dict[str, object]] | None:
|
||||
"""Verify the checked-in minimal composition's PTY and editor."""
|
||||
"""Verify the checked-in minimal composition's persistent PTY."""
|
||||
if not call_id.startswith("minimal-"):
|
||||
return None
|
||||
if call_id == "minimal-bash-1" and tool_name == MINIMAL_SHELL_TOOL:
|
||||
@@ -543,33 +534,6 @@ def minimal_tool_followup(
|
||||
expected = f"COUNT=2 CWD={MINIMAL_SHELL_SECOND_CWD}"
|
||||
if expected.lower() not in tool_text.lower():
|
||||
raise AssertionError(f"persistent shell did not retain state: {tool_text}")
|
||||
messages = body.get("messages")
|
||||
if not isinstance(messages, list):
|
||||
raise AssertionError("persistent editor smoke request has no messages")
|
||||
editor_path = next(
|
||||
(
|
||||
text.split(MINIMAL_EDITOR_PATH_PREFIX, 1)[1].strip()
|
||||
for message in messages
|
||||
if isinstance(message, dict) and message.get("role") == "user"
|
||||
for text in [message_text(message.get("content"))]
|
||||
if MINIMAL_EDITOR_PATH_PREFIX in text
|
||||
),
|
||||
None,
|
||||
)
|
||||
if editor_path is None:
|
||||
raise AssertionError("persistent editor smoke prompt has no editor path")
|
||||
return tool_call_chunks(
|
||||
"minimal-editor",
|
||||
"str_replace_editor",
|
||||
{
|
||||
"command": "create",
|
||||
"path": editor_path,
|
||||
"file_text": "created by packaged editor\n",
|
||||
},
|
||||
)
|
||||
if call_id == "minimal-editor" and tool_name == "str_replace_editor":
|
||||
if "New file created successfully" not in tool_text:
|
||||
raise AssertionError(f"packaged editor did not create its file: {tool_text}")
|
||||
return text_chunks(MINIMAL_TEXT)
|
||||
raise AssertionError(f"unexpected minimal-agent follow-up: {call_id} {tool_name}: {tool_text}")
|
||||
|
||||
@@ -1041,8 +1005,6 @@ def smoke_sdk_minimal(base_url: str, executable: Path, update_snapshots: bool) -
|
||||
first_request = len(MockModelHandler.requests)
|
||||
with tempfile.TemporaryDirectory(prefix="dsh-sdk-minimal-") as temporary:
|
||||
root = Path(temporary).resolve()
|
||||
editor_path = root / "created.txt"
|
||||
prompt = f"{MINIMAL_PROMPT}\n{MINIMAL_EDITOR_PATH_PREFIX}{editor_path}"
|
||||
dsh_home = root / "home"
|
||||
sessions = dsh_home / "sessions"
|
||||
with DeepSeekHarness(
|
||||
@@ -1056,13 +1018,11 @@ def smoke_sdk_minimal(base_url: str, executable: Path, update_snapshots: bool) -
|
||||
base_url=base_url,
|
||||
request_timeout_seconds=60,
|
||||
) as harness:
|
||||
result = harness.run(prompt, session_id="minimal-agent-smoke")
|
||||
result = harness.run(MINIMAL_PROMPT, session_id="minimal-agent-smoke")
|
||||
|
||||
event_text = json.dumps(result.events)
|
||||
if MINIMAL_TEXT not in event_text:
|
||||
raise AssertionError(f"minimal agent run emitted no final response: {result.events}")
|
||||
if editor_path.read_text() != "created by packaged editor\n":
|
||||
raise AssertionError(f"packaged editor wrote unexpected content: {editor_path.read_text()!r}")
|
||||
assert_session_log(sessions, root, MINIMAL_TEXT, "COUNT=1", "COUNT=2")
|
||||
|
||||
files = build_minimal_snapshot_files(MockModelHandler.requests[first_request:], root)
|
||||
|
||||
Reference in New Issue
Block a user