fix(cli): route all pino logs to stderr to prevent stdout pollution in stdio transport#485
fix(cli): route all pino logs to stderr to prevent stdout pollution in stdio transport#485sithu015 wants to merge 9 commits into
Conversation
…n stdio transport
There was a problem hiding this comment.
Code Review
This pull request refactors the logger setup in packages/utilities/src/logger.ts by extracting the stream configuration into a standalone stream constant. Feedback suggests configuring pino.destination to write synchronously (sync: true) to ensure that log messages are not lost if the CLI process exits unexpectedly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // uncomment to hide json objects for any level other than trace or debug | ||
| // hideObject: !["trace", "debug"].includes(LOG_LEVEL.toLowerCase()), | ||
| }) | ||
| : pino.destination(2); |
There was a problem hiding this comment.
For CLI applications, using asynchronous logging can lead to lost log messages if the process exits unexpectedly or crashes before the internal buffer is flushed. Since this logger is used in a CLI context (e.g., MCP stdio transport), it is highly recommended to configure pino.destination to write synchronously by setting sync: true.
| : pino.destination(2); | |
| : pino.destination({ dest: 2, sync: true }); |
When using
director http2stdio, the[director-http] connected successfullymessage is logged tostdout. This corrupts the JSON-RPC stream for MCP stdio clients (like Antigravity or Claude Desktop), causing errors likeinvalid character ':' after array element. This PR configurespinoto output all logs toprocess.stderrto conform to the MCP specification.