Skip to content

Record originating task ID as external_id#55

Merged
snopoke merged 2 commits into
mainfrom
sk/external-id
Jul 22, 2026
Merged

Record originating task ID as external_id#55
snopoke merged 2 commits into
mainfrom
sk/external-id

Conversation

@snopoke

@snopoke snopoke commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Uses the new task external_id field (server taskbadger/taskbadger#413) to automatically record the originating framework's task ID, so a Task Badger task can be correlated with the Celery/Procrastinate job when digging through logs. Also exposes external_id on the public SDK (create_task/update_task/Task.create/Task.update), mirroring queue.

Worth knowing:

  • Celery records the task ID for free at creation (headers["id"] / request.id). Procrastinate's job ID is DB-assigned and only known after defer() returns, so it's recorded via one follow-up PATCH at enqueue time (covers defer, defer_async, and periodic jobs).
  • internal/ was updated by hand rather than committing the full invoke update-api regeneration: the pinned generator drifts unrelated code from dateutil.isoparse to datetime.fromisoformat, which can't parse a trailing Z on Python 3.10 (a supported version). The hand-edits match the generator's external_id output exactly.
  • The Celery handler reuses a class-level taskbadger_kwargs dict across invocations; that dict is now copied before mutation so a per-publish external_id can't leak to the next publish (regression test included).

No version bump included — left for release time.

snopoke and others added 2 commits July 22, 2026 11:17
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@snopoke
snopoke marked this pull request as ready for review July 22, 2026 09:30
@snopoke
snopoke merged commit 5010e54 into main Jul 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant