Skip to content

fix: remove host_id from cloud tool parameters#4589

Closed
amir20 wants to merge 1 commit intomasterfrom
remove-host-id-from-cloud-tools
Closed

fix: remove host_id from cloud tool parameters#4589
amir20 wants to merge 1 commit intomasterfrom
remove-host-id-from-cloud-tools

Conversation

@amir20
Copy link
Copy Markdown
Owner

@amir20 amir20 commented Apr 5, 2026

Summary

  • Removed host_id parameter from all cloud tool schemas (fetch_container_logs, inspect_container, start/stop/restart/update_container)
  • Added findContainerByID helper that resolves the host automatically by searching across all hosts via ListAllContainers
  • Fixes LLM hallucinating Swarm-style host IDs that don't exist, causing tool calls to fail

Test plan

  • go test ./internal/cloud/ passes
  • Deploy and verify cloud tool calls work without host_id

🤖 Generated with Claude Code

…nation

The LLM was fabricating Swarm-style host IDs instead of using actual host IDs,
causing tool calls to fail. Since container IDs are unique across hosts, we now
resolve the host automatically via ListAllContainers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Apr 5, 2026

Performance concern: findContainerByID in tools_helpers.go:67 calls ListAllContainers (fetches all containers across all hosts) + FindContainer for every single tool invocation. That's two API calls where before there was one, with the first being a full list scan.

Since ListAllContainers already returns the container with Host set, and we only need FindContainer to get a ContainerService—consider if ContainerService can be constructed directly from the matched container + host client to avoid the second round-trip.

Unused mock: mockHost.On("Hosts", ...) in both test updates is never triggered by findContainerByID (which only calls ListAllContainers + FindContainer). Dead setup—can be removed.

Positive: The fix is correct and clean. LLM hallucinating Swarm-style host IDs is a real failure mode, and auto-resolving by container ID is the right UX.

@amir20 amir20 closed this Apr 5, 2026
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.

1 participant