From 6d60bd7cd3f5c53fb3767d897a1e4aa673d5a1ff Mon Sep 17 00:00:00 2001 From: St0rmz1 Date: Wed, 22 Apr 2026 15:42:09 -0700 Subject: [PATCH 1/3] fix: guard per-process registration log spam --- index.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index d7017b5..f2aea52 100644 --- a/index.ts +++ b/index.ts @@ -19,6 +19,16 @@ 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. +let registrationLogged = false; + type ToolResult = { content: Array<{ type: "text"; text: string }>; }; @@ -470,8 +480,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; + } }, }); From 0353a669afeb19e25f0083d825a1baa9f3bcb47c Mon Sep 17 00:00:00 2001 From: St0rmz1 Date: Wed, 22 Apr 2026 16:00:31 -0700 Subject: [PATCH 2/3] docs: changelog entry for registration log spam fix --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5da2e6c..35499e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. From cfa8b064ff12a07c63ac2fd0136435f685b37cba Mon Sep 17 00:00:00 2001 From: St0rmz1 Date: Wed, 22 Apr 2026 16:35:03 -0700 Subject: [PATCH 3/3] docs: clarify log-guard scope and add changelog entry --- index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.ts b/index.ts index f2aea52..2f89e96 100644 --- a/index.ts +++ b/index.ts @@ -27,6 +27,12 @@ const DEFAULT_API_BASE = "https://api.kilo.ai"; // 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 = {