Bugfix: Why was PanelSessionPersistenceService hitting the wrong bac...

Documentation for Sessions

🐛 Bugfix: Why was PanelSessionPersistenceService hitting the wrong bac...

Date: 2026-02-20
Time: 21:39:47 UTC
Session: gspace1-129.8
Agent: angular
Confidence: 100%
Status: ✅ Documented


📋 Decision Context

Question:

Why was PanelSessionPersistenceService hitting the wrong backend for session API calls?

Task: Fix session persistence API URL mismatch


🎯 Decision Made

Chosen:

Changed from API_BASE_URL (@libs-foundational/core-angular) to AI_API_URL (@libs-foundational/api-config)

Options Considered:

  1. Use API_BASE_URL with /ai-api prefix
  2. Use AI_API_URL (correct token for backend-ai-api)

💭 Reasoning

API_BASE_URL resolves to the main backend API at /api (port 3000), but the sessions controller lives on backend-ai-api at /ai-api (port 3001). Every HTTP call (sync, load, history) was silently failing with 404s caught by catchError(() => of(null)). The component's chat call worked because it used AI_API_URL. This mismatch was hidden for months because syncToBackend() was never called automatically. Fix: import AI_API_URL from @libs-foundational/api-config and use ${aiApiUrl}/sessions/... (without /ai-api prefix since AI_API_URL already includes it).


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation