Skip to content

Add prompt-safe router state diagnostics wrapper#61

Closed
Disaster-Terminator wants to merge 1 commit intoreview/route-contract-hardening-2026-05-05from
add-diagnostics-command-for-router-health
Closed

Add prompt-safe router state diagnostics wrapper#61
Disaster-Terminator wants to merge 1 commit intoreview/route-contract-hardening-2026-05-05from
add-diagnostics-command-for-router-health

Conversation

@Disaster-Terminator
Copy link
Copy Markdown
Owner

Motivation

  • Operators need a small, auditable CLI that summarizes router health from config and structured logs without copying raw prompts or secrets into issue reports.
  • The change should be a thin convenience wrapper that reuses existing parsers and helpers rather than adding monitoring subsystems or changing runtime behavior.

Description

  • Add scripts/diagnose_router_state.py, a small CLI that prints [router_config] (including entry_model, fallback_route_id, route→target mapping, and hard-rule route ids) and optional [route_summary] / [route_error_budget] sections when --logs is provided.
  • The script reuses router.config.load_settings, scripts/router_log_summary parsers, and scripts/check_route_error_budget helpers and emits only aggregate fields to avoid printing prompts, message contents, bearer tokens, raw request bodies, or Authorization headers.
  • Add tests/test_diagnose_router_state.py with tests for stable config output, logs-enabled output including summaries and budgets, redaction of sensitive payload fields, and execution from the repo root.
  • Add a small sys.path insertion in the script so it can be executed directly from the repository root as an operator command without modifying package layout or runtime routing.

Testing

  • Ran uv run python -m pytest -q, which passed: 153 passed, 1 warning (the new tests included).
  • Ran uv run python scripts/diagnose_router_state.py --routes config/routes.yaml which returned successfully and printed the [router_config] section.
  • Automated tests include CLI checks for stable sections and redaction of messages/authorization/bearer tokens and they passed under the test suite.

Codex Task

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Disaster-Terminator! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@Disaster-Terminator Disaster-Terminator deleted the add-diagnostics-command-for-router-health branch May 7, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant