Skip to content

[Bug]: Tool execution fails silently with Copilot ACP --context long_context (Claude outputs <tool_use>) #45139

Open

Description

@ar27111994

Bug Description

When Hermes is configured to use GitHub Copilot ACP with the long-context flag (via .env: HERMES_COPILOT_ACP_ARGS=--acp --stdio --context long_context), the agent frequently fails to execute tool calls. The model outputs tool-like XML in a form Hermes doesn't parse (e.g. Claude's native <tool_use> tags), the terminal hides those tags, and Hermes never executes the tool. The model then continues with confident reasoning as if the tool had run, producing hallucinated results.

Steps to Reproduce

  1. In C:\\Users\\ar271\\AppData\\Local\\hermes\\.env set: HERMES_COPILOT_ACP_ARGS=--acp --stdio --context long_context
  2. Start Hermes: hermes
  3. Ask the agent to perform an action that triggers a tool (for example: install a repo, read a README, or run a terminal tool)
  4. Observe the agent output: it enters a long reasoning block, shows text fragments with missing spaces where an XML tool tag was present, and never executes the requested tool. No tool calls or tool outputs are produced.
  5. Reverting .env to remove --context long_context returns normal tool-calling behavior.

Expected Behavior

The agent should detect and execute tool calls emitted by the model (regardless of whether they use Hermes' <tool_call> XML or Claude's native <tool_use> format). When using the Copilot ACP long_context tier, Hermes should either:
(A) instruct the CLI/model to output Hermes-compatible tool calls,
(B) parse and accept native <tool_use> tags,
or
(C) disable the Copilot "reasoning" wrapper for sessions that require tool execution.

Actual Behavior

Agent never executes the tool. The terminal output contains squished sentences (where the hidden tag was rendered), e.g. "Let me check both simultaneously. Let me read the README...". The agent proceeds as if the tool executed (hallucinated results), but no tool call was fired. Example transcript and UI capture included in debug report.

Affected Component

Tools (terminal, file ops, web, code execution, etc.), Agent Core (conversation loop, context compression, memory), Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Report       https://paste.rs/6Do1r
agent.log    https://paste.rs/HAbf0
gateway.log  https://paste.rs/elTP6
desktop.log   https://paste.rs/TzuhE

Operating System

Windows_NT x64 10.0.26200

Python Version

3.14.3

Hermes Version

Hermes Agent v0.16.0 (2026.6.5) · upstream d62979a
Project: C:\Users\ar271\AppData\Local\hermes\hermes-agent
Python: 3.11.15
OpenAI SDK: 2.24.0

Additional Logs / Traceback (optional)

I can provide additional logs if helpful; the debug report links above contain the full agent.log and gateway logs.

Root Cause Analysis (optional)

When Copilot ACP is invoked with --context long_context, the CLI routes the session to the 1m model tier. Those model variants appear to prefer or emit their native tool tags (<tool_use>) and/or emit tool calls inside a "reasoning" block. Hermes currently only scans for its injected <tool_call> format and does not parse <tool_use>, nor does it extract tool calls from reasoning traces. As a result, the model's tool output is never executed, and the model hallucinates results.

Proposed Fix (optional)

Short-term: Update the copilot_acp_client's parser to recognize Claude's native **<tool_use>** tags (and/or extract tool calls from the reasoning block) so tool execution still happens when using long_context.
Long-term: Update the ACP integration to either (A) request the model use Hermes' expected tool format explicitly in the system prompt for long_context sessions, (B) switch to structured JSON tool calling when available, or (C) add a copilot flag that disables the "reasoning" wrapper for tool-heavy sessions.
Workarounds: remove --context long_context from HERMES_COPILOT_ACP_ARGS or set --effort low to disable the thinking wrapper.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. added
    type/bugSomething isn't working
    comp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint
    comp/acpAgent Communication Protocol adapter
    P2Medium — degraded but workaround exists
    on Jun 12, 2026
  2. GottZ commented on Aug 3, 2026

    @GottZ

    This was generated by AI during triage.

    Summary

    Eight PRs were triaged, but only #45231 and the bundled copy in #45350 modify the Copilot ACP parser for the failure reported in #45139; both add <tool_use> extraction, while the other six diffs address cron, slash-command, dashboard-status, or session-continuity behavior rather than the ACP tool-call cause. #45231 is the best existing fix, but its parser is only partial because it emits the wrong call-object type and permits non-JSON arguments that the execution path rejects.

    Related pull requests

    Duplicates

    For #45139, #45350 contains substantially the same ACP <tool_use> parser and tests as #45231; treat that portion as a duplicate of #45231. The remaining PRs are not duplicates of the ACP fix, although #32059, #45350, #45451, and #77404 form a separate cron-profile cluster.

    Suggested consolidation

    Keep #45231 open with a salvage path as the best existing fix: split it down to the Copilot ACP parser and focused tests, port extracted calls through _build_openai_tool_call(), require normalized JSON-object arguments, and add a fixture from the reported long-context output plus an end-to-end assertion that the call reaches execution. This follows the visible keep_open verdict rather than proposing a merge. Treat the already-closed #45350 ACP hunk as a duplicate of #45231, and exclude #32059, #44918, #45451, #60330, #63381, and #77404 from the #45139 fix set because their diffs do not address ACP <tool_use> extraction.

    Complex graph

    flowchart TD
        classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
        classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
        classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
        classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
        classDef best stroke-width:3px,stroke:#b45309
        classDef target stroke-width:3px,stroke:#4338ca
        I32045(["issue #32045 (open)"])
        I32046(["issue #32046 (open)"])
        I45139(["issue #45139 (open)"])
        I45335(["issue #45335 (open)"])
        P77404["PR #77404 (open)"]
        subgraph Dup32059 ["PRs duplicating each other"]
            P32059["PR #32059 (closed)"]
            P45451["PR #45451 (open)"]
        end
        subgraph Dup44918 ["PRs duplicating each other"]
            P44918["PR #44918 (open)"]
            P45231["PR #45231 (open)"]
            P45350["PR #45350 (closed)"]
        end
        P45231 -->|best fix| I45139
        P45350 -.->|partial| I45139
        P77404 -.->|unverified| I45139
        P32059 -->|best fix| I32045
        P45451 -->|best fix| I32045
        P77404 -->|fixes| I32045
        P32059 -->|best fix| I32046
        P45451 -.->|partial| I32046
        P32059 -->|best fix| I45335
        P45451 -->|best fix| I45335
        P77404 -->|fixes| I45335
        class I32045 open
        class I32046 open
        class I45139 open
        class I45335 open
        class I45139 target
        class P32059 closed
        class P44918 open
        class P45231 open
        class P45350 closed
        class P45451 open
        class P77404 open
        class P32059 best
        class P32059 best
        class P32059 best
        class P45231 best
        class P45451 best
        class P45451 best
        click I32045 "https://github.com/NousResearch/hermes-agent/issues/32045"
        click I32046 "https://github.com/NousResearch/hermes-agent/issues/32046"
        click I45139 "https://github.com/NousResearch/hermes-agent/issues/45139"
        click I45335 "https://github.com/NousResearch/hermes-agent/issues/45335"
        click P32059 "https://github.com/NousResearch/hermes-agent/pull/32059"
        click P44918 "https://github.com/NousResearch/hermes-agent/pull/44918"
        click P45231 "https://github.com/NousResearch/hermes-agent/pull/45231"
        click P45350 "https://github.com/NousResearch/hermes-agent/pull/45350"
        click P45451 "https://github.com/NousResearch/hermes-agent/pull/45451"
        click P77404 "https://github.com/NousResearch/hermes-agent/pull/77404"
    
    Loading

    Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

    Cross-PR triage: Reviewed 8 pull requests and 4 issues in this complex. Each diff was read against this issue; Assessment working set: 189 kB of PR diffs, 37 kB of issue/PR text, 22 kB of discussion (28 comments), 16 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/acpAgent Communication Protocol adaptercomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointtype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions