fix: ClawHub plugin installs do not count as installs (#113133)

This commit is contained in:
Patrick Erichsen
2026-07-23 12:30:15 -07:00
committed by GitHub
parent 197741ac4e
commit e567a5ffa0
6 changed files with 441 additions and 1 deletions
+31
View File
@@ -31,6 +31,7 @@ import {
readConfigFileSnapshotForWrite,
parseClawHubPluginSpec,
promptYesNo,
reportClawHubPluginInstallTelemetry,
recordHookInstall,
recordPluginInstall,
resetPluginsCliTestState,
@@ -1661,9 +1662,39 @@ describe("plugins cli install", () => {
expect(readConfigFileSnapshotForWrite).toHaveBeenCalledTimes(2);
expect(writeConfigFile).toHaveBeenCalledWith(enabledCfg);
expect(runtimeLogsContain("Installed plugin: demo")).toBe(true);
expect(reportClawHubPluginInstallTelemetry).toHaveBeenCalledWith({
baseUrl: "https://clawhub.ai",
packageName: "demo",
version: "1.2.3",
});
expect(installPluginFromNpmSpec).not.toHaveBeenCalled();
});
it("does not report a ClawHub install when durable persistence fails", async () => {
loadConfig.mockReturnValue(createEmptyPluginConfig());
parseClawHubPluginSpec.mockReturnValue({ name: "demo" });
installPluginFromClawHub.mockResolvedValue(
createClawHubInstallResult({
pluginId: "demo",
packageName: "demo",
version: "1.2.3",
channel: "official",
}),
);
enablePluginInConfig.mockReturnValue({ config: createEnabledPluginConfig("demo") });
applyExclusiveSlotSelection.mockReturnValue({
config: createEnabledPluginConfig("demo"),
warnings: [],
});
writeConfigFile.mockRejectedValueOnce(new Error("persistence failed"));
await expect(runPluginsCommand(["plugins", "install", "clawhub:demo"])).rejects.toThrow(
"persistence failed",
);
expect(reportClawHubPluginInstallTelemetry).not.toHaveBeenCalled();
});
it("passes ClawHub risk acknowledgement to explicit ClawHub installs", async () => {
loadConfig.mockReturnValue(createEmptyPluginConfig());
parseClawHubPluginSpec.mockReturnValue({ name: "demo" });