Campaign 模式会自动执行配置中的评估命令
原文依据:7 处`evaluation_source.command` 会被绑定为命令,并且任何非兼容模式 campaign 都会调用基准评估;这条路径不依赖 `--run-selected-variants`。执行助手接收该字符串并在目标仓库中运行。
如果 campaign 文件来自不可信来源或用户只预期规划,命令可读取或修改仓库与当前账户可访问的文件、启动网络进程,或消耗 GPU/CPU。
在提供 campaign 文件且进入非兼容模式时,编排器会无条件调用基准评估;这不受 `--run-selected-variants` 控制。评估字符串随后作为 `--command` 交给执行助手在目标工作树运行。因此,只要 campaign 含有恶意、过时或破坏性的 `evaluation_source.command`,就可能修改文件、消耗算力或访问该进程可用的凭据。用户可要求作者把基准执行也改为独立显式选择,并限制命令、环境变量、网络及写入目录。
def bind_evaluation_command_to_variant_spec( variant_spec: Dict[str, Any], evaluation_source: Dict[str, Any],) -> Dict[str, Any]: if variant_spec.get("base_command") or not evaluation_source.get("command"): return variant_spec normalized = dict(variant_spec) normalized["base_command"] = str(evaluation_source["command"]).strip() normalized["base_command_source"] = "evaluation_source" if evaluation_source.get("primary_metric") and not normalized.get("primary_metric"):查看另外 6 个位置
eval_contract = eval_contract_payload(analysis_data, campaign, metric_policy) baseline_gate: Dict[str, Any] = {"decision": "not-applicable", "reason": "Baseline gate was not evaluated."} baseline_payload: Dict[str, Any] = {} if not compatibility_mode: baseline_gate, baseline_payload, _baseline_runtime = run_baseline_evaluation( train_execute_script=train_execute_script, run_execute_script=run_execute_script, repo_path=workspace_repo_path, current_research=current_research, evaluation_source=campaign["evaluation_source"], baseline_gate_cfg=campaign["baseline_gate"], runtime_root=runtime_root, model_profile_json=args.model_profile_json, required_model_capabilities=args.require_model_capability, gpu_monitor_enabled=not args.no_gpu_monitor, ) baseline_gate = compare_baseline_to_sota( else: run_args = [ "--repo", str(repo_path), "--command", command, "--timeout", str(int(baseline_gate_cfg.get("timeout") or 60)), "--runtime-root", str(runtime_root), ] payload = run_json(run_execute_script, add_model_profile_args(run_args, model_profile_json, required_model_capabilities)) payload.setdefault("stop_reason", "command_completed" if payload.get("status") == "success" else "command_checked") runtime_seconds = round(time.perf_counter() - start, 3) parser.add_argument("--include-setup-pass", action="store_true", help="Include env-and-assets-bootstrap in the planned chain.") parser.add_argument("--run-selected-variants", action="store_true", help="Execute a small number of exploratory variants through the trusted execution helpers.") parser.add_argument("--max-executed-variants", type=int, default=None, help="Maximum number of exploratory variants to execute when execution is enabled.") parser.add_argument("--variant-timeout", type=int, default=None, help="Timeout in seconds for each executed exploratory variant.") args = parser.parse_args()) -> Dict[str, Any]: if variant_spec.get("base_command") or not evaluation_source.get("command"): return variant_spec normalized = dict(variant_spec) normalized["base_command"] = str(evaluation_source["command"]).strip() normalized["base_command_source"] = "evaluation_source" if evaluation_source.get("primary_metric") and not normalized.get("primary_metric"): baseline_payload: Dict[str, Any] = {} if not compatibility_mode: baseline_gate, baseline_payload, _baseline_runtime = run_baseline_evaluation( train_execute_script=train_execute_script, run_execute_script=run_execute_script, repo_path=workspace_repo_path, current_research=current_research, evaluation_source=campaign["evaluation_source"], baseline_gate_cfg=campaign["baseline_gate"], runtime_root=runtime_root, model_profile_json=args.model_profile_json, required_model_capabilities=args.require_model_capability, gpu_monitor_enabled=not args.no_gpu_monitor, ) baseline_gate = compare_baseline_to_sota( parser.error(f"model profile is missing required capabilities: {', '.join(missing)}") execution = execute_command( repo, args.command, args.timeout, args.shell_mode, runtime_root, model_adapter, args.monitor_gpu, ) metric_data = parse_metrics(combine_logs([execution.get("stdout", ""), execution.get("stderr", "")]))