Skip to content

fix(runtime): guard onToolsChanged like onBackgroundEvent #3594

Description

@aheritier

Summary

pkg/runtime/runtime.go:307 onToolsChanged is written at :1431 and read at :1449/:1459 from MCP change-notification goroutines with no lock. The sibling onBackgroundEvent IS mutex-guarded (backgroundEventMu) with a comment explaining exactly this hazard.

Fix

Guard onToolsChanged identically (or make both atomic.Pointer).

Acceptance

  • -race clean; consistent with the onBackgroundEvent precedent.

Metadata

Metadata

Assignees

Labels

area/mcpMCP protocol, MCP tool servers, integrationarea/runtimeRuntime engine, agent loop execution, tool dispatch, loop detectionkind/fixPR fixes a bug (maps to fix:). Use on PRs only.

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions