Skip to content

feat: dashboard OAuth management, session pagination & analytics cleanup (salvage #9058)#9171

Merged
teknium1 merged 2 commits intomainfrom
hermes/review-9058
Apr 13, 2026
Merged

feat: dashboard OAuth management, session pagination & analytics cleanup (salvage #9058)#9171
teknium1 merged 2 commits intomainfrom
hermes/review-9058

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Salvage of PR #9058 by @kshitijk4poor — cherry-picked onto current main with two fixes.

What's included

Dashboard — OAuth Provider Management (backend + frontend):

  • 6 new API endpoints for full OAuth lifecycle (list, start PKCE/device-code, submit, poll, disconnect, cancel)
  • Supports Anthropic (PKCE), Nous and OpenAI Codex (device-code), Claude Code and Qwen (external CLI)
  • OAuthLoginModal — handles both PKCE and device-code flows in-browser
  • OAuthProvidersCard — connection status, token preview, connect/disconnect actions
  • In-memory session store with 15-minute TTL and automatic GC

Dashboard — Session Pagination:

  • GET /api/sessions now accepts limit and offset query params
  • Returns {sessions, total, limit, offset} envelope
  • Frontend: 20 sessions per page with prev/next controls

Dashboard — Analytics Cleanup:

  • Removed unreliable cost/cache columns (no pricing backend)
  • Simplified to 3 summary cards: Total Tokens, Total Sessions, API Calls

Frontend Fixes:

  • Toast.tsx — render via createPortal for correct z-index
  • App.tsx — skip animation key bump on initial mount (prevents duplicate API calls)
  • main.tsx — remove StrictMode wrapper

Fixes applied during salvage

  1. Guarded module-level import: The bare from agent.anthropic_adapter import (...) at module scope would crash hermes web if the adapter was unavailable. Now wrapped in try/except with a flag; Phase 2 PKCE endpoints return 501 when the adapter is missing.

  2. Authorize URL: Changed from console.anthropic.com/oauth/authorize to claude.ai/oauth/authorize to match the canonical adapter code.

Test plan

  • 47 existing web_server tests pass
  • 1934 passed in hermes_cli suite (10 pre-existing failures unrelated to this change)

Closes #9058

kshitijk4poor and others added 2 commits April 13, 2026 11:12
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
- Wrap module-level import from agent.anthropic_adapter in try/except
  so hermes web still starts if the adapter is unavailable; Phase 2
  PKCE endpoints return 501 in that case.
- Change authorize URL from console.anthropic.com to claude.ai to
  match the canonical adapter code.
@github-actions
Copy link
Copy Markdown

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Outbound network calls (POST/PUT)

Outbound POST/PUT requests in new code could be data exfiltration. Verify the destination URLs are legitimate.

Matches (first 10):

536:+        with urllib.request.urlopen(req, timeout=20) as resp:

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@teknium1 teknium1 merged commit ef18088 into main Apr 13, 2026
4 of 6 checks passed
@teknium1 teknium1 deleted the hermes/review-9058 branch April 13, 2026 18:18
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.

2 participants