Skip to content

Commit bec0786

Browse files
snopokeclaude
andcommitted
Correct comment: canvas tasks can't carry taskbadger_parent
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent f36ccaa commit bec0786

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

taskbadger/celery.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,19 @@ def _maybe_create_task(signal_sender):
324324
delivery_info = getattr(signal_sender.request, "delivery_info", None) or {}
325325
queue = delivery_info.get("routing_key")
326326
external_id = signal_sender.request.id
327-
# `before_task_publish` never ran for these, so per-call options are still
328-
# sitting in the headers rather than resolved into the message.
327+
# `before_task_publish` never ran for eager tasks, so their per-call options
328+
# are still sitting in the headers rather than resolved into the message.
329+
# Canvas tasks never have any here: `task_publish_handler` strips TB headers
330+
# off `celery.*` messages before its early return, so nothing reaches the
331+
# worker.
329332
header_kwargs = headers.get(TB_KWARGS_ARG) or {}
330333
create_kwargs = {
331334
"status": StatusEnum.PENDING,
332335
"data": data,
333336
"queue": queue,
334337
"external_id": external_id,
335338
# eager and canvas tasks are created here rather than at publish time, but
336-
# still run inside whatever task invoked them. An explicit
339+
# still run inside whatever task invoked them. For eager tasks an explicit
337340
# `taskbadger_parent` wins, as it does at publish time — including an
338341
# explicit `None`, which asks for a root task.
339342
"parent": header_kwargs["parent"] if "parent" in header_kwargs else parent_id(),

0 commit comments

Comments
 (0)