VTASKS_TASK_CONTEXT: per-task context hook (SDK-agnostic)
New opt-in VTASKS_TASK_CONTEXT setting: a deployment-supplied callable (or dotted path) returning a context manager entered around each task execution — and each function-group in a batch queue — receiving (task_id=…, task_ids=…, name=…, queue=…).
Scopes per-task state (error-tracker isolation scopes, log context, tracing spans) without vtasks depending on any SDK:
- Wraps the worker's own failure handling too, so an error tracker capturing the failure log does so inside the task's context.
- Cannot suppress task exceptions (
__exit__'s return value is ignored). - A broken factory logs and degrades to running the task without it.
- Deliberately sync-only: async side effects (e.g. closing per-task DB connections) stay on the
task_finished/task_failuresignals, which fire inside the context — the docs now spell out that boundary.
Motivating case: embedded (ASGI) workers share an event loop — and an ambient Sentry isolation scope — with HTTP requests, so one task's SQL breadcrumbs bled into every capture in the process. Verified end-to-end in GlitchTip: task-side captures now carry vtasks.task/vtasks.queue tags and only their own breadcrumbs (companion GlitchTip MR wires glitchtip.vtasks_context.sentry_task_scope).
7 new tests (context wrapping, failure visibility, no-suppression, broken-factory degradation, batch groups, dotted-path resolution); full suite 175 green.