Skip to content

Log task rejections without a traceback - #1192

Open
DavidMStraub wants to merge 1 commit into
gramps-project:masterfrom
DavidMStraub:quiet-task-rejection-logs
Open

DavidMStraub wants to merge 1 commit into
gramps-project:masterfrom
DavidMStraub:quiet-task-rejection-logs

Conversation

@DavidMStraub

@DavidMStraub DavidMStraub commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Expected 4xx outcomes inside Celery tasks, such as the AI agent exceeding LLM_MAX_REQUESTS, were logged at ERROR with a full chained traceback. This filled the worker logs.

TaskRejection already marks these outcomes as expected, and Sentry already ignores it. This PR adds throws = (TaskRejection,) to ContextTask, which is Celery's setting for expected errors:

  • They are logged at INFO, with no traceback.
  • The result backend still stores them as failures, so the client still gets the error payload.
  • 5xx TaskErrors still log at ERROR with their traceback.

Tests cover both log levels.

TaskRejection marks 4xx outcomes such as the AI agent exceeding its usage
limits. Celery logged them at ERROR with the full chained traceback.
Declaring them in Task.throws logs them at INFO without one, while the
result backend still stores the failure for the client.
@DavidMStraub
DavidMStraub force-pushed the quiet-task-rejection-logs branch from c7038db to e613073 Compare November 19, 2026 09:14

This branch has not been deployed

No deployments
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