Skip to content

feat: add RetryMaxAttemptsExplicit flag and thread-safe event coalescing#134

Merged
shayne-snap merged 2 commits into
mainfrom
repro/medium-bugs-8-16
May 25, 2026
Merged

feat: add RetryMaxAttemptsExplicit flag and thread-safe event coalescing#134
shayne-snap merged 2 commits into
mainfrom
repro/medium-bugs-8-16

Conversation

@shayne-snap
Copy link
Copy Markdown
Contributor

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).

  • — new field on
  • — propagate field in
  • — set when explicitly zero
  • Tests for both config loading and provider policy

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.

  • — mutex, drainLocked helper, split flushBestEffort into drain+flush
  • — concurrent add race 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.

- 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.
@shayne-snap shayne-snap merged commit 417e5bc into main May 25, 2026
2 checks passed
@shayne-snap shayne-snap deleted the repro/medium-bugs-8-16 branch May 25, 2026 10:13
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.

1 participant