From 99194a8f7d30dbf1c5141bc57d0ab8a44fc5c840 Mon Sep 17 00:00:00 2001 From: yunyaozhou Date: Tue, 30 Jun 2026 08:23:07 +0800 Subject: [PATCH] fix: align once output with dashboard snapshot --- codex_retry_gateway_tui.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/codex_retry_gateway_tui.py b/codex_retry_gateway_tui.py index 2846f62..5408f53 100644 --- a/codex_retry_gateway_tui.py +++ b/codex_retry_gateway_tui.py @@ -1173,13 +1173,16 @@ def normalize_log_rows(payload: dict[str, Any]) -> list[dict[str, Any]]: return rows -def print_once(payload: dict[str, Any], filter_text: str = "", status_payload: dict[str, Any] | None = None, status_error: str = "") -> None: +def print_once(snapshot: dict[str, Any], filter_text: str = "") -> None: + payload = snapshot.get("payload") if isinstance(snapshot, dict) and isinstance(snapshot.get("payload"), dict) else {} + status_payload = snapshot.get("status_payload") if isinstance(snapshot, dict) and isinstance(snapshot.get("status_payload"), dict) else {} + status_error = str(snapshot.get("status_error") or "") if isinstance(snapshot, dict) else "" print(summary_line(payload)) print(state_summary(payload)) if status_payload or status_error: - print(status_summary(status_payload or {}, status_error)) + print(status_summary(status_payload, status_error)) print("requests") - for row in normalize_request_rows(payload, filter_text): + for row in snapshot.get("requests") or []: print( f"{row['seq']:>6} {short_text(row['request_id'], 16):<16} {status_symbol(row)} {row.get('status_code') or '-':<4} " f"{short_text(row['path'], 20):<20} {short_text(row['model'] or row['requested_model'] or row['forwarded_model'], 16):<16} " @@ -1212,7 +1215,7 @@ def main(argv: list[str] | None = None) -> int: filter_text=args.filter, current_view="overview", ) - print_once(snapshot["payload"], args.filter, snapshot["status_payload"], snapshot["status_error"]) + print_once(snapshot, args.filter) return 0 return run_textual(args.api_url, status_url, max(1, args.refresh_seconds), max(1, args.timeout), version_message)