Skip to content

fix: register logger_task and webhook_task in CELERY_IMPORTS#9413

Open
pranav-afk wants to merge 1 commit into
makeplane:previewfrom
pranav-afk:fix/9357-celery-logger-task-import
Open

fix: register logger_task and webhook_task in CELERY_IMPORTS#9413
pranav-afk wants to merge 1 commit into
makeplane:previewfrom
pranav-afk:fix/9357-celery-logger-task-import

Conversation

@pranav-afk

@pranav-afk pranav-afk commented Jul 13, 2026

Copy link
Copy Markdown

Description

Registers Celery background tasks that the API enqueues but the worker never loaded, so those jobs were silently dropped.

APITokenLogMiddleware queues plane.bgtasks.logger_task.process_logs on API requests. The task module existed, but it was missing from CELERY_IMPORTS in plane/settings/common.py, so the worker never registered it and logged:

Received unregistered task of type 'plane.bgtasks.logger_task.process_logs'
KeyError: 'plane.bgtasks.logger_task.process_logs'

That broke API activity / audit logging and produced noisy worker errors. The same pattern applies to webhook_task (only registered via fragile transitive imports), so both modules are listed explicitly.

Change: add to CELERY_IMPORTS:
• plane.bgtasks.logger_task
• plane.bgtasks.webhook_task

Type of Change
• [x] Bug fix (non-breaking change which fixes an issue)
• [ ] Feature (non-breaking change which adds functionality)
• [ ] Improvement (change that would cause existing functionality to not work as expected)
• [ ] Code refactoring
• [ ] Performance improvements
• [ ] Documentation update

Test Scenarios
• Restart the Celery worker after deploy and confirm it starts without import errors
• Hit any authenticated API endpoint that goes through APITokenLogMiddleware
• Confirm worker logs no longer show unregistered process_logs tasks
• Confirm process_logs tasks are consumed (or API activity logs are written as expected)
• Optionally trigger a webhook delivery and confirm webhook tasks still run

References
Fixes #9357
Fixes #8928

Summary by CodeRabbit

  • Bug Fixes
    • Improved background processing reliability for logging and webhook-related tasks.
    • Ensured these tasks are properly registered and available for execution.

API middleware enqueues plane.bgtasks.logger_task.process_logs on each
request, but the worker never imported the module, so tasks were discarded
with KeyError. Explicitly import logger_task (and webhook_task for the same
fragile transitive-import pattern) so Celery registers them.

Fixes makeplane#9357
Fixes makeplane#8928
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6606a666-5a61-48e6-bc7c-98e0762a531a

📥 Commits

Reviewing files that changed from the base of the PR and between dc9d80b and 78eb111.

📒 Files selected for processing (1)
  • apps/api/plane/settings/common.py

📝 Walkthrough

Walkthrough

Celery’s CELERY_IMPORTS setting now explicitly includes logger-related and webhook-related task modules.

Changes

Celery task registration

Layer / File(s) Summary
Register background task modules
apps/api/plane/settings/common.py
Adds plane.bgtasks.logger_task and plane.bgtasks.webhook_task to CELERY_IMPORTS.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: dheeru0198, pablohashescobar

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding logger and webhook task modules to CELERY_IMPORTS.
Description check ✅ Passed The description covers the change, type, tests, and references, matching the template well enough.
Linked Issues check ✅ Passed The PR directly fixes #9357 and #8928 by registering plane.bgtasks.logger_task and plane.bgtasks.webhook_task.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to Celery imports and does not introduce unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant