Skip to content

Conversation

@joaopamaral
Copy link

@joaopamaral joaopamaral commented Jan 30, 2026

SUMMARY

Add has_app_context() check before calling db.session.remove() in the task_postrun signal handler to prevent RuntimeError: Working outside of application context when the handler fires after the Flask app context has been torn down.

Fixes #36892

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A - backend fix

TESTING INSTRUCTIONS

  • Run tests
$ pytest tests/integration_tests/celery_tests.py::test_teardown_without_app_context tests/integration_tests/celery_tests.py::test_teardown_with_app_context -v

tests/integration_tests/celery_tests.py::test_teardown_without_app_context PASSED                                                                                                                                                                                                                                                                                                                                                                                                      [ 50%]
tests/integration_tests/celery_tests.py::test_teardown_with_app_context PASSED 

ADDITIONAL INFORMATION

Add has_app_context() check before calling db.session.remove() in the
task_postrun signal handler to prevent RuntimeError when the handler
fires after the Flask app context has been torn down.

Fixes apache#36892
@joaopamaral joaopamaral marked this pull request as draft January 30, 2026 13:26
@dosubot dosubot bot added the change:backend Requires changing the backend label Jan 30, 2026
joaopamaral and others added 2 commits January 30, 2026 10:33
Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
@netlify
Copy link

netlify bot commented Jan 30, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 523d7f8
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/697cc246f54841000891aaeb
😎 Deploy Preview https://deploy-preview-37574--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@joaopamaral joaopamaral marked this pull request as ready for review January 30, 2026 16:12
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 30, 2026

Code Review Agent Run #8b4eb7

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 96eaf8b..11cac8c
    • superset/tasks/celery_app.py
    • tests/integration_tests/celery_tests.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

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

Labels

change:backend Requires changing the backend size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal handler teardown raised: RuntimeError: Working outside of application context

1 participant