Refact: Allow API Server to Start Without Built WebUI Assets#2418
Merged
danielaskdd merged 1 commit intoHKUDS:mainfrom Nov 24, 2025
Merged
Refact: Allow API Server to Start Without Built WebUI Assets#2418danielaskdd merged 1 commit intoHKUDS:mainfrom
danielaskdd merged 1 commit intoHKUDS:mainfrom
Conversation
- Change build check from error to warning - Redirect to /docs when WebUI unavailable - Add webui_available to health endpoint - Only mount /webui if assets exist - Return status tuple from build check
Collaborator
Author
|
@codex review |
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.
Refact: Allow API Server to Start Without Built WebUI Assets
Problem
Previously, the API server would hard-exit during startup (
sys.exit(1)) if the WebUI frontend wasn't built, making it impossible to run API-only deployments or environments where the UI is built separately. This created several issues:/webuipaths with missing assets resulted in confusing 404 errorsSolution
Refactored the frontend asset checking and mounting logic to enable graceful degradation:
1. Non-blocking WebUI Check
check_frontend_build()to return a tuple(assets_exist, is_outdated)instead of callingsys.exit(1)2. Conditional Route Mounting
/webui) only mounted when assets exist/webuiand/webui/→/docswhen assets missing/) intelligently redirects based on WebUI availability:/webuiwhen WebUI is available/docs(Swagger UI) when WebUI is missing3. Health Endpoint Enhancement
webui_available: booleanfield to/healthresponse4. User Experience
Benefits
✅ API-only deployments - Server starts successfully without WebUI
✅ Container-friendly - No brittle startup failures
✅ Development flexibility - Build UI when ready, not required upfront
✅ Better monitoring -
/healthendpoint reports WebUI status✅ Clear feedback - Yellow warnings with actionable build instructions
✅ Backward compatible - Existing deployments with built WebUI work unchanged
Testing
Manual testing verified:
/) →/docswhen WebUI missing/webuiand/webui/redirect to/docswhen assets missing/healthendpoint includeswebui_available: falsewhen assets missing/healthresponse schema