faa422072c
* feat(subagents): make subagent timeout configurable via config.yaml - Add SubagentsAppConfig supporting global and per-agent timeout_seconds - Load subagents config section in AppConfig.from_file() - Registry now applies config.yaml overrides without mutating builtin defaults - Polling safety-net in task_tool is now dynamic (execution timeout + 60s buffer) - Document subagents section in config.example.yaml - Add make test command and enforce TDD policy in CLAUDE.md - Add 38 unit tests covering config validation, timeout resolution, registry override behavior, and polling timeout formula Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(subagents): add logging for subagent timeout config and execution - Log loaded timeout config (global default + per-agent overrides) on startup - Log debug message in registry when config.yaml overrides a builtin timeout - Include timeout in executor's async execution start log - Log effective timeout and polling limit when a task is dispatched - Fix UnboundLocalError: move max_poll_count assignment before logger.info Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci(backend): add lint step and run all unit tests via Makefile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix lint --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
"""Subagent registry for managing available subagents."""
|
|
|
|
import logging
|
|
from dataclasses import replace
|
|
|
|
from src.subagents.builtins import BUILTIN_SUBAGENTS
|
|
from src.subagents.config import SubagentConfig
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def get_subagent_config(name: str) -> SubagentConfig | None:
|
|
"""Get a subagent configuration by name, with config.yaml overrides applied.
|
|
|
|
Args:
|
|
name: The name of the subagent.
|
|
|
|
Returns:
|
|
SubagentConfig if found (with any config.yaml overrides applied), None otherwise.
|
|
"""
|
|
config = BUILTIN_SUBAGENTS.get(name)
|
|
if config is None:
|
|
return None
|
|
|
|
# Apply timeout override from config.yaml (lazy import to avoid circular deps)
|
|
from src.config.subagents_config import get_subagents_app_config
|
|
|
|
app_config = get_subagents_app_config()
|
|
effective_timeout = app_config.get_timeout_for(name)
|
|
if effective_timeout != config.timeout_seconds:
|
|
logger.debug(f"Subagent '{name}': timeout overridden by config.yaml ({config.timeout_seconds}s -> {effective_timeout}s)")
|
|
config = replace(config, timeout_seconds=effective_timeout)
|
|
|
|
return config
|
|
|
|
|
|
def list_subagents() -> list[SubagentConfig]:
|
|
"""List all available subagent configurations (with config.yaml overrides applied).
|
|
|
|
Returns:
|
|
List of all registered SubagentConfig instances.
|
|
"""
|
|
return [get_subagent_config(name) for name in BUILTIN_SUBAGENTS]
|
|
|
|
|
|
def get_subagent_names() -> list[str]:
|
|
"""Get all available subagent names.
|
|
|
|
Returns:
|
|
List of subagent names.
|
|
"""
|
|
return list(BUILTIN_SUBAGENTS.keys())
|