Skip to content

Follow-up classifier job fails when sent message is also in INBOX #13731

Description

@synetix-code

Steps to reproduce

  1. Enable LLM processing in Mail (I use integration_openai as the text2text provider)
  2. Send a mail where a copy also ends up in INBOX of the same account (e.g. Bcc to yourself)
  3. Wait for FollowUpClassifierJob to run for it

Expected behavior

Message gets classified like any other sent message.

Actual behavior

The job crashes with a TypeError:

Undefined array key 0 at apps/mail/lib/BackgroundJob/FollowUpClassifierJob.php#70
TypeError: OCA\Mail\Db\ThreadMapper::findNewerMessageIdsInThread(): Argument #2 ($message) must be of type OCA\Mail\Db\Message, null given, called in .../FollowUpClassifierJob.php on line 73

Since it's a QueuedJob it's already removed from the job list at that point, so the message never gets a follow-up check.

I think the problem is that array_filter() keeps the original keys. getByMessageId() returns both the INBOX and the Sent copy, the INBOX one comes first, so after filtering the Sent message is at index 1 and $messages[0] is null. Wrapping it in array_values() should fix it.

Looks like main still has the same code.

Mail app version

5.12.2

Nextcloud version

34.0.4

Mailserver or service

Own IMAP server

Operating system

AlmaLinux 9.8

PHP engine version

PHP 8.2

Nextcloud memory caching

APCu

Web server

Apache (supported)

Database

MySQL

Additional info

In my case 6 of 60 sent messages failed, and those were exactly the 6 that also had a copy in INBOX. All the others went through fine.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions