Skip to content

fix: show correct tool count in TUI when running in --remote mode#1648

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:remote-tools-count
Feb 11, 2026
Merged

fix: show correct tool count in TUI when running in --remote mode#1648
dgageot merged 1 commit intodocker:mainfrom
dgageot:remote-tools-count

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Feb 9, 2026

The remote TUI sidebar displayed an incorrect tool count because of two issues:

  1. The HTTP SSE client was missing event type registrations for toolset_info, agent_info, team_info, agent_switching, and several other event types added after the initial implementation. These events were silently dropped, so the TUI never received the real tool count streamed by the server during RunStream.

  2. RemoteRuntime.EmitStartupInfo used len(cfg.Toolsets) — the number of toolset configurations (e.g. mcp, shell, filesystem) — instead of the actual number of individual tools. There was no server-side API to query the real count at startup.

This commit:

  • Adds missing event types to the HTTP SSE client registry
  • Adds a GetAgentToolCount RPC (proto + ConnectRPC + HTTP) that loads the agent's team and counts its tools server-side
  • Updates RemoteRuntime.EmitStartupInfo to call GetAgentToolCount, showing a loading indicator while the count is fetched
  • Fixes the sidebar to skip empty tool status lines

Assisted-By: cagent

@dgageot dgageot requested a review from a team as a code owner February 9, 2026 10:04
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Found 2 issues in the changed code that should be addressed:

  1. Error handling in GetAgentToolCount: When the tool count fetch fails, the code emits a misleading zero-count response
  2. URL path construction: The GetAgentToolCount function doesn't properly handle special characters in path parameters

Both issues are in newly added code and could cause unexpected behavior in production.

The remote TUI sidebar displayed an incorrect tool count because of two
issues:

1. The HTTP SSE client was missing event type registrations for
   toolset_info, agent_info, team_info, agent_switching, and several
   other event types added after the initial implementation. These
   events were silently dropped, so the TUI never received the real
   tool count streamed by the server during RunStream.

2. RemoteRuntime.EmitStartupInfo used len(cfg.Toolsets) — the number
   of toolset configurations (e.g. mcp, shell, filesystem) — instead
   of the actual number of individual tools. There was no server-side
   API to query the real count at startup.

This commit:
- Adds missing event types to the HTTP SSE client registry
- Adds a GetAgentToolCount RPC (proto + ConnectRPC + HTTP) that loads
  the agent's team and counts its tools server-side
- Updates RemoteRuntime.EmitStartupInfo to call GetAgentToolCount,
  showing a loading indicator while the count is fetched
- Fixes the sidebar to skip empty tool status lines

Assisted-By: cagent
@dgageot dgageot force-pushed the remote-tools-count branch from 409f31e to d3d2bbc Compare February 9, 2026 11:14
@dgageot dgageot requested a review from rumpl February 10, 2026 14:33
@dgageot dgageot merged commit 30afaf5 into docker:main Feb 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants