Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

refactor: move decision listener URL from build-time env var to runtime config#6

Open
agrogov wants to merge 1 commit into
Vexa-ai:llm-listenerfrom
agrogov:decision-listener-url-runtime-config
Open

refactor: move decision listener URL from build-time env var to runtime config#6
agrogov wants to merge 1 commit into
Vexa-ai:llm-listenerfrom
agrogov:decision-listener-url-runtime-config

Conversation

@agrogov
Copy link
Copy Markdown

@agrogov agrogov commented Mar 6, 2026

Replaces the hard-coded NEXT_PUBLIC_DECISION_LISTENER_URL environment variable usage across all components with the centralized runtime config system (useRuntimeConfig hook). This ensures the decision listener URL is fetched from the server at runtime (via /api/config) rather than baked in at build time, consistent with how wsUrl and apiUrl are already handled.

Changes

src/app/api/config/route.ts

  • Added decisionListenerUrl to the runtime config API response, sourced from NEXT_PUBLIC_DECISION_LISTENER_URL env var (defaults to http://localhost:8765).

src/hooks/use-runtime-config.ts

  • Added decisionListenerUrl field to the RuntimeConfig interface.
  • Added getDecisionListenerUrl() synchronous helper (mirrors existing getWsUrl() / getApiUrl() pattern).

src/app/tracker/page.tsx

  • Removed local DECISION_LISTENER_URL constant.
  • Uses useRuntimeConfig() hook to obtain the URL at runtime.
  • Guards fetchConfig with isRuntimeConfigLoading to avoid fetching before the URL is available.
  • Updated useCallback dependency arrays accordingly.

src/components/anthology/entity-chip.tsx

  • Removed local DECISION_LISTENER_URL constant.
  • Uses useRuntimeConfig() hook; derives decisionListenerUrl from config.
  • Updated enrichment SSE URL construction and useCallback deps.

src/components/anthology/meeting-anthology.tsx

  • Removed local DECISION_LISTENER_URL constant.
  • Uses useRuntimeConfig() hook for decision listener URL.
  • Updated all fetch/SSE calls and dependency arrays (load, connectSSE, fetchSummary).

src/components/decisions/decisions-panel.tsx

  • Removed local DECISION_LISTENER_URL constant.
  • Uses useRuntimeConfig() hook for decision listener URL.
  • Updated SSE connection and history-load fetch calls and dependency arrays.

Motivation

  • Consistency: All external service URLs now flow through the same runtime config mechanism.
  • Deployability: The decision listener URL can be changed per-environment without rebuilding the frontend.
  • Single source of truth: Eliminates 4 duplicate DECISION_LISTENER_URL constants scattered across components.

Files Changed (6)

File Change
src/app/api/config/route.ts Expose decisionListenerUrl in config API
src/hooks/use-runtime-config.ts Add field + sync getter
src/app/tracker/page.tsx Use runtime config hook
src/components/anthology/entity-chip.tsx Use runtime config hook
src/components/anthology/meeting-anthology.tsx Use runtime config hook
src/components/decisions/decisions-panel.tsx Use runtime config hook

Test Plan

  • Verify /api/config response includes decisionListenerUrl
  • Verify tracker page loads config from the listener using the runtime URL
  • Verify entity chip enrichment SSE connects to the correct URL
  • Verify meeting anthology SSE and summary fetch use the correct URL
  • Verify decisions panel SSE and history load use the correct URL
  • Verify fallback to http://localhost:8765 works when env var is not set

…me config

Replaces the hard-coded `NEXT_PUBLIC_DECISION_LISTENER_URL` environment variable usage across all components with the centralized runtime config system (`useRuntimeConfig` hook). This ensures the decision listener URL is fetched from the server at runtime (via `/api/config`) rather than baked in at build time, consistent with how `wsUrl` and `apiUrl` are already handled.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c399f1388d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


export function DecisionsPanel({ meetingId, isActive, embedded }: DecisionsPanelProps) {
const { config } = useRuntimeConfig();
const decisionListenerUrl = config?.decisionListenerUrl ?? "http://localhost:8765";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Block panel network calls until runtime config loads

Because useRuntimeConfig() starts with config === null on cold loads, this fallback URL is always used on first render; the panel then immediately runs its history fetch and SSE connect against http://localhost:8765 before /api/config resolves. In environments where the real listener URL is not localhost, users will make wrong-host requests (to their own machine) and can see flaky initial panel state; this should be gated on runtime-config readiness the same way tracker/page.tsx does.

Useful? React with 👍 / 👎.

participants,
}: MeetingAnthologyProps) {
const { config } = useRuntimeConfig();
const decisionListenerUrl = config?.decisionListenerUrl ?? "http://localhost:8765";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Block anthology network calls until runtime config loads

This fallback causes MeetingAnthology to hit http://localhost:8765 during the first render while runtime config is still loading, and its effects then start /decisions/.../all, SSE, and summary traffic against that wrong host before switching later. When the configured listener URL differs from localhost, this creates deterministic bad requests and transiently incorrect/empty data; the effects should wait until runtime config is resolved.

Useful? React with 👍 / 👎.

@DmitriyG228
Copy link
Copy Markdown
Collaborator

Hey! This repo has been archived — the dashboard has moved to the monorepo at https://github.com/Vexa-ai/vexa under services/dashboard/.

We're pulling your changes into the monorepo now to preserve your commits. Future PRs should be submitted to https://github.com/Vexa-ai/vexa. Thanks for the contribution!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants