From 9791957cd556b79448b2a8f425e00bbb76d4e0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=9D=A8=E5=B8=86?= <39647285+leno23@users.noreply.github.com> Date: Sun, 17 May 2026 06:10:09 +0800 Subject: [PATCH] fix(qqbot): treat false-like QQBOT_DEBUG values as disabled (#82697) Fix QQBot debug logging so only explicit truthy `QQBOT_DEBUG` values (`1`, `true`, `yes`, `on`) enable debug output. False-like values such as `0`, `false`, `off`, and `no` now keep debug logs disabled, preventing accidental message-text logging. Also add the release changelog entry and remove a stale unused daemon inspection helper that failed current `tsgo:prod` after rebasing onto latest main. Fixes #82644. Thanks @leno23. Co-authored-by: wuyangfan <1102042793@qq.com> --- CHANGELOG.md | 1 + extensions/qqbot/src/engine/utils/log.test.ts | 12 ++++++++++++ extensions/qqbot/src/engine/utils/log.ts | 18 +++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c9e671bdd..e7db9b7c5e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Docs: https://docs.openclaw.ai ### Fixes - Agents/edit tool: honor `file_path` and related path aliases when resolving edit-recovery targets, so post-write errors no longer surface false edit failures after the file actually changed. Fixes #81909. Thanks @giodl73-repo. +- QQBot: treat only explicit truthy `QQBOT_DEBUG` values as enabling debug logs, so false-like values such as `0` no longer expose debug output. Fixes #82644. (#82697) Thanks @leno23. - Gateway/diagnostics: add opt-in critical memory pressure stability snapshots with gateway logs, V8 heap, cgroup, active-resource, and redacted large session-file evidence. Fixes #82518. - Doctor/Gateway: avoid treating unrelated macOS LaunchAgents as legacy gateways just because their environment values mention old checkout paths. - CLI/setup: collapse raw gateway config keys in existing-config summaries into friendly `Model` and `Gateway` rows. diff --git a/extensions/qqbot/src/engine/utils/log.test.ts b/extensions/qqbot/src/engine/utils/log.test.ts index b12f076eea5..09444fb8cc1 100644 --- a/extensions/qqbot/src/engine/utils/log.test.ts +++ b/extensions/qqbot/src/engine/utils/log.test.ts @@ -25,4 +25,16 @@ describe("QQBot debug logging", () => { expect(logSpy).toHaveBeenCalledWith("prefix line one line two"); }); + + it.each(["0", "false", "off", "no"])( + "does not enable debug logging for QQBOT_DEBUG=%s", + (value) => { + process.env.QQBOT_DEBUG = value; + const logSpy = vi.spyOn(console, "log").mockImplementation(() => {}); + + debugLog("private message text"); + + expect(logSpy).not.toHaveBeenCalled(); + }, + ); }); diff --git a/extensions/qqbot/src/engine/utils/log.ts b/extensions/qqbot/src/engine/utils/log.ts index 7bb284df88a..711b2d7ea8b 100644 --- a/extensions/qqbot/src/engine/utils/log.ts +++ b/extensions/qqbot/src/engine/utils/log.ts @@ -8,7 +8,23 @@ * Self-contained within engine/ — no framework SDK dependency. */ -const isDebug = () => !!process.env.QQBOT_DEBUG; +function isQqbotDebugEnabled(): boolean { + const value = process.env.QQBOT_DEBUG; + if (typeof value !== "string") { + return false; + } + switch (value.trim().toLowerCase()) { + case "1": + case "on": + case "true": + case "yes": + return true; + default: + return false; + } +} + +const isDebug = () => isQqbotDebugEnabled(); const MAX_LOG_VALUE_CHARS = 4096; export function sanitizeDebugLogValue(value: unknown): string {