fix(kanban): preserve worker tools with restricted toolsets

This commit is contained in:
haran2001
2026-05-18 20:24:31 -07:00
committed by Teknium
parent f12382fcc4
commit c30608cfbe
2 changed files with 37 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Public API (signatures preserved from the original 2,400-line version):
check_tool_availability(quiet) -> tuple
"""
import os
import json
import re
import asyncio
@ -299,6 +300,7 @@ def get_tool_definitions(
frozenset(disabled_toolsets) if disabled_toolsets else None,
registry._generation,
cfg_fp,
bool(os.environ.get("HERMES_KANBAN_TASK")),
)
cached = _tool_defs_cache.get(cache_key)
if cached is not None:
@ -334,7 +336,15 @@ def _compute_tool_definitions(
tools_to_include: set = set()
if enabled_toolsets is not None:
for toolset_name in enabled_toolsets:
effective_enabled_toolsets = list(enabled_toolsets)
if os.environ.get("HERMES_KANBAN_TASK") and "kanban" not in effective_enabled_toolsets:
# Dispatcher-spawned workers are scoped by HERMES_KANBAN_TASK and
# must always receive the lifecycle handoff tools. Assignee
# profiles may intentionally restrict their normal chat toolsets
# (for token/cost reasons), but that should not strip the kanban
# worker's completion/block/heartbeat surface.
effective_enabled_toolsets.append("kanban")
for toolset_name in effective_enabled_toolsets:
if validate_toolset(toolset_name):
resolved = resolve_toolset(toolset_name)
tools_to_include.update(resolved)