From 7d3337a98e29a757b5c6d46d96c7f792ee2d07ea Mon Sep 17 00:00:00 2001 From: Tim O'Brien Date: Mon, 4 May 2026 18:14:45 +0000 Subject: [PATCH] fix: wire toolHintMaxLength through AgentLoop constructors The config field was added but never passed from config to AgentLoop. The value was always falling back to the default (40) regardless of what was set in config.json. Now passes tool_hint_max_length through all AgentLoop() call sites: - nanobot/nanobot.py (main bot) - nanobot/cli/commands.py (CLI agent, dev, webui commands) Also adds documentation in docs/configuration.md. --- docs/configuration.md | 20 ++++++++++++++++++++ nanobot/agent/loop.py | 6 +++++- nanobot/cli/commands.py | 3 +++ nanobot/nanobot.py | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index d0a7fe940..f5fb32cb7 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1131,3 +1131,23 @@ Disabled skills are excluded from the main agent's skill summary, from always-on | Option | Default | Description | |--------|---------|-------------| | `agents.defaults.disabledSkills` | `[]` | List of skill directory names to exclude from loading. Applies to both built-in skills and workspace skills. | + +## Tool Hint Max Length + +Tool hints are the short progress messages shown when the agent calls tools (e.g. `$ cd …/project && npm test`). By default, these are truncated at 40 characters, which can make long commands hard to read. + +Set `agents.defaults.toolHintMaxLength` to control the truncation threshold: + +```json +{ + "agents": { + "defaults": { + "toolHintMaxLength": 120 + } + } +} +``` + +| Option | Default | Description | +|--------|---------|-------------| +| `agents.defaults.toolHintMaxLength` | `40` | Maximum characters for tool hint display. Range: 20–500. Higher values show more of the command or path; lower values keep hints compact. | diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py index 6dff70732..9f4bcdd13 100644 --- a/nanobot/agent/loop.py +++ b/nanobot/agent/loop.py @@ -193,6 +193,7 @@ class AgentLoop: context_block_limit: int | None = None, max_tool_result_chars: int | None = None, provider_retry_mode: str = "standard", + tool_hint_max_length: int | None = None, web_config: WebToolsConfig | None = None, exec_config: ExecToolConfig | None = None, cron_service: CronService | None = None, @@ -237,7 +238,10 @@ class AgentLoop: else defaults.max_tool_result_chars ) self.provider_retry_mode = provider_retry_mode - self.tool_hint_max_length = defaults.tool_hint_max_length + self.tool_hint_max_length = ( + tool_hint_max_length if tool_hint_max_length is not None + else defaults.tool_hint_max_length + ) self.web_config = web_config or WebToolsConfig() self.exec_config = exec_config or ExecToolConfig() self.cron_service = cron_service diff --git a/nanobot/cli/commands.py b/nanobot/cli/commands.py index 23f409b53..2243b2fa6 100644 --- a/nanobot/cli/commands.py +++ b/nanobot/cli/commands.py @@ -518,6 +518,7 @@ def serve( context_block_limit=runtime_config.agents.defaults.context_block_limit, max_tool_result_chars=runtime_config.agents.defaults.max_tool_result_chars, provider_retry_mode=runtime_config.agents.defaults.provider_retry_mode, + tool_hint_max_length=runtime_config.agents.defaults.tool_hint_max_length, web_config=runtime_config.tools.web, exec_config=runtime_config.tools.exec, restrict_to_workspace=runtime_config.tools.restrict_to_workspace, @@ -632,6 +633,7 @@ def _run_gateway( context_block_limit=config.agents.defaults.context_block_limit, max_tool_result_chars=config.agents.defaults.max_tool_result_chars, provider_retry_mode=config.agents.defaults.provider_retry_mode, + tool_hint_max_length=config.agents.defaults.tool_hint_max_length, exec_config=config.tools.exec, cron_service=cron, restrict_to_workspace=config.tools.restrict_to_workspace, @@ -1024,6 +1026,7 @@ def agent( context_block_limit=config.agents.defaults.context_block_limit, max_tool_result_chars=config.agents.defaults.max_tool_result_chars, provider_retry_mode=config.agents.defaults.provider_retry_mode, + tool_hint_max_length=config.agents.defaults.tool_hint_max_length, exec_config=config.tools.exec, cron_service=cron, restrict_to_workspace=config.tools.restrict_to_workspace, diff --git a/nanobot/nanobot.py b/nanobot/nanobot.py index 5e5857595..60c6dcdcb 100644 --- a/nanobot/nanobot.py +++ b/nanobot/nanobot.py @@ -76,6 +76,7 @@ class Nanobot: context_block_limit=defaults.context_block_limit, max_tool_result_chars=defaults.max_tool_result_chars, provider_retry_mode=defaults.provider_retry_mode, + tool_hint_max_length=defaults.tool_hint_max_length, web_config=config.tools.web, exec_config=config.tools.exec, restrict_to_workspace=config.tools.restrict_to_workspace,