From: Vsevolod Stakhov Date: Tue, 14 Oct 2025 10:58:32 +0000 (+0100) Subject: [Fix] Move nresults_postfilters recording to after POST_FILTERS stage X-Git-Tag: 3.14.0~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4649ad851f67e64d2186100b9b53eb187f1f062;p=thirdparty%2Frspamd.git [Fix] Move nresults_postfilters recording to after POST_FILTERS stage This fixes an issue where composite rules depending on statistics symbols (like BAYES_SPAM) would fail to trigger. The nresults_postfilters counter was being set too early (after COMPOSITES stage), preventing detection of symbols added during autolearn or other post-filter processing. Fixes #5674 --- diff --git a/src/libserver/task.c b/src/libserver/task.c index 0d58ad3c7b..7fcf07a13b 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -721,7 +721,6 @@ rspamd_task_process(struct rspamd_task *task, unsigned int stages) case RSPAMD_TASK_STAGE_COMPOSITES: rspamd_composites_process_task(task); - task->result->nresults_postfilters = task->result->nresults; break; case RSPAMD_TASK_STAGE_POST_FILTERS: @@ -737,6 +736,11 @@ rspamd_task_process(struct rspamd_task *task, unsigned int stages) !(task->flags & (RSPAMD_TASK_FLAG_LEARN_SPAM | RSPAMD_TASK_FLAG_LEARN_HAM | RSPAMD_TASK_FLAG_LEARN_CLASS))) { rspamd_stat_check_autolearn(task); } + + if (all_done) { + /* Record results count after postfilters to detect if learning stages add symbols */ + task->result->nresults_postfilters = task->result->nresults; + } break; case RSPAMD_TASK_STAGE_LEARN: