← Back to PRs

#8522: feat(control-ui): Add Model Requests panel for real-time API monitoring

by GiantAxeWhy open 2026-02-04 03:33 View on GitHub →
docs app: web-ui gateway stale
Add a new 'Requests' tab to the Control UI that displays all model API calls with their success/failure status, timing, token usage, and error details in real-time. Features: - Real-time monitoring of all model API requests via WebSocket events - Display request status (pending/success/error) with clear visual indicators - Show timing information (duration, start time) - Display token usage (input/output/cache) and estimated cost - Detailed error information including HTTP status, error message, and whether the error is retryable - Auto-refresh toggle for live updates - Clear history functionality Technical changes: - New model-request-events.ts event system for tracking request lifecycle - Gateway RPC methods: model-requests.list, model-requests.clear - WebSocket 'model.request' event broadcasting - Integration with agent-runner.ts for request tracking - New Requests view component with styled request list This addresses the need for visibility into API call failures without having to dig through log files. Closes #TBD <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a new “Requests” tab to the Control UI that surfaces recent model API calls in real time. On the backend it introduces an in-memory model-request event bus (`src/infra/model-request-events.ts`), exposes RPC methods to list/clear recent requests (`src/gateway/server-methods/model-requests.ts`), and broadcasts `model.request` events from the gateway (`src/gateway/server.impl.ts`). On the frontend it adds view/state wiring for rendering the request stream and toggling auto-refresh (`ui/src/ui/views/requests.ts`, `ui/src/ui/app.ts`, `ui/src/ui/app-render.ts`, `ui/src/ui/app-gateway.ts`, `ui/src/ui/navigation.ts`). Main issues to address are (1) request lifecycle tracking in `agent-runner.ts` doesn’t emit error/terminal states (so failures can remain stuck as pending / not show up), and (2) the new RPC methods and event are not included in the gateway’s canonical method/event registries (`src/gateway/server-methods-list.ts`), which may break discovery/negotiation depending on how `attachGatewayWsHandlers` enforces those lists. <h3>Confidence Score: 3/5</h3> - This PR is mergeable after addressing a couple integration gaps that can break the feature’s core functionality. - The UI wiring and RPC handlers are straightforward, but there are two meaningful correctness risks: request events aren’t marked as error/terminal in `agent-runner.ts`, and the new RPC methods + websocket event are missing from the gateway method/event registries, which can prevent clients from discovering/subscribing depending on enforcement. The remaining notes are mostly type-safety/perf nits. - src/auto-reply/reply/agent-runner.ts, src/gateway/server-methods-list.ts, ui/src/ui/app-gateway.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs