Skip to content

The agent that grows with you

refactor(delegate): module headers condensed (one-line docstrings, logger comment inline)

Teknium9cf7c740305b
diff --git a/tools/delegate_tool_child_run.py b/tools/delegate_tool_child_run.py
index 9db3d2e2437..70dcf74dea2 100644
--- a/tools/delegate_tool_child_run.py
+++ b/tools/delegate_tool_child_run.py
@@ -1,9 +1,5 @@
"""Running ONE pre-built child agent: heartbeat, registry entry, workspace seeding,
-timeout/failure handling, result-entry assembly and cleanup (``_ChildRun``).
-
-Split out of ``tools/delegate_tool.py``; every moved name is re-imported there, so
-``tools.delegate_tool.<name>`` keeps resolving (and monkeypatching) as before.
-"""
+timeout/failure handling, result-entry assembly and cleanup (``_ChildRun``)."""
from __future__ import annotations
@@ -25,8 +21,7 @@ from tools.delegate_tool_results import (
_extract_output_tail, _looks_like_error_output, _stringify_tool_content, _summarize_tool_arguments,
)
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
def _num(value: Any, default: int = 0) -> int:
"""int() for counters that may be mocks/None on test doubles."""
diff --git a/tools/delegate_tool_config.py b/tools/delegate_tool_config.py
index 43569172ac3..de0b2c99d6f 100644
--- a/tools/delegate_tool_config.py
+++ b/tools/delegate_tool_config.py
@@ -1,7 +1,4 @@
-"""Delegation config knobs (delegation.* keys) and child credential/provider resolution.
-
-Split out of ``tools/delegate_tool.py``, which re-imports every name (patch targets stay valid).
-"""
+"""Delegation config knobs (delegation.* keys) and child credential/provider resolution."""
from __future__ import annotations
@@ -10,8 +7,7 @@ import os
from typing import Any, Dict, List, Optional
from utils import base_url_hostname, is_truthy_value
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
# Runtime-provider sentinel for providers that are not natively known; must
# match hermes_cli.runtime_provider.RUNTIME_PROVIDER_TYPE_CUSTOM.
diff --git a/tools/delegate_tool_dispatch.py b/tools/delegate_tool_dispatch.py
index 090a81dff99..a0f2959ee03 100644
--- a/tools/delegate_tool_dispatch.py
+++ b/tools/delegate_tool_dispatch.py
@@ -1,8 +1,6 @@
-"""Batch execution + background dispatch for delegate_task.
-
-``delegate_task`` builds a ``_Batch`` (children + origin identity) and hands it to
-``_run_batch``; everything here runs it synchronously or as ONE detached async unit.
-"""
+"""Batch execution + background dispatch for delegate_task: ``delegate_task`` builds a ``_Batch``
+(children + origin identity) and hands it to ``_run_batch``, which runs it synchronously or as ONE
+detached async unit."""
from __future__ import annotations
@@ -21,8 +19,7 @@ from tools.delegate_tool_progress import (
from tools.delegate_tool_registry import _capture_gateway_steer_authority
from tools.delegate_tool_results import _finalize_child_results
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
@dataclass
diff --git a/tools/delegate_tool_progress.py b/tools/delegate_tool_progress.py
index 28db6b1a77b..520eefdae90 100644
--- a/tools/delegate_tool_progress.py
+++ b/tools/delegate_tool_progress.py
@@ -1,7 +1,4 @@
-"""Child progress relay, console formatting and child system-prompt construction for delegate_task.
-
-Split out of ``tools/delegate_tool.py``, which re-imports every name (patch targets stay valid).
-"""
+"""Child progress relay, console formatting and child system-prompt construction for delegate_task."""
from __future__ import annotations
@@ -13,8 +10,7 @@ from contextlib import contextmanager
from typing import Any, Dict, List, Optional
from tools.delegate_tool_registry import _active_subagents, _active_subagents_lock
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
# Terminal child statuses that mean "the subagent did NOT deliver a usable result". Shared by the CLI spinner echo,
# the gateway failure notice, and the parent-facing failure summary so every surface agrees.
diff --git a/tools/delegate_tool_registry.py b/tools/delegate_tool_registry.py
index 64991b3c906..43d295d9ec1 100644
--- a/tools/delegate_tool_registry.py
+++ b/tools/delegate_tool_registry.py
@@ -1,7 +1,4 @@
-"""Live-subagent registry + model-facing control plane (list/steer/stop) for delegate_task.
-
-Split out of ``tools/delegate_tool.py``, which re-imports every name (patch targets stay valid).
-"""
+"""Live-subagent registry + model-facing control plane (list/steer/stop) for delegate_task."""
from __future__ import annotations
@@ -13,8 +10,7 @@ from typing import Any, Dict, List, Optional
from agent.interrupt_compat import request_hard_interrupt
from tools.registry import tool_error
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
_spawn_pause_lock = threading.Lock()
_spawn_paused: bool = False
diff --git a/tools/delegate_tool_results.py b/tools/delegate_tool_results.py
index 52daf1eeb5a..1690e8a37e8 100644
--- a/tools/delegate_tool_results.py
+++ b/tools/delegate_tool_results.py
@@ -1,7 +1,4 @@
-"""Subagent result post-processing: summary budget/spill, tool-trace summaries, lifecycle hooks and cost rollup.
-
-Split out of ``tools/delegate_tool.py``, which re-imports every name (patch targets stay valid).
-"""
+"""Subagent result post-processing: summary budget/spill, tool-trace summaries, lifecycle hooks and cost rollup."""
from __future__ import annotations
@@ -11,8 +8,7 @@ import threading
from typing import Any, Dict, List, Optional
from urllib.parse import urlsplit, urlunsplit
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
def _stringify_tool_content(content: Any) -> str:
"""Stable text for tool-result content. Some OpenAI-compatible paths return
diff --git a/tools/delegate_tool_tasks.py b/tools/delegate_tool_tasks.py
index df4dd6b7ed0..4c393a32193 100644
--- a/tools/delegate_tool_tasks.py
+++ b/tools/delegate_tool_tasks.py
@@ -1,7 +1,4 @@
-"""delegate_task input validation: tasks=[...] / legacy goal normalisation and per-task output schemas.
-
-Split out of ``tools/delegate_tool.py``, which re-imports every name (patch targets stay valid).
-"""
+"""delegate_task input validation: tasks=[...] / legacy goal normalisation and per-task output schemas."""
from __future__ import annotations
diff --git a/tools/delegate_tool_toolsets.py b/tools/delegate_tool_toolsets.py
index a28eb4b4b10..be75cf95a5f 100644
--- a/tools/delegate_tool_toolsets.py
+++ b/tools/delegate_tool_toolsets.py
@@ -1,7 +1,4 @@
-"""Child toolset resolution for delegate_task: what a child may and may never use.
-
-Split out of ``tools/delegate_tool.py``, which re-imports every name (patch targets stay valid).
-"""
+"""Child toolset resolution for delegate_task: what a child may and may never use."""
from __future__ import annotations
@@ -11,8 +8,7 @@ from typing import List, Optional
from toolsets import TOOLSETS
from tools.delegate_tool_config import _get_inherit_mcp_toolsets
-# Log-record parity with the origin module.
-logger = logging.getLogger("tools.delegate_tool")
+logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
# Tools that children must never have access to
DELEGATE_BLOCKED_TOOLS = frozenset(