Honour taskbadger_track=False in Celery - #62
Merged
Conversation
The header could only ever enable tracking: apply_async overwrote it, and the publish/prerun gates couldn't tell False from absent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
snopoke
marked this pull request as ready for review
August 7, 2026 08:50
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.
The opt-out documented in python-celery.md has never worked.
taskbadger_trackwas a one-way switch:apply_asyncunconditionally wroteTrueover anything the caller passed, and both gates usedif not manual_track, which can't distinguishFalsefrom absent. There is no configuration in which passing it changed the outcome.Three places check the header now, and the third is the non-obvious one: canvas tasks never reach
task_publish_handler(it bails oncelery.*senders), so they're only created in the worker — which is exactly the form the docs use as their example (add.map(...).apply_async(headers=...)).Also fixes a collision the header form hid:
taskbadger_track=Falsepassed the way every other per-call option is passed gets stripped by_get_tb_kwargsintotb_kwargs["track"]and forwarded tocreate_task, which rejects the unexpected kwarg. Same for a class-leveltaskbadger_trackattribute via thedir(ctask)loop. Both now route to the header instead. A class attribute is inert rather than crashing — it is deliberately not a permanent opt-out, since that overlapsCelerySystemIntegration(excludes=[...])and would need the check hoisted above thectasklookup to cover auto-tracked tasks not usingbase=Task.Each of the five new tests was confirmed to fail against the pre-fix code.
🤖 Generated with Claude Code