fix(evolution): prevent MCP tool re-injection into restricted review agent #2904

This commit is contained in:
zhayujie
2026-06-20 15:17:11 +08:00
parent a0e20ef311
commit 0bc0f2b930
2 changed files with 15 additions and 0 deletions

View File

@@ -424,6 +424,11 @@ def run_evolution_for_session(
enable_skills=True,
runtime_info=getattr(agent, "runtime_info", None),
)
# Mark this as a restricted review agent so runtime MCP reconciliation
# (ToolManager.sync_mcp_into_agent) will NOT silently re-inject MCP tools
# that _select_tools()/_guard_tools() intentionally withheld. Without this
# flag the review boundary would be re-opened on the first LLM turn.
review_agent._evolution_restricted = True
# Reuse the live model so it follows the user's configured model.
review_agent.model = agent.model
# Inject the evolution task brief AFTER the full system prompt: the agent