Repository navigation
Conversation
Starlette does not run the lifespan of a mounted sub-app, so with mount_burr_ui() the Burr UI's lifespan never ran: /ready stayed 503 and the backend's startup (its lifespan hook, indexing and snapshot jobs) never started. mount_burr_ui() now runs the UI's lifespan around the parent app's, keeping the parent's own lifespan and the state it yields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1040.
Starlette does not run the lifespan of a mounted sub-app. Because of that, when the Burr UI is mounted with
mount_burr_ui(), its lifespan never runs:/readystays 503, and the backend's startup never happens (itslifespanhook, snapshot download, and the indexing/snapshot jobs).Changes
mount_burr_ui()now wraps the parent app'srouter.lifespan_context. The UI's lifespan runs around the parent's, and the parent's own lifespan and any state it yields are kept.mount_burr_ui()has to be called before the parent app starts.tests/tracking/test_server_mount.py. There were no tests formount_burr_ui()before.How I tested this
/burr/readyreturns 200, and a parent lifespan still runs, with the state it yields reaching requests. Both tests fail onmainand pass with this change.examples/fastapi_mount_example.pyunderuvicorn examples.fastapi_mount_example:appwithBURR_SERVE_STATIC=false:/burr/readyreturned 503 before the change and 200 after.tests/suite in Linux containers, excluding the persister integration and Bedrock tests: Python 3.12 had 765 passed and 1 skipped; Python 3.10 had 763 passed and 3 skipped.scripts/check_asf_headers.pyon the changed files.Notes
BURR_SERVE_STATIC=falsebefore importingburr.tracking.server.run, because importing that module builds an app that serves the UI build, which a source checkout does not have.run.initializedis a module-level flag that is never reset, so the tests reset it withmonkeypatch.Checklist
🤖 Generated with Claude Code