Skip to content

P7-T4: Add direct local-status fallback for TUI when dashboard API is unavailable#162

Merged
SoundBlaster merged 11 commits into
mainfrom
codex/p7-t4-local-status-fallback
Mar 7, 2026
Merged

P7-T4: Add direct local-status fallback for TUI when dashboard API is unavailable#162
SoundBlaster merged 11 commits into
mainfrom
codex/p7-t4-local-status-fallback

Conversation

@SoundBlaster
Copy link
Copy Markdown
Owner

Description

Add local-status fallback for the broker TUI (--tui) when the dashboard API is unavailable.

When HTTP requests to /api/control or /api/broker/status fail, BrokerTUIClient.fetch_snapshot() now derives a best-effort broker diagnosis from local PID/socket/version files and returns a structured local-fallback snapshot instead of a generic "unavailable" screen. The renderer clearly labels the runtime source and suppresses live stop-control when running on fallback data.

Key changes in src/mcpbridge_wrapper/tui.py:

  • _build_local_fallback_broker() — classifies local state as running (local fallback) or stale local state
  • _read_local_pid() / _read_local_version() — lightweight helpers for PID liveness and version file reads
  • render_screen() — shows Runtime Source label, fallback banners, and suppresses stop-control in fallback mode
  • BrokerTUI._run_loop() — emits an informational message when s is pressed without live dashboard

5 new tests in tests/unit/test_tui.py cover all fallback paths.

Validation report: SPECS/ARCHIVE/P7-T4_Add_direct_local-status_fallback_for_TUI_when_dashboard_API_is_unavailable/P7-T4_Validation_Report.md

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • CI/CD improvement

Quality Gates

  • make test - All tests pass with ≥90% coverage (898 passed, 91.75% coverage)
  • make lint - No linting errors (ruff check src/ clean)
  • make format - Code is properly formatted
  • make typecheck - Type checking passes (mypy src/ — no issues in 20 files)
  • make doccheck - Documentation is synced with DocC (if docs changed)

Documentation Sync

  • Documentation changes are synced with DocC catalog (or N/A) — no docs changed

Testing

  • Added/updated tests for new functionality
  • All tests pass locally
  • Manually tested the changes

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • Comments added for complex code
  • Documentation updated (if needed)
  • No new warnings generated
  • PR title is descriptive

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@SoundBlaster SoundBlaster merged commit f5b9c7b into main Mar 7, 2026
10 checks passed
@SoundBlaster SoundBlaster deleted the codex/p7-t4-local-status-fallback branch March 7, 2026 18:04
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