Skip to content

fix: make chanSend non-blocking to prevent panic on closed channel#2286

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/fix-docker-agent-issue-2266-38c40343
Mar 31, 2026
Merged

fix: make chanSend non-blocking to prevent panic on closed channel#2286
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/fix-docker-agent-issue-2266-38c40343

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Mar 31, 2026

The RAG file watcher runs for the lifetime of the agent but holds a closure over the per-message events channel. When finalizeEventChannel closes that channel between messages, the watcher panics with send on closed channel.

Make chanSend non-blocking with select/default and recover from panics on closed channels, so late-arriving RAG events are safely dropped.

Fixes #2266

The RAG file watcher runs for the lifetime of the agent but holds a
closure over the per-message events channel. When finalizeEventChannel
closes that channel between messages, the watcher panics with
"send on closed channel".

Make chanSend non-blocking with select/default and recover from panics
on closed channels, so late-arriving RAG events are safely dropped.

Fixes docker#2266

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner March 31, 2026 08:34
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not related to this PR @dgageot you did #2292 for it

@dgageot dgageot merged commit 32feddb into docker:main Mar 31, 2026
12 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.

RAG file watcher causes panic "send on closed channel" when re-indexing spans a message boundary

2 participants