Spaces:
Running
Rerun after a failed API check so the diagnostics panel can appear
Browse filesGap found while validating the branch. The success branch already
reruns, with a comment explaining exactly why: the sidebar and status
chip are drawn before this handler executes. The failure branch did
not, so the sidebar diagnostics panel — which explains what went wrong
and offers the report — could not appear until the user happened to
interact with something else. The failure case is precisely when that
panel is wanted.
Nothing is lost by rerunning: `_render_status` re-renders the message
from `api_status` on the next run, which is what made the inline
st.error and its debug caption redundant here.
Validated end to end against a fresh server: 13/13 checks pass,
including the panel appearing on failure and staying hidden on a
healthy run.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- app/ui/setup_screen.py +8 -4
|
@@ -586,7 +586,6 @@ def _render_api_check_card(settings, *, debug: bool) -> None:
|
|
| 586 |
# is used — get_settings is process-cached and load_dotenv only
|
| 587 |
# runs once at import.
|
| 588 |
settings = reload_settings()
|
| 589 |
-
debug = bool(getattr(settings, "show_debug_panel", False))
|
| 590 |
with st.spinner("Checking your AI service…"):
|
| 591 |
# Live text-provider reachability only. The vision model is
|
| 592 |
# NOT exercised during setup.
|
|
@@ -600,9 +599,14 @@ def _render_api_check_card(settings, *, debug: bool) -> None:
|
|
| 600 |
else:
|
| 601 |
st.session_state.api_status = result.status
|
| 602 |
st.session_state.api_ok = False
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 606 |
|
| 607 |
|
| 608 |
def _render_debug_config_block(settings) -> None:
|
|
|
|
| 586 |
# is used — get_settings is process-cached and load_dotenv only
|
| 587 |
# runs once at import.
|
| 588 |
settings = reload_settings()
|
|
|
|
| 589 |
with st.spinner("Checking your AI service…"):
|
| 590 |
# Live text-provider reachability only. The vision model is
|
| 591 |
# NOT exercised during setup.
|
|
|
|
| 599 |
else:
|
| 600 |
st.session_state.api_status = result.status
|
| 601 |
st.session_state.api_ok = False
|
| 602 |
+
# Rerun on failure too, for the same reason the success branch
|
| 603 |
+
# does: the sidebar and status chip were drawn before this
|
| 604 |
+
# handler ran, so without it the diagnostics panel explaining
|
| 605 |
+
# the failure cannot appear until the user happens to interact
|
| 606 |
+
# again. The message is not lost — `_render_status` above
|
| 607 |
+
# re-renders it from ``api_status`` on the next run, which is
|
| 608 |
+
# why the inline st.error here is no longer needed.
|
| 609 |
+
st.rerun()
|
| 610 |
|
| 611 |
|
| 612 |
def _render_debug_config_block(settings) -> None:
|