hermes - 💡(How to fix) Fix [BUG] Clarify tool returns 'not available in this execution context' in gateway/Telegram mode

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

{"error": "Clarify tool is not available in this execution context."} The gateway (gateway/run.py) never passes clarify_callback to AIAgent, so self.clarify_callback is Noneclarify_tool.py:57 returns the error. 3. Error is returned, no inline keyboard buttons appear

Root Cause

The gateway (gateway/run.py) never passes clarify_callback to AIAgent, so self.clarify_callback is Noneclarify_tool.py:57 returns the error.

Additionally, the Telegram adapter (gateway/platforms/telegram.py) has:

  • No _clarify_state dict for storing prompt state
  • No send_clarify_prompt() method for inline keyboard buttons
  • No clarify: handler in _handle_callback_query

Fix Action

Fix / Workaround

Three-file patch adding ~100 lines total:

Full patch preserved in skill hermes-clarify-patch.

Code Example

{"error": "Clarify tool is not available in this execution context."}

---

gateway.run: clarify pending stored: ...
gateway.platforms.telegram: clarify callback received: ...
RAW_BUFFERClick to expand / collapse

Bug Description

After upgrading to current HEAD (~691 commits past v2026.4.30), the clarify tool stopped working in gateway mode on Telegram. Every call returns:

{"error": "Clarify tool is not available in this execution context."}

Root Cause

The gateway (gateway/run.py) never passes clarify_callback to AIAgent, so self.clarify_callback is Noneclarify_tool.py:57 returns the error.

Additionally, the Telegram adapter (gateway/platforms/telegram.py) has:

  • No _clarify_state dict for storing prompt state
  • No send_clarify_prompt() method for inline keyboard buttons
  • No clarify: handler in _handle_callback_query

Evidence

The old gateway (started April 27, pre-update) logged:

gateway.run: clarify pending stored: ...
gateway.platforms.telegram: clarify callback received: ...

After the update + restart, zero clarify-related code exists in either file.

Steps to Reproduce

  1. Run Hermes gateway on Telegram
  2. The agent attempts to call clarify tool
  3. Error is returned, no inline keyboard buttons appear

Environment

  • Hermes Agent v0.12.0 (2026.4.30 → HEAD, 691 commits)
  • Telegram gateway mode
  • Linux, Python 3.11

Fix (tested, working)

Three-file patch adding ~100 lines total:

  1. gateway/run.py_clarify_callback closure (bridge agent thread → event loop) + agent.clarify_callback = _clarify_callback
  2. gateway/platforms/telegram.py_clarify_state dict + send_clarify_prompt() method
  3. gateway/platforms/telegram.pyclarify: button handler in _handle_callback_query

Full patch preserved in skill hermes-clarify-patch.

The clarify-telegram-buttons.md reference doc describes the exact architecture needed — the code just needs to be wired in.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [BUG] Clarify tool returns 'not available in this execution context' in gateway/Telegram mode