What's wrong
Keybinding/KeybindingManager.cs L197-L205:
Profile activeProfile = Profiles.GetActiveProfile() ?? throw new InvalidOperationException("No active profile is set");
return OperationHelper.ExecuteWithCount(chords, Keybindings.BindChord);
activeProfile is fetched only to check that an active profile exists, and is never used afterwards. Each entry goes through the two-argument IKeybindingService.BindChord(commandId, chord), which looks up the active profile again for every entry.
Failure scenario
- Profile
a is active, and thread 1 calls SetChords with N entries.
- Partway through, thread 2 calls
SetActiveProfile("b").
- The remaining entries are bound into
b.
SetChords reports N bindings set. They are split across two profiles, and neither profile has the batch the caller asked for.
CLAUDE.md promises thread-safe services, and recent fixes (#142 and the lookup-overload guards) close this kind of gap elsewhere.
Suggested fix
Bind against the profile the method already resolved, using the existing three-argument overload (IKeybindingService.BindChord(string profileId, string commandId, Chord chord)):
return OperationHelper.ExecuteWithCount(chords, (commandId, chord) => Keybindings.BindChord(activeProfile.Id, commandId, chord));
Check other KeybindingManager batch helpers for the same pattern.
What's wrong
Keybinding/KeybindingManager.csL197-L205:activeProfileis fetched only to check that an active profile exists, and is never used afterwards. Each entry goes through the two-argumentIKeybindingService.BindChord(commandId, chord), which looks up the active profile again for every entry.Failure scenario
ais active, and thread 1 callsSetChordswith N entries.SetActiveProfile("b").b.SetChordsreports N bindings set. They are split across two profiles, and neither profile has the batch the caller asked for.CLAUDE.md promises thread-safe services, and recent fixes (#142 and the lookup-overload guards) close this kind of gap elsewhere.
Suggested fix
Bind against the profile the method already resolved, using the existing three-argument overload (
IKeybindingService.BindChord(string profileId, string commandId, Chord chord)):Check other
KeybindingManagerbatch helpers for the same pattern.