fix: use log.debug for startup banners to prevent --json stdout conta…#166
fix: use log.debug for startup banners to prevent --json stdout conta…#166rjdjohnston wants to merge 8 commits intoMartian-Engineering:mainfrom
Conversation
…mination Startup banner log calls (ignoreSessionPatterns, statelessSessionPatterns) used log.info() which writes to stdout. When OpenClaw CLI commands like `openclaw agents list --json` are run, these messages appear after the JSON output, breaking downstream JSON.parse() consumers (e.g. ClawKitchen agents page). Switch to log.debug() so these informational banners are suppressed in normal operation and only visible with debug logging enabled.
…mination Startup banner log calls (plugin-loaded, compaction-model) used logger.info() which writes to stdout. When OpenClaw CLI commands like `openclaw agents list --json` are run, these messages appear after the JSON output, breaking downstream JSON.parse() consumers (e.g. ClawKitchen agents page). Switch to logger.debug() so these informational banners are suppressed in normal operation and only visible with debug logging enabled.
jalehman
left a comment
There was a problem hiding this comment.
The implementation change is directionally correct: moving the startup banners from info to debug fixes the --json stdout contamination bug.
Requesting changes for two reasons:
- CI is red because
test/plugin-config-registration.test.tsstill expects those startup banners oninfoLog, but the PR now routes them throughdebug. The failing assertions are the same ones shown in Actions, and they reproduce locally. - This appears user-facing because it changes CLI
--jsonbehavior, but the PR does not include a.changeset/*.mdentry yet.
I verified the fix locally in a worktree and have a ready commit that updates the tests and adds a patch changeset, but I could not push it to the contributor fork because the PR has maintainer edits disabled.
- Update test to expect startup banners on debugLog instead of infoLog - Add debugLog mock to buildApi helper function - Add changeset documenting the fix for --json stdout contamination
|
I've updated the PR. please review. unable to locate allow maintainer edits checkbox. i can try and create a new pr with that enabled if you need it |
jalehman
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous review. I still need changes on two items before this is mergeable:
-
test/plugin-config-registration.test.tsstill leaves the dedupe case oninfoLog, so CI remains red. The direct startup-banner assertions were moved todebugLog, but the dedupe test still readsfirst.infoLog.mock.calls/second.infoLog.mock.calls, which now stay empty after the production code moved those banners todebug. -
This follow-up also bumps
vitestfrom^3.0.0to^3.2.4and regeneratespackage-lock.jsonwith a very large unrelated diff. That dependency churn is not needed for this bugfix, and this repo's instructions say not to change dependency versions unless explicitly requested.
Please update the remaining dedupe assertion to match the new debug-level behavior and drop the unrelated dependency/lockfile changes.
- Change dedupe test to read from debugLog instead of infoLog (startup banners were moved to debug in prior commit) - Use toContain assertions to check banners independently of other debug messages (e.g. migration logs) - Revert vitest from ^3.2.4 to ^3.0.0 per maintainer request
…tion fix: dedupe test uses debugLog, revert vitest to ^3.0.0
|
Fixes complete; reverted vitest, update lock to match repo. |
…mination
Startup banner log calls (ignoreSessionPatterns, statelessSessionPatterns) used log.info() which writes to stdout. When OpenClaw CLI commands like
openclaw agents list --jsonare run, these messages appear after the JSON output, breaking downstream JSON.parse() consumers (e.g. ClawKitchen agents page).Switch to log.debug() so these informational banners are suppressed in normal operation and only visible with debug logging enabled.