Custom webhook notification bodies under 3 lines get replaced with "blank body" warning - #616
Merged
Conversation
…lank body" warning Resolves #611
TheWitness
previously approved these changes
Aug 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in JobNotificationMixin.build_notification_message() where short (e.g., single-line) custom webhook bodies could be incorrectly replaced with a “blank body” warning, preventing compact JSON payloads from reaching webhook receivers.
Changes:
- Relaxes the “blank body” detection logic from “≤ 2 lines” to “empty-only” (
< 1line after stripping). - Preserves short, valid rendered bodies (notably for webhook notifications) that previously got overwritten.
Suppressed comments (1)
awx/main/models/notifications.py:498
- This change alters how rendered notification bodies are validated, but there doesn’t appear to be a test that asserts short (1–2 line) webhook bodies are preserved (the reported regression in #611). Adding a regression test (e.g., creating a Job + webhook NotificationTemplate with a 1-line JSON body template and asserting build_notification_message returns it unchanged) would prevent this from reoccurring.
if len(body.strip().splitlines()) < 1:
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (3)
awx/main/models/notifications.py:503
- The user-facing warning message has a grammatical error: "return" should be "returned".
[
"The template rendering return a blank body.",
"Please check the template.",
awx/main/models/notifications.py:498
- The blank-body check can be simplified and made clearer.
len(body.strip().splitlines()) < 1is equivalent to checking whether the rendered body is empty/whitespace-only, and thesplitlines()work is unnecessary.
if len(body.strip().splitlines()) < 1:
awx/main/models/notifications.py:498
- This change affects how custom notification bodies are handled (short webhook payloads should no longer be replaced). There doesn't appear to be test coverage asserting that
build_notification_message()preserves a single-line custom body and only substitutes the warning for empty/whitespace-only bodies.
# Only replace the body when the template renders to nothing
# (empty or whitespace-only). Short single-line bodies, such as a
# compact JSON webhook payload, must be passed through unchanged.
if len(body.strip().splitlines()) < 1:
TheWitness
approved these changes
Aug 4, 2026
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.
Resolves #611