mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-01 12:56:34 +08:00
test(agent): evaluate shared parent terminals
This commit is contained in:
@@ -25,7 +25,9 @@ from scripts.evaluation.world import EvaluationWorld
|
||||
|
||||
SUPPORTED_CLI_VERSION = "codex-cli 0.153.4"
|
||||
MAX_PROCESS_OUTPUT_BYTES = 8 * 1024 * 1024
|
||||
NATIVE_TERMINAL_SCENARIOS = frozenset({"terminal_session", "terminal_pty_session"})
|
||||
NATIVE_TERMINAL_SCENARIOS = frozenset(
|
||||
{"terminal_session", "terminal_pty_session", "subagent_terminal_share"}
|
||||
)
|
||||
NATIVE_BROWSER_SCENARIOS = frozenset({"browser_navigation"})
|
||||
NATIVE_STEERING_SCENARIOS = frozenset({"steering_long_context"})
|
||||
NATIVE_STEERING_MESSAGE_ID = "moviepilot-evaluation-steering"
|
||||
@@ -206,7 +208,12 @@ def _configuration(settings: ModelSettings, proxy: EvaluationModelProxy, server:
|
||||
"skill_mcp_dependency_install", "workspace_dependencies", "goals", "sleep_tool", "code_mode",
|
||||
"code_mode_host", "enable_request_compression", "unbounded_connection_retries", "tool_suggest",
|
||||
]
|
||||
if scenario_id not in {"command_execution", "terminal_session", "terminal_pty_session"}:
|
||||
if scenario_id not in {
|
||||
"command_execution",
|
||||
"terminal_session",
|
||||
"terminal_pty_session",
|
||||
"subagent_terminal_share",
|
||||
}:
|
||||
disabled.extend(("shell_tool", "unified_exec", "shell_snapshot"))
|
||||
if scenario_id == "browser_navigation":
|
||||
for feature in ("browser_use", "browser_use_external", "browser_use_full_cdp_access", "computer_use", "in_app_browser"):
|
||||
@@ -234,7 +241,12 @@ def _configuration(settings: ModelSettings, proxy: EvaluationModelProxy, server:
|
||||
"tools": {name: {"approval_mode": "approve"} for name in ("moviepilot_api", "read_skill", "read_tool_result")},
|
||||
}},
|
||||
}
|
||||
if scenario_id in {"command_execution", "terminal_session", "terminal_pty_session"}:
|
||||
if scenario_id in {
|
||||
"command_execution",
|
||||
"terminal_session",
|
||||
"terminal_pty_session",
|
||||
"subagent_terminal_share",
|
||||
}:
|
||||
# 命令场景只开放 CLI 已核对的两个终端动作;仍使用只读沙箱和 never 审批。
|
||||
configuration.update({f"features.{name}": True for name in ("shell_tool", "unified_exec", "shell_snapshot")})
|
||||
elif scenario_id == "browser_navigation":
|
||||
@@ -683,7 +695,10 @@ async def _run_codex(scenario_id: str, settings: ModelSettings, executable: str,
|
||||
if scenario_id in NATIVE_BROWSER_SCENARIOS else None
|
||||
)
|
||||
extra_native_tools = NATIVE_SHELL_TOOLS if scenario_id in {
|
||||
"command_execution", "terminal_session", "terminal_pty_session",
|
||||
"command_execution",
|
||||
"terminal_session",
|
||||
"terminal_pty_session",
|
||||
"subagent_terminal_share",
|
||||
} else frozenset()
|
||||
if browser_runtime is not None:
|
||||
extra_native_tools |= NATIVE_BROWSER_TOOLS
|
||||
@@ -737,7 +752,12 @@ async def _run_codex(scenario_id: str, settings: ModelSettings, executable: str,
|
||||
"success": True, "execution_outcome": "succeeded", "rendered": "BROWSER_OK",
|
||||
})
|
||||
events, final_text, completed = _events(result.get("stdout", ""))
|
||||
if scenario_id in {"command_execution", "terminal_session", "terminal_pty_session"}:
|
||||
if scenario_id in {
|
||||
"command_execution",
|
||||
"terminal_session",
|
||||
"terminal_pty_session",
|
||||
"subagent_terminal_share",
|
||||
}:
|
||||
_record_native_command_events(world, events)
|
||||
if any(event.get("type") == "evaluation.invalid_event" for event in events):
|
||||
failure = failure or "invalid_native_events"
|
||||
|
||||
Reference in New Issue
Block a user