fix(config): render warning newlines · openclaw/openclaw@2c45879
steipete
·
2026-04-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,6 +21,7 @@ Docs: https://docs.openclaw.ai
|
21 | 21 | |
22 | 22 | - Pi embedded runs: pass real built-in tools into Pi session creation and then narrow active tool names after custom tool registration, so the runner and compaction paths compile cleanly and keep OpenClaw-managed custom tool allowlists without feeding string arrays into `createAgentSession`. Thanks @vincentkoc. |
23 | 23 | - Agents/OpenAI websocket: route native OpenAI websocket metadata and session-header decisions through the shared endpoint classifier so local mocks and custom `models.providers.openai.baseUrl` endpoints stay out of the native OpenAI path consistently across embedded-runner and websocket transport code. Thanks @vincentkoc. |
| 24 | +- Config: render validation warnings with real line breaks instead of a literal `\n` sequence in CLI/audit output. Fixes #70140. |
24 | 25 | - Cron/doctor: repair malformed persisted cron job IDs through `openclaw doctor`, including legacy `jobId`, non-string `id`, and missing `id` rows, so `cron list` no longer needs display-layer coercion for corrupt store data. Fixes #70128. |
25 | 26 | - Discord: normalize prefixed channel targets only at the thread-binding API boundary, so `sessions_spawn({ runtime: "acp", thread: true })` can create child threads from Discord channels without breaking current-channel ACP bindings. (#68034) Thanks @Zetarcos. |
26 | 27 | - Discord: harden inbound thread metadata handling against partial Carbon channel getters, so non-command thread messages and queued jobs no longer crash when `name`, `parentId`, `parent`, or `ownerId` requires fetched raw data. |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import fs from "node:fs/promises"; |
2 | 2 | import os from "node:os"; |
3 | 3 | import path from "node:path"; |
4 | | -import { describe, expect, it } from "vitest"; |
| 4 | +import { describe, expect, it, vi } from "vitest"; |
5 | 5 | import { applyRuntimeLegacyConfigMigrations } from "../commands/doctor/shared/runtime-compat-api.js"; |
6 | 6 | import { createConfigIO } from "./io.js"; |
7 | 7 | import { normalizeExecSafeBinProfilesInConfig } from "./normalize-exec-safe-bin.js"; |
@@ -70,6 +70,45 @@ describe("config io paths", () => {
|
70 | 70 | }); |
71 | 71 | }); |
72 | 72 | |
| 73 | +it("logs validation warnings with real line breaks", async () => { |
| 74 | +await withTempHome(async (home) => { |
| 75 | +const configPath = path.join(home, ".openclaw", "openclaw.json"); |
| 76 | +await fs.mkdir(path.dirname(configPath), { recursive: true }); |
| 77 | +await fs.writeFile( |
| 78 | +configPath, |
| 79 | +JSON.stringify( |
| 80 | +{ |
| 81 | +plugins: { |
| 82 | +entries: { |
| 83 | +"google-antigravity-auth": { |
| 84 | +enabled: false, |
| 85 | +config: { stale: true }, |
| 86 | +}, |
| 87 | +}, |
| 88 | +}, |
| 89 | +}, |
| 90 | +null, |
| 91 | +2, |
| 92 | +), |
| 93 | +); |
| 94 | +const logger = { |
| 95 | +error: vi.fn(), |
| 96 | +warn: vi.fn(), |
| 97 | +}; |
| 98 | + |
| 99 | +const io = createConfigIO({ |
| 100 | + configPath, |
| 101 | +env: {} as NodeJS.ProcessEnv, |
| 102 | +homedir: () => home, |
| 103 | + logger, |
| 104 | +}); |
| 105 | +io.loadConfig(); |
| 106 | + |
| 107 | +expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/^Config warnings:\n- /)); |
| 108 | +expect(logger.warn).not.toHaveBeenCalledWith(expect.stringContaining("Config warnings:\\n")); |
| 109 | +}); |
| 110 | +}); |
| 111 | + |
73 | 112 | it("normalizes safe-bin config entries at config load time", async () => { |
74 | 113 | const cfg = { |
75 | 114 | tools: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1198,7 +1198,7 @@ export function createConfigIO(overrides: ConfigIoDeps = {}) {
|
1198 | 1198 | `- ${sanitizeTerminalText(iss.path || "<root>")}: ${sanitizeTerminalText(iss.message)}`, |
1199 | 1199 | ) |
1200 | 1200 | .join("\n"); |
1201 | | -deps.logger.warn(`Config warnings:\\n${details}`); |
| 1201 | +deps.logger.warn(`Config warnings:\n${details}`); |
1202 | 1202 | } |
1203 | 1203 | warnIfConfigFromFuture(validated.config, deps.logger); |
1204 | 1204 | const cfg = materializeRuntimeConfig(validated.config, "load"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。