This commit is contained in:
RAJVARDHAN 2026-09-24 14:53:06 +01:00 • committed by GitHub
commit b883db2704
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 11 deletions

View file

@ -660,6 +660,7 @@ def build_strix_agent(
skills: list[str] | None = None,
is_root: bool,
scan_mode: str = "deep",
model: str | None = None,
is_whitebox: bool = False,
is_diff_scoped: bool = False,
interactive: bool = False,
@ -725,7 +726,7 @@ def build_strix_agent(
instructions=instructions,
tools=tools,
tool_use_behavior=_finish_tool_use_behavior,
model=None,
model=model,
capabilities=[
Filesystem(
configure_tools=_make_filesystem_configurator(
@ -752,6 +753,7 @@ def make_child_factory(
chat_completions_tools: bool = False,
strict_tool_schemas: bool = True,
system_prompt_context: dict[str, Any] | None = None,
subagent_model: str | None = None,
) -> Any:
"""Return the runner-owned builder used by ``spawn_child_agent``.
@ -765,6 +767,7 @@ def make_child_factory(
name=name,
skills=skills,
is_root=False,
model=subagent_model,
scan_mode=scan_mode,
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,

View file

@ -195,6 +195,7 @@ async def run_strix_scan(
status_sink: StatusSink | None = None,
mcp_connection_requests: list[McpConnectionRequest] | None = None,
mcp_status_sink: McpStatusSink | None = None,
subagent_model: str | None = None,
) -> RunResultBase | None:
"""Run or resume one Strix scan against a sandbox.
@ -471,14 +472,15 @@ async def run_strix_scan(
)
child_agent_builder = make_child_factory(
scan_mode=scan_mode,
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
chat_completions_tools=chat_completions_tools,
strict_tool_schemas=strict_tool_schemas,
system_prompt_context=scope_context,
)
scan_mode=scan_mode,
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
chat_completions_tools=chat_completions_tools,
strict_tool_schemas=strict_tool_schemas,
system_prompt_context=scope_context,
subagent_model=subagent_model or scan_config.get("subagent_model"),
)
async def spawn_child_agent(**kwargs: Any) -> dict[str, Any]:
return await start_child_agent(

View file

@ -85,11 +85,12 @@ async def run_cli(args: Any) -> None: # noqa: PLR0915
scan_mode = getattr(args, "scan_mode", "deep")
scan_config: dict[str, Any] = {
scan_config: dict[str, Any] = {
"scan_id": args.run_name,
"targets": args.targets_info,
"user_instructions": args.instruction or "",
"user_instruction": args.instruction or "",
"run_name": args.run_name,
"subagent_model": getattr(args, "subagent_model", None),
"diff_scope": getattr(args, "diff_scope", {"active": False}),
"scan_mode": scan_mode,
"non_interactive": bool(getattr(args, "non_interactive", False)),

View file

@ -201,6 +201,17 @@ Strix Cloud:
),
)
parser.add_argument(
"--subagent-model",
dest="subagent_model",
type=str,
default=None,
help=(
"Model identifier to use for spawned subagents (e.g. claude-3-5-haiku, "
"gpt-4o-mini). If not specified, subagents inherit the root agent model."
),
)
parser.add_argument(
"--scope-mode",
type=str,
@ -465,3 +476,7 @@ def _load_resume_state(args: argparse.Namespace, parser: argparse.ArgumentParser
persisted_scan_mode = state.get("scan_mode")
if persisted_scan_mode and args.scan_mode == "deep":
args.scan_mode = persisted_scan_mode
persisted_subagent_model = state.get("subagent_model")
if not getattr(args, "subagent_model", None) and persisted_subagent_model:
args.subagent_model = persisted_subagent_model

View file

@ -0,0 +1,48 @@
import argparse
from pathlib import Path
import pytest
from strix.interface.cli_args import parse_arguments, _load_resume_state
def test_subagent_model_default_none(monkeypatch):
"""Verify --subagent-model defaults to None when omitted."""
monkeypatch.setattr("sys.argv", ["strix", "--target", "https://example.com"])
args = parse_arguments()
assert args.subagent_model is None
def test_subagent_model_flag_parsed(monkeypatch):
"""Verify --subagent-model accepts a model name."""
monkeypatch.setattr(
"sys.argv",
["strix", "--target", "https://example.com", "--subagent-model", "claude-3-5-haiku"],
)
args = parse_arguments()
assert args.subagent_model == "claude-3-5-haiku"
def test_resume_restores_subagent_model(monkeypatch, tmp_path):
"""Verify _load_resume_state restores persisted subagent_model."""
fake_state = {
"targets_info": [{"type": "domain", "original": "example.com"}],
"subagent_model": "gpt-4o-mini",
"scan_mode": "deep",
}
args = argparse.Namespace(
resume="test-run",
subagent_model=None,
scan_mode="deep",
diff_scope="auto",
targets_info=[],
workspace_mount=None,
)
parser = argparse.ArgumentParser()
monkeypatch.setattr("strix.report.writer.read_run_record", lambda run_dir: fake_state)
monkeypatch.setattr("strix.core_paths.run_dir_for", lambda r: tmp_path)
monkeypatch.setattr(Path, "exists", lambda self: True)
_load_resume_state(args, parser)
assert args.subagent_model == "gpt-4o-mini"