Skip to content

fix: use log.debug for startup banners to prevent --json stdout conta…#166

Closed
rjdjohnston wants to merge 8 commits intoMartian-Engineering:mainfrom
JIGGAI:main
Closed

fix: use log.debug for startup banners to prevent --json stdout conta…#166
rjdjohnston wants to merge 8 commits intoMartian-Engineering:mainfrom
JIGGAI:main

Conversation

@rjdjohnston
Copy link
Copy Markdown

…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 (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.
Copy link
Copy Markdown
Contributor

@jalehman jalehman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. CI is red because test/plugin-config-registration.test.ts still expects those startup banners on infoLog, but the PR now routes them through debug. The failing assertions are the same ones shown in Actions, and they reproduce locally.
  2. This appears user-facing because it changes CLI --json behavior, but the PR does not include a .changeset/*.md entry 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
@rjdjohnston
Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown
Contributor

@jalehman jalehman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the previous review. I still need changes on two items before this is mergeable:

  1. test/plugin-config-registration.test.ts still leaves the dedupe case on infoLog, so CI remains red. The direct startup-banner assertions were moved to debugLog, but the dedupe test still reads first.infoLog.mock.calls / second.infoLog.mock.calls, which now stay empty after the production code moved those banners to debug.

  2. This follow-up also bumps vitest from ^3.0.0 to ^3.2.4 and regenerates package-lock.json with 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.

rjdjohnston and others added 5 commits March 26, 2026 15:53
- 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
@rjdjohnston
Copy link
Copy Markdown
Author

Fixes complete; reverted vitest, update lock to match repo.

@JIGGAI JIGGAI closed this by deleting the head repository Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants