Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Plugin registration no longer spams "Registered …" info lines on
every call to `register()`. OpenClaw invokes `register(api)` once
per distinct `loadOpenClawPlugins` cache key (gateway startup,
provider discovery, metadata registry, web-fetch/web-search runtimes,
etc.), which produced ~44 redundant log lines per KiloClaw boot. A
module-scoped `registrationLogged` flag now gates the three info
lines so they fire at most once per process.
- `getPublicIp()` now clears its 5-second abort timer on error paths as
well as success, so repeated checkups on a flaky network don't leak
dangling timeouts.
Expand Down
25 changes: 22 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ import pkg from "./package.json" with { type: "json" };
const PLUGIN_VERSION: string = pkg.version;
const DEFAULT_API_BASE = "https://api.kilo.ai";

// OpenClaw invokes a plugin's `register(api)` once per distinct
// `loadOpenClawPlugins` cacheKey (gateway startup, provider discovery,
// metadata registry, web-fetch/web-search runtimes, etc.), so in a
// single process `register` typically runs ~15 times. Without this
// guard the three "Registered …" info lines below fire every time,
// which produced the 44-line log spam observed in KiloClaw boots.
// Module scope survives across all register() calls in the same
// process, so we log once and stay quiet after that.
//
// Scope note: this guard covers logging only. Re-invoking
// `api.registerTool(...)` and `api.registerCommand(...)` on every
// register() call is intentional — each `loadOpenClawPlugins` pass
// builds its own registry, and the plugin must register into every
// one to be visible in that context.
let registrationLogged = false;

type ToolResult = {
content: Array<{ type: "text"; text: string }>;
};
Expand Down Expand Up @@ -470,8 +486,11 @@ export default definePluginEntry({
handler: runSlashCommand,
});

api.logger.info?.("Registered tool: kilocode_shell_security");
api.logger.info?.("Registered command: /shell-security");
api.logger.info?.("Registered command: /security-checkup (legacy alias)");
if (!registrationLogged) {
api.logger.info?.("Registered tool: kilocode_shell_security");
api.logger.info?.("Registered command: /shell-security");
api.logger.info?.("Registered command: /security-checkup (legacy alias)");
registrationLogged = true;
}
},
});
Loading