Skip to content

fix: resolve next.config.js syntax error and scaffold dashboard UI - #68

Open
archittmittal wants to merge 2 commits into
mainfrom
fix/ui-config-and-scaffold
Open

fix: resolve next.config.js syntax error and scaffold dashboard UI#68
archittmittal wants to merge 2 commits into
mainfrom
fix/ui-config-and-scaffold

Conversation

@archittmittal

@archittmittal archittmittal commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes #37

Applied review feedback:

  • All hardcoded URLs replaced with NEXT_PUBLIC_API_URL / NEXT_PUBLIC_WS_URL env vars with fallbacks
  • Session list unwraps data.sessions array
  • Events list unwraps eventsData.events array
  • WS session_update handler uses message.session (not .meta)
  • Agent Call Hierarchy now renders edges as parent-child tree
  • Rebased on latest main

@github-actions github-actions Bot added type: bugfix Auto-generated label for type: bugfix pkg: ui area: ui/state ci/cd labels Aug 4, 2026

@purvanshjoshi purvanshjoshi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

This is a solid scaffold that correctly resolves #37 (the next.config.js syntax fix and removing || true from CI are both right — the UI build now genuinely passes) and lays out a clean App Router structure (globals.css, layout.tsx, page.tsx) with a genuinely good-looking dashboard. However, I found three functional bugs that will break the dashboard at runtime, so I can't approve in its current state.

Blocking issues

  1. /api/sessions response is not unwrapped (page.tsx fetchSessionsList).
    The server returns { "sessions": [...], "total", "page", "limit" } (routers/sessions.py list_sessions), but the code does setSessions(data) and checks data.length / data[0]. This sets the store's sessions to the wrapper object instead of an array, so filteredSessions = sessions.filter(...) in render throws a TypeError and the sidebar crashes whenever the API returns data. It also means the auto-select never fires (data.length is undefined).
    Fix: setSessions(data.sessions) and use data.sessions.length / data.sessions[0].

  2. /api/sessions/{id}/events response is not unwrapped (handleSelectSession).
    The events endpoint returns { "events": [...] } (routers/events.py list_session_events), but the code does setEvents(eventsData), making events an object — events.map(...) in the feed render then crashes.
    Fix: setEvents(eventsData.events).

  3. WS session_update field mismatch (page.tsx websocket handler).
    The server broadcasts { "type": "session_update", "session_id", "session": session_data } (ws_manager.py broadcast_session_update), but the handler reads message.meta. Since meta is undefined, updateSessionMeta silently becomes a no-op and live session/token updates never reach the UI.
    Fix: use message.session instead of message.meta.

Should address

  1. Hardcoded API/WS URLs. page.tsx hardcodes http://127.0.0.1:8765 and derives the WS host from window.location.hostname. The repo already documents NEXT_PUBLIC_API_URL and NEXT_PUBLIC_WS_URL (README, set in docker-compose.yml) but they're never read. In any deployment where the browser's origin differs from the API host (remote host, Docker host variance), this breaks silently. Please add a small helper that reads process.env.NEXT_PUBLIC_API_URL / NEXT_PUBLIC_WS_URL with http://127.0.0.1:8765 as a fallback, and use it consistently for both REST and WS (also note REST and WS currently derive hosts differently).

  2. Agent Call Hierarchy is a flat list, not a DAG. graphData.edges is fetched but never rendered, and the reactflow dependency (plus the README's "Agent DAG Graph" claim) is unused. Fine as an incremental scaffold toward the React Flow graph (tracked in #5/#15), but please either render the edges/parent-child relationships now or explicitly mark the panel as a placeholder so the README claim isn't overstated.

Minor (non-blocking)

  • The "Active Agents" KPI shows statsData?.agents?.length — that's a unique-agent count, not "active agents".
  • Sidebar session cards and event rows are clickable <div>s; consider role="button"/<button> with keyboard support for accessibility.
  • next-env.d.ts is normally auto-generated by Next — committing it is fine, just don't edit it manually.

The scaffold direction is good and the rest of the code is clean — happy to re-review once the three blocking bugs (and ideally #4) are addressed.

@purvanshjoshi

Copy link
Copy Markdown
Contributor

@archittmittal ❌ Do not merge yet — 3 blocking bugs remain: (1) setSessions(data) should be setSessions(data.sessions), (2) setEvents(eventsData.events) missing unwrap, (3) WS handler reads message.meta but the server sends message.session.

@archittmittal

Copy link
Copy Markdown
Collaborator Author

Working on the review feedback. Will push fixes shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui/state ci/cd pkg: ui type: bugfix Auto-generated label for type: bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ui): next.config.js contains invalid JavaScript (stray code fence)

2 participants