From e3ae1c30da230a1321cbd957f337c089f21ae67a Mon Sep 17 00:00:00 2001 From: Timothy Date: Thu, 22 Jan 2026 12:23:54 -0800 Subject: [PATCH] fix: fully tested ruff lint --- core/framework/mcp/agent_builder_server.py | 3 ++- core/framework/runner/runner.py | 5 ++++- core/framework/runner/tool_registry.py | 10 +++++----- core/framework/testing/executor.py | 2 +- core/setup_mcp.py | 2 +- core/tests/test_orchestrator.py | 2 +- core/tests/test_runtime.py | 4 ++-- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/core/framework/mcp/agent_builder_server.py b/core/framework/mcp/agent_builder_server.py index 6d30c9f0..703a962e 100644 --- a/core/framework/mcp/agent_builder_server.py +++ b/core/framework/mcp/agent_builder_server.py @@ -15,6 +15,7 @@ from typing import Annotated from mcp.server import FastMCP from framework.graph import Goal, SuccessCriterion, Constraint, NodeSpec, EdgeSpec, EdgeCondition +from framework.graph.plan import Plan # Testing framework imports from framework.testing.test_case import Test, ApprovalStatus, TestType @@ -2644,7 +2645,7 @@ def get_pending_tests( # PLAN LOADING AND EXECUTION # ============================================================================= -def load_plan_from_json(plan_json: str | dict) -> "Plan": +def load_plan_from_json(plan_json: str | dict) -> Plan: """ Load a Plan object from exported JSON. diff --git a/core/framework/runner/runner.py b/core/framework/runner/runner.py index 772dd79a..49b4cedc 100644 --- a/core/framework/runner/runner.py +++ b/core/framework/runner/runner.py @@ -4,7 +4,7 @@ import json import os from dataclasses import dataclass, field from pathlib import Path -from typing import Callable +from typing import TYPE_CHECKING, Callable from framework.graph import Goal from framework.graph.edge import GraphSpec, EdgeSpec, EdgeCondition @@ -14,6 +14,9 @@ from framework.llm.provider import LLMProvider, Tool from framework.runner.tool_registry import ToolRegistry from framework.runtime.core import Runtime +if TYPE_CHECKING: + from framework.runner.protocol import CapabilityResponse, AgentMessage + @dataclass class AgentInfo: diff --git a/core/framework/runner/tool_registry.py b/core/framework/runner/tool_registry.py index da3904c7..a4ba691f 100644 --- a/core/framework/runner/tool_registry.py +++ b/core/framework/runner/tool_registry.py @@ -81,15 +81,15 @@ class ToolRegistry: param_type = "string" # Default if param.annotation != inspect.Parameter.empty: - if param.annotation == int: + if param.annotation is int: param_type = "integer" - elif param.annotation == float: + elif param.annotation is float: param_type = "number" - elif param.annotation == bool: + elif param.annotation is bool: param_type = "boolean" - elif param.annotation == dict: + elif param.annotation is dict: param_type = "object" - elif param.annotation == list: + elif param.annotation is list: param_type = "array" properties[param_name] = {"type": param_type} diff --git a/core/framework/testing/executor.py b/core/framework/testing/executor.py index 3efdc03d..f0b4ae69 100644 --- a/core/framework/testing/executor.py +++ b/core/framework/testing/executor.py @@ -142,7 +142,7 @@ class SyncAgentWrapper: # Check if we're already in an async context try: - loop = asyncio.get_running_loop() + asyncio.get_running_loop() # We're in an async context, can't use run_until_complete # This shouldn't happen in normal test execution raise RuntimeError("Cannot run sync wrapper from async context") diff --git a/core/setup_mcp.py b/core/setup_mcp.py index f8e33023..212030d0 100755 --- a/core/setup_mcp.py +++ b/core/setup_mcp.py @@ -110,7 +110,7 @@ def main(): print_step("Step 4: Testing MCP server...") try: # Try importing the MCP server module - result = subprocess.run( + subprocess.run( [sys.executable, "-c", "from framework.mcp import agent_builder_server"], check=True, capture_output=True, diff --git a/core/tests/test_orchestrator.py b/core/tests/test_orchestrator.py index f1d9b566..6229584b 100644 --- a/core/tests/test_orchestrator.py +++ b/core/tests/test_orchestrator.py @@ -26,7 +26,7 @@ class TestOrchestratorLLMInitialization: def test_uses_custom_model_parameter(self): """Test that custom model parameter is passed to LiteLLMProvider.""" with patch.object(LiteLLMProvider, '__init__', return_value=None) as mock_init: - orchestrator = AgentOrchestrator(model="gpt-4o") + AgentOrchestrator(model="gpt-4o") mock_init.assert_called_once_with(model="gpt-4o") diff --git a/core/tests/test_runtime.py b/core/tests/test_runtime.py index 38b46469..29924119 100644 --- a/core/tests/test_runtime.py +++ b/core/tests/test_runtime.py @@ -97,7 +97,7 @@ class TestDecisionRecording: # Set node context runtime.set_node("search-node") - decision_id = runtime.decide( + runtime.decide( intent="Search query", options=[{"id": "web", "description": "Web search"}], chosen="web", @@ -277,7 +277,7 @@ class TestConvenienceMethods: runtime = Runtime(tmp_path) runtime.start_run("test_goal", "Test") - decision_id = runtime.quick_decision( + runtime.quick_decision( intent="Log message", action="Write to stdout", reasoning="Standard logging",