diff --git a/apps/backend/runners/github/services/issue_investigation_orchestrator.py b/apps/backend/runners/github/services/issue_investigation_orchestrator.py index 295713d3..032a4a93 100644 --- a/apps/backend/runners/github/services/issue_investigation_orchestrator.py +++ b/apps/backend/runners/github/services/issue_investigation_orchestrator.py @@ -82,24 +82,32 @@ INVESTIGATION_SPECIALISTS: list[SpecialistConfig] = [ prompt_file="investigation_root_cause.md", tools=["Read", "Grep", "Glob"], description="Trace the bug/issue to its source code paths and identify the root cause", + max_turns=40, + thinking_budget_multiplier=1.5, ), SpecialistConfig( name="impact", prompt_file="investigation_impact.md", tools=["Read", "Grep", "Glob"], description="Determine blast radius, affected components, and user impact", + max_turns=25, + thinking_budget_multiplier=1.0, ), SpecialistConfig( name="fix_advisor", prompt_file="investigation_fix_advice.md", tools=["Read", "Grep", "Glob"], description="Suggest concrete fix approaches with files to modify and patterns to follow", + max_turns=30, + thinking_budget_multiplier=1.0, ), SpecialistConfig( name="reproducer", prompt_file="investigation_reproduction.md", tools=["Read", "Grep", "Glob"], description="Determine reproducibility, check test coverage, and suggest test approaches", + max_turns=35, + thinking_budget_multiplier=1.0, ), ] @@ -337,15 +345,22 @@ Use Read, Grep, and Glob tools to explore the codebase. _output_schema = ( _schema_class.model_json_schema() if _schema_class else None ) + # Apply per-specialist thinking multiplier + _effective_budget = ( + int(thinking_budget * cfg.thinking_budget_multiplier) + if thinking_budget + else None + ) return self._run_specialist_session( config=cfg, prompt=_prompt, project_root=project_root, model=model, - thinking_budget=thinking_budget, + thinking_budget=_effective_budget, output_schema=_output_schema, agent_type="investigation_specialist", context_name=f"Investigation:{cfg.name}", + max_messages=cfg.max_turns, ) return factory diff --git a/apps/backend/runners/github/services/parallel_agent_base.py b/apps/backend/runners/github/services/parallel_agent_base.py index a7139676..96c93787 100644 --- a/apps/backend/runners/github/services/parallel_agent_base.py +++ b/apps/backend/runners/github/services/parallel_agent_base.py @@ -57,6 +57,8 @@ class SpecialistConfig: prompt_file: str tools: list[str] description: str + max_turns: int = 30 + thinking_budget_multiplier: float = 1.0 class ParallelAgentOrchestrator: diff --git a/tests/test_github_investigation.py b/tests/test_github_investigation.py index ece40936..18427d32 100644 --- a/tests/test_github_investigation.py +++ b/tests/test_github_investigation.py @@ -595,6 +595,8 @@ def _import_orchestrator(): prompt_file: str tools: list description: str + max_turns: int = 30 + thinking_budget_multiplier: float = 1.0 class ParallelAgentOrchestrator: def __init__(self, project_dir, github_dir, config, progress_callback=None):