fix(cli): use OfflineEmissionsTracker for offline monitor runs#1202
Merged
Conversation
ee75977 to
7094f40
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1202 +/- ##
=======================================
Coverage 88.90% 88.91%
=======================================
Files 45 45
Lines 4301 4302 +1
=======================================
+ Hits 3824 3825 +1
Misses 477 477 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@copilot can you improve the coverage of these tests? |
benoit-cty
approved these changes
May 20, 2026
Contributor
benoit-cty
left a comment
There was a problem hiding this comment.
Thanks for fixing this.
Pass an explicit offline flag from monitor to run_and_monitor so tracker selection matches the non-delegate path instead of inferring from kwargs. Co-authored-by: Cursor <cursoragent@cursor.com>
0463321 to
e68906a
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.
Summary
codecarbon monitor --offline --country-iso-code FRA -- <command>delegates torun_and_monitor, which always constructedEmissionsTracker.country_iso_code,region) were forwarded toBaseEmissionsTracker.__init__, causing:unexpected keyword argument 'country_iso_code'.run_and_monitornow selectsOfflineEmissionsTrackerwhencountry_iso_codeis present in tracker kwargs (same signal as the top-levelmonitorcommand).Test plan
uv run pytest tests/cli/test_monitor.py -qcodecarbon monitor --offline --country-iso-code FRA -- python -c "print('hello')"Made with Cursor