fix(qqbot): treat false-like QQBOT_DEBUG values as disabled (#82697) · openclaw/openclaw@9791957
leno23
·
2026-05-17
·
via Recent Commits to openclaw:main
File tree
extensions/qqbot/src/engine/utils
| Original file line number | Diff line number | Diff line change |
|---|
@@ -25,6 +25,7 @@ Docs: https://docs.openclaw.ai
|
25 | 25 | ### Fixes |
26 | 26 | |
27 | 27 | - 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. |
| 28 | +- 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. |
28 | 29 | - 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. |
29 | 30 | - Doctor/Gateway: avoid treating unrelated macOS LaunchAgents as legacy gateways just because their environment values mention old checkout paths. |
30 | 31 | - CLI/setup: collapse raw gateway config keys in existing-config summaries into friendly `Model` and `Gateway` rows. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -25,4 +25,16 @@ describe("QQBot debug logging", () => {
|
25 | 25 | |
26 | 26 | expect(logSpy).toHaveBeenCalledWith("prefix line one line two"); |
27 | 27 | }); |
| 28 | + |
| 29 | +it.each(["0", "false", "off", "no"])( |
| 30 | +"does not enable debug logging for QQBOT_DEBUG=%s", |
| 31 | +(value) => { |
| 32 | +process.env.QQBOT_DEBUG = value; |
| 33 | +const logSpy = vi.spyOn(console, "log").mockImplementation(() => {}); |
| 34 | + |
| 35 | +debugLog("private message text"); |
| 36 | + |
| 37 | +expect(logSpy).not.toHaveBeenCalled(); |
| 38 | +}, |
| 39 | +); |
28 | 40 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,23 @@
|
8 | 8 | * Self-contained within engine/ — no framework SDK dependency. |
9 | 9 | */ |
10 | 10 | |
11 | | -const isDebug = () => !!process.env.QQBOT_DEBUG; |
| 11 | +function isQqbotDebugEnabled(): boolean { |
| 12 | +const value = process.env.QQBOT_DEBUG; |
| 13 | +if (typeof value !== "string") { |
| 14 | +return false; |
| 15 | +} |
| 16 | +switch (value.trim().toLowerCase()) { |
| 17 | +case "1": |
| 18 | +case "on": |
| 19 | +case "true": |
| 20 | +case "yes": |
| 21 | +return true; |
| 22 | +default: |
| 23 | +return false; |
| 24 | +} |
| 25 | +} |
| 26 | + |
| 27 | +const isDebug = () => isQqbotDebugEnabled(); |
12 | 28 | const MAX_LOG_VALUE_CHARS = 4096; |
13 | 29 | |
14 | 30 | export function sanitizeDebugLogValue(value: unknown): string { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。