Skip to content

Commit bf63001

Browse files
committed
Serialize extension active-tool updates with harness mutex
1 parent 2ecc4bb commit bf63001

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

packages/cli/src/extensions/compat/tool-registry.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,14 @@ export class HarnessToolRegistry {
114114
}
115115

116116
async applyActiveTools(names: string[]): Promise<void> {
117-
const active = new Set(names);
118-
for (const tool of [...this.extensionTools, ...this.runtimeTools.values()]) {
119-
if (active.has(tool.name)) this.inactiveExtensionTools.delete(tool.name);
120-
else this.inactiveExtensionTools.add(tool.name);
121-
}
122-
await this.harness.setActiveTools(names);
117+
await this.mutateHarnessTools(async () => {
118+
const active = new Set(names);
119+
for (const tool of [...this.extensionTools, ...this.runtimeTools.values()]) {
120+
if (active.has(tool.name)) this.inactiveExtensionTools.delete(tool.name);
121+
else this.inactiveExtensionTools.add(tool.name);
122+
}
123+
await this.harness.setActiveTools(names);
124+
});
123125
}
124126

125127
private snapshot(): RegistrySnapshot {

0 commit comments

Comments
 (0)