Skip to content

fix(logger): default to production mode for bundled binaries - #86

Merged
amondnet merged 2 commits into
mainfrom
fix/logger-bundled-binary
Jan 29, 2026
Merged

fix(logger): default to production mode for bundled binaries#86
amondnet merged 2 commits into
mainfrom
fix/logger-bundled-binary

Conversation

@amondnet

@amondnet amondnet commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix thread-stream worker resolution error in bundled binaries by defaulting to production mode.

Problem

When running bunx @pleaseai/code, the binary fails with:

ModuleNotFound resolving "/home/runner/work/.../thread-stream/.../worker.js"

This happens because:

  1. NODE_ENV is not set → development mode
  2. pino tries to use pino-pretty transport
  3. Transport initialization triggers thread-stream worker resolution
  4. Worker path is hardcoded to CI path during compilation

Solution

Detect bundled binary via Bun.embeddedFiles and skip pretty printing by default.

Test

bunx @pleaseai/code version  # Should work without NODE_ENV

Summary by cubic

Default logging to production mode in bundled Bun binaries to prevent thread-stream worker resolution errors from pino-pretty. Detects binaries via Bun.embeddedFiles and disables pretty printing when NODE_ENV is unset.

  • Bug Fixes
    • Skip pino-pretty in compiled binaries to avoid thread-stream worker path failures.
    • Allows bunx @pleaseai/code to run without setting NODE_ENV.

Written for commit 8e95318. Summary will update on new commits.

Detect bundled binary via Bun.embeddedFiles and skip pretty printing
to avoid thread-stream worker resolution errors.

The pino-pretty transport requires worker threads which fail in compiled
binaries due to hardcoded CI paths.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a ModuleNotFound error encountered when running bundled binaries, specifically related to pino-pretty's worker resolution. The fix ensures that when NODE_ENV is not defined in a bundled Bun environment, the logger defaults to production mode, thereby preventing the attempt to use pino-pretty and avoiding the worker resolution failure.

Highlights

  • Fix for ModuleNotFound in bundled binaries: Addresses an issue where pino-pretty caused a ModuleNotFound error in bundled binaries when NODE_ENV was not set, by defaulting the logger to production mode in such scenarios.
  • Logger behavior for bundled Bun binaries: The shouldUsePretty function now checks for Bun.embeddedFiles to identify bundled binaries and disables pretty printing by default if NODE_ENV is not explicitly set.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 29, 2026

Copy link
Copy Markdown

Deploying code-please with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e95318
Status:🚫  Build failed.

View logs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where bundled binaries fail by defaulting them to production logging mode. The change correctly identifies bundled binaries using Bun's specific properties and adjusts the logging behavior. My review includes a suggestion to refactor the logic for improved conciseness and a recommendation to add unit tests for the new execution path to ensure its correctness.

Comment thread packages/logger/src/index.ts
Comment thread packages/logger/src/index.ts
@codecov

codecov Bot commented Jan 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.62%. Comparing base (7c3bd4d) to head (8e95318).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
- Coverage   38.62%   38.62%   -0.01%     
==========================================
  Files          59       59              
  Lines        6529     6530       +1     
==========================================
  Hits         2522     2522              
- Misses       4007     4008       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

@amondnet

Copy link
Copy Markdown
Contributor Author

✅ Applied Suggestions Summary

📊 Overview

  • Applied: 1 (code simplification)
  • Skipped: 1 (test coverage - out of scope)
  • Commit: 8e95318

📝 Applied

코드 간소화 (@gemini-code-assist)

  • ternary operator로 if 블록 제거
  • 더 선언적인 코드로 개선

⏭️ Skipped

테스트 추가 (@gemini-code-assist)

  • 현재 PR 범위 외
  • 번들 바이너리 환경 테스트는 별도 이슈로 다룰 예정

@amondnet
amondnet merged commit 05a1089 into main Jan 29, 2026
4 of 5 checks passed
@amondnet
amondnet deleted the fix/logger-bundled-binary branch January 29, 2026 03:23
@gemini-code-assist

Copy link
Copy Markdown

안녕하세요 @amondnet님,

적용된 변경 사항에 대한 요약 감사합니다!

  • 코드 간소화: ternary operator를 사용하여 코드를 더 간결하고 선언적으로 개선하신 점은 아주 좋습니다. 이 변경은 코드의 가독성과 유지보수성을 향상시킵니다.
  • 테스트 추가: 현재 PR 범위 외로 판단하시고 별도 이슈로 다루기로 결정하신 점도 이해합니다. 이는 PR의 초점을 유지하는 데 도움이 됩니다.

전반적으로 변경 사항이 잘 적용되었고, PR의 목적에 부합합니다. 수고하셨습니다!

@passionfactory-bot passionfactory-bot Bot mentioned this pull request Jan 29, 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.

1 participant