feat: add RetryMaxAttemptsExplicit flag and thread-safe event coalescing#134
Merged
Conversation
- Add RetryMaxAttemptsExplicit bool to Config so callers can distinguish 'user explicitly set retry max to zero' from 'not configured'. When explicitly zero, retries are disabled (single attempt). - Update overlayExplicitConfig to propagate the new flag. - Add tests for explicit-zero retry config and provider policy. - Make turnDeltaCoalescers race-safe with a sync.Mutex, refactor flush methods to hold the lock only while mutating shared state. - Add concurrent race-safety test for turnDeltaCoalescers.add.
Add toolMu sync.Mutex to App to prevent data races between SetPluginEnabled (which rewrites pluginManager, pluginTools, toolset, and hookRunner) and refreshMCPTools (which reads pluginTools in the MCP startup goroutine). The lock is held across the entire refreshMCPTools body so concurrent refreshes serialize and the last one always observes the latest pluginTools.
This was referenced May 25, 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
Two independent changes:
1. RetryMaxAttemptsExplicit flag
Adds a new field to so callers can distinguish "user explicitly set retry max to zero" from "not configured". When explicitly zero, retries are disabled (single attempt).
2. Thread-safe event coalescing
Adds a to and refactors flush helpers so the lock is only held during shared-state mutation, not during channel sends. Includes a concurrent race-safety test.
Review Notes
The config file parser at still rejects — this pre-existing validation means the "explicit zero" feature currently only works through the programmatic API, not through the YAML config file. This is flagged in the review as a follow-up item.