fix: NameError in wsrelay when JSON decode fails with DEBUG logging#16340
fix: NameError in wsrelay when JSON decode fails with DEBUG logging#16340AlanCoding merged 1 commit intoansible:develfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughFixed two debug log statements in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@awx/main/wsrelay.py`:
- Around line 139-143: In on_ws_heartbeat(), the json.JSONDecodeError except
block still references `payload` which may not exist and can raise; change that
block to mirror the fix in the other handler by building the warning message
without using `payload` and, when logger.isEnabledFor(logging.DEBUG), append the
raw `msg.data` (or equivalent raw message variable) to the log; then call
logger.warning(...) and continue/return as the handler intends. Ensure you
update the except block in on_ws_heartbeat() to use `msg.data` instead of
`payload` and preserve the debug-only extra data behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6a8657c3-c489-4b7b-bf50-d88d570c82cc
📒 Files selected for processing (1)
awx/main/wsrelay.py
run_connection() referenced payload in the JSONDecodeError handler, but payload was never assigned because json.loads() is what failed. Use msg.data instead to log the raw message content. Fixes: AAP-68045 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Fix other instance of undefined payload
ae5a246 to
aa06cfc
Compare
|


Summary
run_connection()referencedpayloadin theJSONDecodeErrorhandler, butpayloadwas never assigned becausejson.loads()is what failedNameErrorwhen DEBUG logging is enabledmsg.datainstead ofpayloadto log the raw message contentFiles changed
awx/main/wsrelay.pypayload→msg.datain error handlerFixes: AAP-68045
Test plan
Change Type
🤖 Generated with Claude Code
Summary by CodeRabbit