Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: resolve AI providers status route shadowed by toolkit's /:id route
Adam Eivya3be66b8c17a
diff --git a/.changelog/v0.11.x.md b/.changelog/v0.11.x.mdindex 542678cf88..d4089bb48e 100644--- a/.changelog/v0.11.x.md+++ b/.changelog/v0.11.x.md@@ -98,6 +98,11 @@ This release focuses on security improvements, bug fixes for the AI runner syste- **Reduced log noise**: Empty enhancement results log a warning instead of surfacing as route errors- **Client unchanged**: The client already handled enhancement failures gracefully; this fix prevents unnecessary error noise server-side+### AI Providers Status Unreachable on Health Page+- **Route shadowing fix**: The `/api/providers/status` endpoint was being intercepted by the AI toolkit's `GET /:id` route (treating "status" as a provider ID), returning "Provider not found" instead of the actual status data+- **Root cause**: PortOS mounted the toolkit's parameterized routes before its own `/status` route, so Express matched the toolkit's `/:id` first+- **Fix**: Reordered route registration so PortOS-specific routes (including `/status`) are defined before mounting the toolkit's catch-all routes+### Quick Enrich Skip Returns Same Question- **Skip now advances to a different question**: Clicking "Skip" on Quick Enrich prompts (both in the overview banner and the full EnrichTab) previously returned the exact same question, because question selection was deterministic based on `questionsAnswered` count which skip didn't increment- **Client tracks skipped indices**: Both NextActionBanner and EnrichTab now maintain a `skippedIndices` list for the current session, passing it to the server so it can serve the next non-skipped questiondiff --git a/server/routes/providers.js b/server/routes/providers.jsindex a9a4d59f6b..d70d7d51cb 100644--- a/server/routes/providers.js+++ b/server/routes/providers.js@@ -10,16 +10,40 @@ import { getAllProviderStatuses, getProviderStatus, markProviderAvailable, getTiexport function createPortOSProviderRoutes(aiToolkit) {const router = Router();- // Mount all base toolkit routes- router.use('/', aiToolkit.routes.providers);+ // Provider status routes MUST be defined before toolkit routes,+ // because the toolkit has a GET /:id route that would catch /status+ router.get('/status', asyncHandler(async (req, res) => {+ const statuses = getAllProviderStatuses();+ // Enrich with time until recovery+ const enriched = { ...statuses };+ for (const [providerId, status] of Object.entries(enriched.providers)) {+ enriched.providers[providerId] = {+ ...status,+ timeUntilRecovery: getTimeUntilRecovery(providerId)+ };+ }+ res.json(enriched);+ }));++ router.get('/:id/status', asyncHandler(async (req, res) => {+ const status = getProviderStatus(req.params.id);+ res.json({+ ...status,+ timeUntilRecovery: getTimeUntilRecovery(req.params.id)+ });+ }));++ router.post('/:id/status/recover', asyncHandler(async (req, res) => {+ const status = await markProviderAvailable(req.params.id);+ res.json({ success: true, status });+ }));- // PortOS-specific extension: Vision health check+ // PortOS-specific extensions (parameterized routes before toolkit mount)router.get('/:id/vision-health', asyncHandler(async (req, res) => {const result = await checkVisionHealth(req.params.id);res.json(result);}));- // PortOS-specific extension: Test vision with specific imagerouter.post('/:id/test-vision', asyncHandler(async (req, res) => {const { imagePath, prompt, expectedContent, model } = req.body;@@ -38,41 +62,14 @@ export function createPortOSProviderRoutes(aiToolkit) {res.json(result);}));- // PortOS-specific extension: Run full vision test suiterouter.post('/:id/vision-suite', asyncHandler(async (req, res) => {const { model } = req.body;const result = await runVisionTestSuite(req.params.id, model);res.json(result);}));- // Provider status: Get all provider statuses (usage limits, availability)- router.get('/status', asyncHandler(async (req, res) => {- const statuses = getAllProviderStatuses();- // Enrich with time until recovery- const enriched = { ...statuses };- for (const [providerId, status] of Object.entries(enriched.providers)) {- enriched.providers[providerId] = {- ...status,- timeUntilRecovery: getTimeUntilRecovery(providerId)- };- }- res.json(enriched);- }));-- // Provider status: Get single provider status- router.get('/:id/status', asyncHandler(async (req, res) => {- const status = getProviderStatus(req.params.id);- res.json({- ...status,- timeUntilRecovery: getTimeUntilRecovery(req.params.id)- });- }));-- // Provider status: Manually mark provider as available (recovery)- router.post('/:id/status/recover', asyncHandler(async (req, res) => {- const status = await markProviderAvailable(req.params.id);- res.json({ success: true, status });- }));+ // Mount base toolkit routes last (its /:id route would shadow our /status route)+ router.use('/', aiToolkit.routes.providers);return router;}