Skip to content

Commit 6edb6b7

Browse files
committed
include kimi & moonshot in tool-allowed models
1 parent d0d32d4 commit 6edb6b7

4 files changed

Lines changed: 51 additions & 1 deletion

File tree

surogates/harness/prompt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@
3737
# ---------------------------------------------------------------------------
3838

3939
# Model name substrings that trigger the tool-use enforcement fragment.
40+
# These models exhibit a "narrate the action instead of executing it"
41+
# pattern (e.g. "I will now create an artifact" followed by end-of-turn
42+
# with no tool call) often enough that the enforcement fragment pays for
43+
# itself in prompt budget. Claude and DeepSeek are *not* listed because
44+
# they reliably execute promised actions without the nag.
4045
TOOL_USE_ENFORCEMENT_MODELS: tuple[str, ...] = (
41-
"gpt", "codex", "gemini", "gemma", "grok",
46+
"gpt", "codex", "gemini", "gemma", "grok", "moonshot", "kimi",
4247
)
4348

4449
# Maximum bytes to read from any single memory/skill file.

surogates/orchestrator/worker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ async def harness_factory(session_id: UUID) -> AgentHarness:
275275
memory_manager=memory_manager,
276276
session=session,
277277
available_agents=available_agents,
278+
# The builder gates tool-aware guidance fragments (artifact,
279+
# memory, skills, expert, session_search, tool_use_enforcement)
280+
# on membership in ``available_tools``. Passing the registry's
281+
# live tool set keeps those fragments in the system prompt
282+
# instead of silently stripping them.
283+
available_tools=set(tool_registry.tool_names),
278284
)
279285

280286
# Interactive sessions get a regular user access token;

tests/test_artifacts.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,3 +653,31 @@ def test_guidance_not_injected_without_tool(self, tenant):
653653
)
654654
guidance = default_library().get("guidance/artifact")
655655
assert guidance not in pb._tool_guidance_section()
656+
657+
def test_worker_wires_registry_tool_names_into_builder(self, tenant):
658+
"""Regression: production worker must pass ``tool_registry.tool_names``
659+
to PromptBuilder so tool-aware guidance fragments reach the system
660+
prompt. Until session cbf414ac…e1362a1 made it visible, the worker
661+
constructed the builder with no ``available_tools`` and every
662+
tool-gated guidance fragment (artifact, memory, skills, expert,
663+
session_search, tool_use_enforcement) was silently dropped for
664+
every model on every session.
665+
"""
666+
from surogates.tools.registry import ToolRegistry
667+
from surogates.tools.runtime import ToolRuntime
668+
669+
registry = ToolRegistry()
670+
ToolRuntime(registry).register_builtins()
671+
assert "create_artifact" in registry.tool_names, (
672+
"registry must advertise create_artifact for this regression "
673+
"test to be meaningful"
674+
)
675+
676+
pb = PromptBuilder(
677+
tenant=tenant,
678+
available_tools=set(registry.tool_names),
679+
)
680+
section = pb._tool_guidance_section()
681+
assert default_library().get("guidance/artifact") in section
682+
assert default_library().get("guidance/memory") in section
683+
assert default_library().get("guidance/skills") in section

tests/test_platform_hints.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ def test_grok_gets_enforcement(self, tmp_path: Path):
146146
prompt = builder.build()
147147
assert "Tool-use enforcement" in prompt
148148

149+
def test_kimi_gets_enforcement(self, tmp_path: Path):
150+
# Added after session cbf414ac…e1362a1 where Kimi promised to
151+
# "offer an HTML artifact" and ended the turn without a tool call.
152+
tenant = _make_tenant(
153+
tmp_path,
154+
org_config={"agent_name": "Bot", "default_model": "moonshotai/kimi-k2.6"},
155+
)
156+
builder = PromptBuilder(tenant, available_tools={"terminal", "create_artifact"})
157+
prompt = builder.build()
158+
assert "Tool-use enforcement" in prompt
159+
149160

150161
# ---------------------------------------------------------------------------
151162
# Developer role routing

0 commit comments

Comments
 (0)