Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

TUI renders raw `<tool_use>` XML and tool results don't display after agent trust changes

Open junwenleong opened this issue 6 months ago • 6 comments

Before opening, please confirm:

Operating System

macOS 26.4.1

Kiro Version

2.2.0

Bug Description

Bug: TUI renders raw <tool_use> XML and tool results don't display after agent trust changes

Version: kiro-cli 2.2.0 OS: macOS 26.4.1 (Apple M4 Pro) Terminal: Ghostty 1.3.1 (also happened on default macOS terminal)

Actual behavior:

  • Tool calls render as raw <tool_use> XML tags in the chat output
  • Tool results don't display at all (no output shown after tool executes)
  • /tools panel shows "0 tools / No tools available" even though tools ARE working (agent successfully reads files, runs commands)
  • Status bar shows "Trust All Tools active, confirmations are off" despite setting chat.disableTrustAllConfirmation false

What I tried:

  • /tools reset — no effect
  • Wiped ~/Library/Application Support/kiro-cli/ and reinstalled — no effect
  • Deleted tui.js and tui.js.sha256 to force re-download — no effect
  • KIRO_NO_SYNCHRONIZED=1 — no effect
  • kiro-cli settings chat.ui classic — classic mode works perfectly, tools render correctly
  • Reverted agent JSON files in ~/.kiro/agents/ — no effect

The tools themselves function correctly — list_directory executes and returns data, it just doesn't render in the TUI.

Steps to Reproduce

  1. Open kiro-cli in TUI mode (default)
  2. Ask kiro to permanently trust all tools for all agents (e.g. "update the three agent configs to allow all tools")
  3. Kiro writes agent JSON files with allowedTools arrays
  4. Restart kiro-cli

Expected Behavior

Tool calls render with the visual UI components (spinner, ✓/✗ icons, collapsible output)

Conversation ID

No response

Additional Context

No response

junwenleong avatar May 05 '26 01:05 junwenleong

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both issues report tools not displaying properly in the TUI - the new issue shows '0 tools / No tools available' in the /tools panel despite tools working, while #6502 reports 'most of the tools is lost' after loading saved chat, with similar symptoms of tools functionality being affected in the interface

github-actions[bot] avatar May 05 '26 01:05 github-actions[bot]

Root cause found: When kiro-cli was asked to "trust all tools for an agent permanently", it created custom agent JSON files in ~/.kiro/agents/ that overrode the built-in agents (kiro_default, kiro_guide, kiro_planner). These files used allowedTools with @builtin etc. but were missing "includeMcpJson": true, which broke the TUI tool registry causing /tools to show 0 tools and tool calls to render as raw XML. Deleting the custom agent files restored built-in agent behavior and fixed the TUI.

Suggested fix: Either prevent overriding built-in agent names, or warn the user when a custom agent file shadows a built-in.

junwenleong avatar May 05 '26 02:05 junwenleong

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar May 05 '26 02:05 github-actions[bot]

I think my issue is similar but not exactly the same:

https://github.com/kirodotdev/Kiro/issues/9180

SamCritch avatar Jun 05 '26 09:06 SamCritch

Is there any chance this will be fixed soon?

eventh0riz0n avatar Jul 01 '26 17:07 eventh0riz0n

Following up — this still happens on kiro-cli 2.12.3 (macOS), a fair few versions past the 2.2.0/2.3.0 reports here and in #8654, so it doesn't look fixed yet.

I'm running my own custom agent (a ~/.kiro/agents/*.json with hooks and an allowedTools list), resumed the session with --resume, on claude-opus-4.8. Deep into a long session, one turn just printed the tool call as text instead of running it:

<invoke name="shell">
<parameter name="command">…</parameter>
</invoke>

No spinner-hang, no Esc — the turn just ended and the command never ran. So it's the "nothing executes" flavour from #8654, not the "shows as XML but still runs" one in the original report here.

I dug into the session transcript to confirm: that turn got saved as a plain text block with the raw markup in it — no tool-use block, no tool result after it. The kicker is the exact same shell command earlier in the same session saved correctly as a proper tool-use call. So it's intermittent, and when it misfires the call lands in the text channel instead of the tool channel.

Couple of things that might help narrow it down:

  • The leaked markup is the <invoke …><parameter …> function-call XML style, which isn't kiro-cli's native tool format — looks like it fell back to a format the parser doesn't recognise.
  • It only bit once, deep in a long --resumed session under a custom agent. That custom-agent + --resume combo feels like the trigger (fits the workspace-agent angle in #8654 / #5873).

Happy to share the session ID and the exact transcript lines if that'd help.

rickmi avatar Jul 16 '26 16:07 rickmi