Fix #135: Remove CI auto-enable for trace logs#138
Merged
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #135
## Problem When the CI environment variable was set to 'true' (as in GitHub Actions and other CI/CD platforms), command-stream automatically enabled verbose trace logging to stderr. This interfered with command output and broke JSON parsing in CI environments. ## Root Cause In src/$.mjs line 15, the VERBOSE constant was set to: `const VERBOSE = process.env.COMMAND_STREAM_VERBOSE === 'true' || process.env.CI === 'true'` This caused trace logs to be emitted whenever CI=true, regardless of the mirror:false or capture:true options. ## Solution 1. Removed automatic trace log activation when CI=true 2. Added COMMAND_STREAM_TRACE environment variable for explicit control: - COMMAND_STREAM_TRACE=true: Explicitly enable tracing - COMMAND_STREAM_TRACE=false: Explicitly disable tracing (overrides VERBOSE) - Not set: Use COMMAND_STREAM_VERBOSE setting 3. Made trace evaluation dynamic to support runtime env var changes 4. Applied consistent trace logic in both src/$.mjs and src/$.utils.mjs ## Benefits - CI environments no longer get polluted with trace logs by default - JSON parsing works reliably in CI/CD pipelines - Users can still enable tracing in CI by setting COMMAND_STREAM_TRACE=true - Explicit control via environment variables ## Testing - Added tests/issue-135-final.test.mjs with 4 tests covering: - CI=true no longer produces trace logs - JSON parsing works in CI environment - Default behavior (no env vars) is clean - mirror:false works correctly in CI - All 4 new tests pass - Existing test suite: 619 pass, 2 pre-existing failures unrelated to this change 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This reverts commit 7aa4a62.
Member
Author
|
Resolve conflicts, and double checks all original requirements are met. |
Member
Author
|
🤖 AI Work Session Started Starting automated work session at 2025-12-28T02:35:40.900Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Conflicts resolved in src/$.mjs and src/$.utils.mjs: - Kept our fix that removes CI=true auto-enabling of trace logs - Maintained COMMAND_STREAM_TRACE and COMMAND_STREAM_VERBOSE support - Preserved dynamic trace evaluation for runtime control 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Documents the fix for CI=true trace logs interfering with output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Apply automatic formatting fixes from 'bun run lint --fix'. All errors fixed; remaining warnings are pre-existing in codebase. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #135 - Trace logs no longer interfere with command output when
CI=trueenvironment variable is set.Problem
When the
CIenvironment variable was set totrue(as in GitHub Actions and other CI/CD platforms), command-stream automatically enabled verbose trace logging to stderr. This caused:Example of the issue:
Solution
1. Removed CI Auto-Enable for Trace Logs
2. Added Explicit Trace Control
New
COMMAND_STREAM_TRACEenvironment variable:COMMAND_STREAM_TRACE=true- Explicitly enable tracing (even in CI)COMMAND_STREAM_TRACE=false- Explicitly disable tracing (overrides VERBOSE)COMMAND_STREAM_VERBOSEsetting (default: disabled)3. Dynamic Trace Evaluation
Changes
Modified Files:
src/$.mjs- Updated trace function and removed CI auto-enablesrc/$.utils.mjs- Consistent trace logicTest Files:
tests/issue-135-final.test.mjs- 4 tests covering the fixexamples/- Reproduction and test scriptsTesting
✅ All new tests passing (4/4):
✅ Existing tests: 619 pass, 2 pre-existing failures unrelated to this change
Migration Guide
Before (Broken in CI)
After (Fixed)
Environment Variable Reference
CI=trueCOMMAND_STREAM_VERBOSE=trueCOMMAND_STREAM_TRACE=trueCOMMAND_STREAM_TRACE=falseImpact
🤖 Generated with Claude Code