fix: resolve duplicate RAG tool names and nil pointer panic in file watcher#2322
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 6, 2026
Conversation
…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
krissetto
approved these changes
Apr 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 explicittool.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 thenamefield onragtype toolsets in validation.2. Nil pointer panic in file watcher
A race condition in
VectorStore.watchLoopwhereClose()setss.watcher = nilunder a mutex, but the goroutine accesseds.watcher.Eventswithout 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 namepkg/config/latest/validate.go— allownameon RAG toolsetspkg/rag/strategy/vector_store.go— fix watcher race condition