fix(cli): report actual emissions file path - #1331
Open
davidberenstein1957 wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1331 +/- ##
==========================================
- Coverage 91.43% 91.43% -0.01%
==========================================
Files 49 49
Lines 5057 5056 -1
==========================================
- Hits 4624 4623 -1
Misses 433 433 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
davidberenstein1957
marked this pull request as ready for review
August 12, 2026 19:14
davidberenstein1957
force-pushed
the
fix/cli-output-path-report
branch
from
August 19, 2026 14:26
5dc9467 to
4bf4bcb
Compare
The monitor report resolved the output path from `output_file` alone, which is only the basename, so `os.path.abspath` resolved it against the CWD and ignored `output_dir`. Users were told the file was somewhere it was not. Ask the output handlers for their `save_file_path` instead, which also prints nothing when CSV output is disabled. Keeps the `typing_extensions.Annotated` import the CLI needs on older Pythons. Closes #1322 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
davidberenstein1957
force-pushed
the
fix/cli-output-path-report
branch
from
August 20, 2026 06:14
ba5bab5 to
cbf6e59
Compare
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.
The
codecarbon monitorpost-run report resolved the emissions file path fromtracker._conf["output_file"], which is only the basename.os.path.abspaththen resolved it against the current working directory, so anyoutput_dirother than the default"."produced a path where the file is not. The CLI defaults tolog_level="error", which suppresses the correct INFO lineFileOutputlogs, so the wrong path was the only one the user saw.What changed
codecarbon/cli/monitor.pynow asks the tracker's output handlers for theirsave_file_pathinstead of reconstructing the path from config keys. This keeps the CLI correct if the path logic changes, prints nothing when CSV output is disabled (previously a confidently wrong path), and handles multiple file handlers.Verification
Three new tests in
tests/cli/test_monitor.py(test_run_and_monitor_reports_output_dir,test_run_and_monitor_reports_relative_path_from_cwd,test_run_and_monitor_reports_no_path_without_file_output). The first and third fail on master and pass with this change.uv run pytest tests/cli/test_monitor.py -q-> 10 passed.Display-only change; no measurement or file-writing behaviour is affected.
Closes #1322
🤖 Generated with Claude Code