/queue/enqueue — ARQ ‘function’ kwarg collision fix (2026-07-17)
Type: bugfix / decision
Commit: entirely-api 3361fdf (pushed)
What was broken
POST /queue/enqueue 500’d for task_run_service — the only generic task in
ALLOWED_TASKS — with "got multiple values for argument 'function'".
task_run_service(ctx, module, function, kwargs) has a parameter literally
named function, and routes/queue.py spread req.kwargs into
enqueue_job(**kwargs), colliding with ARQ’s own first parameter
(enqueue_job(function, *args, **kwargs), as wrapped by sentry-sdk’s ARQ
integration). Broken since the route shipped. scheduler.py:_enqueue had
already dodged the same collision by passing positionally.
Fix
routes/queue.py: newPOSITIONAL_TASKSmap — tasks whose param names collide withenqueue_job’s signature get their kwargs converted to positional args in declared order; unknown or missing required params return 400 at the route instead of failing asynchronously in the worker.services/job_queue.py:enqueue()now accepts*args; docstring documents that task kwargs must not be namedfunctionor start with_.
Verified
- Repro’d the 500 pre-fix, then post-rebuild:
task_run_serviceenqueued and ran end-to-end (read-only probeservices.job_queue.get_job, success=true, worker log “Ran services.job_queue.get_job: done”). - Kwarg-style tasks regression-checked (
task_batch_cert_validate→ success).