Skip to content

feat: dashboard OAuth management, session pagination & analytics cleanup#9058

Closed
kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
kshitijk4poor:feat/pricing-cost-accuracy
Closed

feat: dashboard OAuth management, session pagination & analytics cleanup#9058
kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
kshitijk4poor:feat/pricing-cost-accuracy

Conversation

@kshitijk4poor
Copy link
Copy Markdown
Contributor

@kshitijk4poor kshitijk4poor commented Apr 13, 2026

Summary

Adds OAuth provider management and session pagination to the Hermes dashboard, and cleans up the analytics page by removing unreliable cost/cache UI.

Dashboard — OAuth Provider Management

Backend (hermes_cli/web_server.py):

  • 6 new API endpoints for full OAuth lifecycle:
    • GET /api/providers/oauth — list all providers with connection status
    • POST /api/providers/oauth/{id}/start — initiate PKCE or device-code flow
    • POST /api/providers/oauth/{id}/submit — exchange PKCE authorization code
    • GET /api/providers/oauth/{id}/poll/{session} — poll device-code approval
    • DELETE /api/providers/oauth/{id} — disconnect provider
    • DELETE /api/providers/oauth/sessions/{session_id} — cancel pending session
  • Supports Anthropic (PKCE), Nous and OpenAI Codex (device-code)
  • OAuth constants imported from anthropic_adapter (no duplication)
  • Blocking I/O wrapped in run_in_executor for async safety
  • In-memory session store with 15-minute TTL and automatic GC
  • Auth token required on all mutating endpoints

Frontend:

  • OAuthLoginModal — handles both PKCE (paste auth code) and device-code (poll for approval) flows
  • OAuthProvidersCard — connection status, token preview, connect/disconnect actions
  • Integrated into the Env/Keys page

Dashboard — Session Pagination

  • GET /api/sessions now accepts limit and offset query params (was hardcoded to 20)
  • Returns {sessions, total, limit, offset} instead of a bare array
  • Frontend shows 20 sessions per page with prev/next controls and "1–20 of N" label
  • Total session count displayed in header badge
  • StatusPage updated to handle new response shape

Dashboard — Analytics Cleanup

  • Removed cost columns and cache hit UI from the analytics page (unreliable without a pricing backend)
  • Removed: formatCost(), bestCost(), Cache Hit summary card, Total Cost summary card, Cost/Cache columns in daily and model tables
  • Simplified to 3 summary cards: Total Tokens, Total Sessions, API Calls

Frontend Fixes

  • Toast.tsx — render via createPortal to document.body for correct z-index
  • App.tsx — skip animation key bump on initial mount to prevent double-mount / duplicate API calls
  • main.tsx — remove StrictMode wrapper

Test Plan

  • pytest tests/hermes_cli/test_web_server.py — 47 passed
  • Manual API test: all 6 OAuth endpoints verified via curl
  • Playwright smoke test: OAuth card renders, PKCE flow starts, analytics has zero cost/cache
  • Frontend builds clean (npm run build)
  • Full test suite

@kshitijk4poor kshitijk4poor force-pushed the feat/pricing-cost-accuracy branch 3 times, most recently from 576cd30 to 29604ed Compare April 13, 2026 15:54
@kshitijk4poor kshitijk4poor changed the title feat: route-aware pricing accuracy + web dashboard OAuth & analytics feat: web dashboard OAuth management, analytics fixes & pricing reference Apr 13, 2026
@kshitijk4poor kshitijk4poor changed the title feat: web dashboard OAuth management, analytics fixes & pricing reference feat: dashboard OAuth management, analytics fixes & pricing reference Apr 13, 2026
@kshitijk4poor kshitijk4poor force-pushed the feat/pricing-cost-accuracy branch 7 times, most recently from 1bf1bac to 6292a73 Compare April 13, 2026 16:47
@kshitijk4poor kshitijk4poor changed the title feat: dashboard OAuth management, analytics fixes & pricing reference feat: dashboard OAuth provider management Apr 13, 2026
@kshitijk4poor kshitijk4poor force-pushed the feat/pricing-cost-accuracy branch 2 times, most recently from 7db0faf to bba82bf Compare April 13, 2026 17:09
@kshitijk4poor kshitijk4poor changed the title feat: dashboard OAuth provider management feat: dashboard OAuth provider management + analytics cleanup Apr 13, 2026
@kshitijk4poor
Copy link
Copy Markdown
Contributor Author

Superseded by new PR with UX polish included.

@kshitijk4poor kshitijk4poor reopened this Apr 13, 2026
@kshitijk4poor kshitijk4poor force-pushed the feat/pricing-cost-accuracy branch from bba82bf to d9263b0 Compare April 13, 2026 17:49
@kshitijk4poor kshitijk4poor changed the title feat: dashboard OAuth provider management + analytics cleanup feat: dashboard OAuth management, session pagination & analytics cleanup Apr 13, 2026
@kshitijk4poor kshitijk4poor force-pushed the feat/pricing-cost-accuracy branch from d9263b0 to 56c63a8 Compare April 13, 2026 18:01
Add OAuth provider management to the Hermes dashboard with full
lifecycle support for Anthropic (PKCE), Nous and OpenAI Codex
(device-code) flows.

## Backend (hermes_cli/web_server.py)

- 6 new API endpoints:
  GET /api/providers/oauth — list providers with connection status
  POST /api/providers/oauth/{id}/start — initiate PKCE or device-code
  POST /api/providers/oauth/{id}/submit — exchange PKCE auth code
  GET /api/providers/oauth/{id}/poll/{session} — poll device-code
  DELETE /api/providers/oauth/{id} — disconnect provider
  DELETE /api/providers/oauth/sessions/{id} — cancel pending session
- OAuth constants imported from anthropic_adapter (no duplication)
- Blocking I/O wrapped in run_in_executor for async safety
- In-memory session store with 15-minute TTL and automatic GC
- Auth token required on all mutating endpoints

## Frontend

- OAuthLoginModal — PKCE (paste auth code) and device-code (poll) flows
- OAuthProvidersCard — status, token preview, connect/disconnect actions
- Toast fix: createPortal to document.body for correct z-index
- App.tsx: skip animation key bump on initial mount (prevent double-mount)
- Integrated into the Env/Keys page
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