Skip to content

fix: resolve duplicate RAG tool names and nil pointer panic in file watcher#2322

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/docker-agent-v7-rag-config-issues-8072140b
Apr 6, 2026
Merged

fix: resolve duplicate RAG tool names and nil pointer panic in file watcher#2322
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/docker-agent-v7-rag-config-issues-8072140b

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Apr 4, 2026

Summary

Fixes three issues reported with v7 RAG configuration:

1. Duplicate tool names (HTTP 400)

When using multiple RAG refs (ref: rag1, ref: rag2) without explicit tool.name, all RAG tools defaulted to the name "rag", causing Anthropic API to reject the request with "Tool names must be unique".

Fix: Use the RAG definition's map key (e.g., rag1, rag2) as the default tool name when no explicit name is set. Also allow the name field on rag type toolsets in validation.

2. Nil pointer panic in file watcher

A race condition in VectorStore.watchLoop where Close() sets s.watcher = nil under a mutex, but the goroutine accessed s.watcher.Events without holding the mutex.

Fix: Capture the watcher reference at goroutine start under the mutex, use the local variable for channel reads, and add a nil guard in the Create event handler for addPathToWatcher.

Files changed

  • pkg/config/rags.go — pass ref name as default tool name
  • pkg/config/latest/validate.go — allow name on RAG toolsets
  • pkg/rag/strategy/vector_store.go — fix watcher race condition

…atcher

- Use RAG definition ref key as default tool name so multiple RAG refs
  get unique names instead of all defaulting to "rag"
- Allow 'name' field on RAG type toolsets in validation
- Fix race condition in VectorStore.watchLoop where Close() sets
  s.watcher to nil while the goroutine accesses it without the mutex

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner April 4, 2026 17:50
@dgageot dgageot merged commit ff31e93 into docker:main Apr 6, 2026
8 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