Skip to content

Release 1.162.3 - #3826

Open
odlbot wants to merge 5 commits into
releasefrom
release-candidate
Open

Release 1.162.3#3826
odlbot wants to merge 5 commits into
releasefrom
release-candidate

Conversation

@odlbot

@odlbot odlbot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Dan Subak

Tobias Macey

Zaman Afzal

Comment thread b2b/mail.py
Comment on lines +62 to +65
message_id = (
recipient_status.message_id.strip("<>")
if recipient_status
else None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The code may raise an AttributeError by calling .strip() on recipient_status.message_id without first checking if message_id is None.
Severity: MEDIUM

Suggested Fix

Add a check to ensure recipient_status.message_id is not None before attempting to call .strip() on it. For example: message_id = recipient_status.message_id.strip("<>") if recipient_status and recipient_status.message_id else None.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: b2b/mail.py#L62-L65

Potential issue: The code at `b2b/mail.py:62~65` attempts to process an email message ID
by calling `.strip("<>")` on `recipient_status.message_id`. While the code checks if
`recipient_status` exists, it does not verify if `recipient_status.message_id` is `None`
before calling the string method. According to Anymail documentation, it is possible for
`message_id` to be `None` even when a `recipient_status` object is present, particularly
if the send operation fails in a specific way. If this scenario occurs, the code will
raise an `AttributeError`, which will be caught by the surrounding `try...except` block,
causing the function to silently fail and return `None`. This could lead to lost
tracking of email delivery status.

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants