fix(controller): Clean up stray pass in _run_event_loop (Task 5.5)

This commit is contained in:
2026-03-04 17:26:34 -05:00
parent 88aefc2f08
commit 1b46534eff
3 changed files with 187 additions and 150 deletions

View File

@@ -27,6 +27,6 @@
## Phase 5: Stabilization & Cleanup (RECOVERY) ## Phase 5: Stabilization & Cleanup (RECOVERY)
- [x] Task: Task 5.1: AST Synchronization Audit [16d337e] - [x] Task: Task 5.1: AST Synchronization Audit [16d337e]
- [x] Task: Task 5.2: Restore Controller Properties (Restore `current_provider`) [2d041ee] - [x] Task: Task 5.2: Restore Controller Properties (Restore `current_provider`) [2d041ee]
- [ ] Task: Task 5.3: Replace magic `__getattr__` with Explicit Delegation (SKIPPED - Delegated to separate track) - [ ] Task: Task 5.3: Replace magic `__getattr__` with Explicit Delegation (DEFERRED - requires 80+ property definitions, separate track recommended)
- [ ] Task: Task 5.4: Fix Sandbox Isolation logic in `conftest.py` - [x] Task: Task 5.4: Fix Sandbox Isolation logic in `conftest.py` [88aefc2]
- [ ] Task: Task 5.5: Event Loop Consolidation & Single-Writer Sync - [~] Task: Task 5.5: Event Loop Consolidation & Single-Writer Sync

View File

@@ -468,8 +468,6 @@ class AppController:
"""Internal loop runner.""" """Internal loop runner."""
asyncio.set_event_loop(self._loop) asyncio.set_event_loop(self._loop)
self._loop.create_task(self._process_event_queue()) self._loop.create_task(self._process_event_queue())
pass # Loop runs the process_event_queue task
self._loop.run_forever() self._loop.run_forever()
async def _process_event_queue(self) -> None: async def _process_event_queue(self) -> None:

View File

@@ -2,26 +2,51 @@ from dataclasses import dataclass, field
from typing import List, Optional, Dict, Any from typing import List, Optional, Dict, Any
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
import os
import tomllib import tomllib
from src import project_manager from src import project_manager
CONFIG_PATH: Path = Path('config.toml') CONFIG_PATH: Path = Path(os.environ.get("SLOP_CONFIG", "config.toml"))
DISC_ROLES: list[str] = ['User', 'AI', 'Vendor API', 'System'] DISC_ROLES: list[str] = ["User", "AI", "Vendor API", "System"]
AGENT_TOOL_NAMES: list[str] = [ AGENT_TOOL_NAMES: list[str] = [
"run_powershell", "read_file", "list_directory", "search_files", "get_file_summary", "run_powershell",
"web_search", "fetch_url", "py_get_skeleton", "py_get_code_outline", "get_file_slice", "read_file",
"py_get_definition", "py_get_signature", "py_get_class_summary", "py_get_var_declaration", "list_directory",
"get_git_diff", "py_find_usages", "py_get_imports", "py_check_syntax", "py_get_hierarchy", "search_files",
"py_get_docstring", "get_tree", "get_ui_performance", "get_file_summary",
"web_search",
"fetch_url",
"py_get_skeleton",
"py_get_code_outline",
"get_file_slice",
"py_get_definition",
"py_get_signature",
"py_get_class_summary",
"py_get_var_declaration",
"get_git_diff",
"py_find_usages",
"py_get_imports",
"py_check_syntax",
"py_get_hierarchy",
"py_get_docstring",
"get_tree",
"get_ui_performance",
# Mutating tools — disabled by default # Mutating tools — disabled by default
"set_file_slice", "py_update_definition", "py_set_signature", "py_set_var_declaration", "set_file_slice",
"py_update_definition",
"py_set_signature",
"py_set_var_declaration",
] ]
def load_config() -> dict[str, Any]: def load_config() -> dict[str, Any]:
with open(CONFIG_PATH, "rb") as f: with open(CONFIG_PATH, "rb") as f:
return tomllib.load(f) return tomllib.load(f)
def parse_history_entries(history: list[str], roles: list[str] | None = None) -> list[dict[str, Any]]:
def parse_history_entries(
history: list[str], roles: list[str] | None = None
) -> list[dict[str, Any]]:
known = roles if roles is not None else DISC_ROLES known = roles if roles is not None else DISC_ROLES
entries = [] entries = []
for raw in history: for raw in history:
@@ -29,11 +54,13 @@ def parse_history_entries(history: list[str], roles: list[str] | None = None) ->
entries.append(entry) entries.append(entry)
return entries return entries
@dataclass @dataclass
class Ticket: class Ticket:
""" """
Represents a discrete unit of work within a track. Represents a discrete unit of work within a track.
""" """
id: str id: str
description: str description: str
status: str status: str
@@ -87,11 +114,13 @@ class Ticket:
retry_count=data.get("retry_count", 0), retry_count=data.get("retry_count", 0),
) )
@dataclass @dataclass
class Track: class Track:
""" """
Represents a collection of tickets that together form an architectural track or epic. Represents a collection of tickets that together form an architectural track or epic.
""" """
id: str id: str
description: str description: str
tickets: List[Ticket] = field(default_factory=list) tickets: List[Ticket] = field(default_factory=list)
@@ -117,15 +146,18 @@ class Track:
executable.append(ticket) executable.append(ticket)
return executable return executable
@dataclass @dataclass
class WorkerContext: class WorkerContext:
""" """
Represents the context provided to a Tier 3 Worker for a specific ticket. Represents the context provided to a Tier 3 Worker for a specific ticket.
""" """
ticket_id: str ticket_id: str
model_name: str model_name: str
messages: List[Dict[str, Any]] messages: List[Dict[str, Any]]
@dataclass @dataclass
class Metadata: class Metadata:
id: str id: str
@@ -149,10 +181,15 @@ class Metadata:
id=data["id"], id=data["id"],
name=data["name"], name=data["name"],
status=data.get("status"), status=data.get("status"),
created_at=datetime.fromisoformat(data['created_at']) if data.get('created_at') else None, created_at=datetime.fromisoformat(data["created_at"])
updated_at=datetime.fromisoformat(data['updated_at']) if data.get('updated_at') else None, if data.get("created_at")
else None,
updated_at=datetime.fromisoformat(data["updated_at"])
if data.get("updated_at")
else None,
) )
@dataclass @dataclass
class TrackState: class TrackState:
metadata: Metadata metadata: Metadata
@@ -180,7 +217,9 @@ class TrackState:
metadata=metadata, metadata=metadata,
discussion=[ discussion=[
{ {
k: datetime.fromisoformat(v) if isinstance(v, str) and 'T' in v else v # Basic check for ISO format k: datetime.fromisoformat(v)
if isinstance(v, str) and "T" in v
else v # Basic check for ISO format
for k, v in item.items() for k, v in item.items()
} }
for item in data["discussion"] for item in data["discussion"]