]> git.ipfire.org Git - thirdparty/rspamd.git/commit
Fix synchronous context_augment firing two GPT requests for one model 6142/head
authorMarcel Menzel <mail@mcl.gg>
Thu, 16 Jul 2026 10:55:55 +0000 (10:55 +0000)
committerMarcel Menzel <mail@mcl.gg>
Thu, 16 Jul 2026 10:58:04 +0000 (12:58 +0200)
commit2e3d24a8c7c7d6771ba0bab3921497318ca3490a
tree55bad7a9bf644b47d841584e7a4b8ff522d1bce1
parentdc32a66cc7b88f249edabff09836ebe300275d5b
Fix synchronous context_augment firing two GPT requests for one model

When your context_augment function calls the callback synchronously
(e.g., return function(task, content, cb) cb('some context') end),
the pending_fetches counter drops to 0 inside the callback,
triggering maybe_proceed() which calls proceed().

Then control returns to the main flow where the now-redundant guard
also sees pending_fetches == 0 and calls proceed(nil) a second time
— this time without the context snippet.

The else branch (line 1324) already handles the case where none
of the context features are enabled, so the removed fallback
was purely a duplicate path for synchronous callbacks.
src/plugins/lua/gpt.lua