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>
This commit is contained in:
吴杨帆
2026-05-17 06:10:09 +08:00
committed by GitHub
parent 93bc99460e
commit 9791957cd5
3 changed files with 30 additions and 1 deletions

View File

@@ -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.

View File

@@ -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();
},
);
});

View File

@@ -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 {