fix: fix logging format error and noisy backpressure warning#512
Merged
Conversation
- microcontroller.py: add %s placeholder so CommandAborted error is formatted into the log message instead of causing a TypeError - widgets.py: downgrade backpressure monitor update failure from warning to debug — this is a benign race condition when multiprocessing objects are cleaned up while the timer is still firing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes two logging-related issues to reduce log noise and prevent a logging formatting crash during aborted MCU commands.
Changes:
- Fix
Microcontroller.send_command()warning formatting to safely log the storedCommandAbortederror. - Downgrade
BackpressureMonitorWidgetupdate failure logging from warning to debug to avoid benign log spam during teardown.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| software/control/microcontroller.py | Adds a %s placeholder so the warning can include the CommandAborted object without triggering logging formatting errors. |
| software/control/widgets.py | Changes backpressure monitor update failure logging to debug and adjusts exception handling during shutdown/cleanup races. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| self.stop_monitoring() | ||
| except Exception as e: | ||
| self._log.warning(f"Backpressure monitor update failed: {e}") | ||
| except (AttributeError, Exception) as e: |
Separate the benign AttributeError race (debug) from unexpected exceptions (warning) instead of downgrading all failures to debug. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
log.warning()call was passingCommandAbortedexception as a positional arg without a%splaceholder, causingTypeError: not all arguments converted during string formattingon every aborted commandBackpressureMonitorWidgetlogged a warning on'NoneType' object has no attribute 'get_lock'— a benign race condition when the acquisition's multiprocessing objects are cleaned up while the update timer is still firing. Downgraded to debug.Test plan
--- Logging error ---tracebackWARNING - Backpressure monitor update failedspam in logs🤖 Generated with Claude Code