refactor: remove legacy agent fallback paths
Remove legacy AnalystAgent fallback and EVO_AGENT_IDS=legacy test paths. EvoAgent is now the default for all supported roles. - Delete runs/_legacy/ backup directory (live/, backtest/, production/) - Remove test_evo_agent_legacy_mode test - Remove test_pipeline_create_runtime_analyst_uses_legacy_when_not_in_evo_ids test - Update TradingPipeline docstring to reflect EvoAgent-only runtime Constraint: EvoAgent migration completed in prior commits Scope-risk: narrow (test and comment cleanup only)
This commit is contained in:
@@ -103,7 +103,7 @@ class TradingPipeline:
|
||||
|
||||
Real-time updates via StateSync after each agent completes.
|
||||
|
||||
Supports both legacy agent lists and run-scoped agent loading.
|
||||
Supports run-scoped EvoAgent loading with workspace-driven configuration.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -305,71 +305,6 @@ def test_pipeline_create_runtime_analyst_uses_evo_agent_when_enabled(monkeypatch
|
||||
assert created.get("config_name") == "demo"
|
||||
|
||||
|
||||
def test_pipeline_create_runtime_analyst_uses_legacy_when_not_in_evo_ids(monkeypatch, tmp_path):
|
||||
"""Test that _create_runtime_analyst creates legacy AnalystAgent when not in EVO_AGENT_IDS."""
|
||||
from backend.core import pipeline as pipeline_module
|
||||
|
||||
created = {}
|
||||
|
||||
class DummyEvoAgent:
|
||||
name = "test_analyst"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
created.update(kwargs)
|
||||
self.toolkit = None
|
||||
|
||||
class DummyAnalystAgent:
|
||||
name = "test_analyst"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
created.update(kwargs)
|
||||
self.toolkit = None
|
||||
|
||||
# EVO_AGENT_IDS does not include fundamentals_analyst
|
||||
monkeypatch.setenv("EVO_AGENT_IDS", "technical_analyst")
|
||||
monkeypatch.setattr(pipeline_module, "EvoAgent", DummyEvoAgent)
|
||||
monkeypatch.setattr(pipeline_module, "AnalystAgent", DummyAnalystAgent)
|
||||
monkeypatch.setattr(
|
||||
pipeline_module,
|
||||
"create_agent_toolkit",
|
||||
lambda *args, **kwargs: "toolkit",
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
pipeline_module,
|
||||
"get_agent_model",
|
||||
lambda x: "model",
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
pipeline_module,
|
||||
"get_agent_formatter",
|
||||
lambda x: "formatter",
|
||||
)
|
||||
|
||||
# Create a mock pipeline instance
|
||||
class MockPM:
|
||||
def __init__(self):
|
||||
self.config = {"config_name": "demo"}
|
||||
|
||||
pipeline = pipeline_module.TradingPipeline(
|
||||
analysts=[],
|
||||
risk_manager=None,
|
||||
portfolio_manager=MockPM(),
|
||||
)
|
||||
|
||||
# Mock workspace_manager methods
|
||||
monkeypatch.setattr(
|
||||
pipeline_module.WorkspaceManager,
|
||||
"ensure_agent_assets",
|
||||
lambda *args, **kwargs: None,
|
||||
)
|
||||
|
||||
result = pipeline._create_runtime_analyst("test_analyst", "fundamentals_analyst")
|
||||
|
||||
assert "Created runtime analyst" in result
|
||||
# Should use legacy AnalystAgent
|
||||
assert created.get("analyst_type") == "fundamentals_analyst"
|
||||
|
||||
|
||||
def test_main_resolve_evo_agent_ids_returns_all_by_default(monkeypatch):
|
||||
"""Test that _resolve_evo_agent_ids returns all supported roles by default."""
|
||||
from backend.core import pipeline_runner as runner_module
|
||||
@@ -427,11 +362,3 @@ def test_evo_agent_supports_long_term_memory(monkeypatch, tmp_path):
|
||||
assert created["long_term_memory"] is dummy_memory
|
||||
|
||||
|
||||
def test_evo_agent_legacy_mode(monkeypatch):
|
||||
"""Test that EVO_AGENT_IDS=legacy disables EvoAgent."""
|
||||
from backend import main as main_module
|
||||
|
||||
monkeypatch.setenv("EVO_AGENT_IDS", "legacy")
|
||||
|
||||
resolved = main_module._resolve_evo_agent_ids()
|
||||
assert resolved == set()
|
||||
|
||||
Reference in New Issue
Block a user