Bugfix: Dashboard-stats endpoint returns cross-workspace data — how ...

Documentation for Sessions

🐛 Bugfix: Dashboard-stats endpoint returns cross-workspace data — how ...

Date: 2026-02-05
Time: 19:27:24 UTC
Session: editor2-92.9
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

Dashboard-stats endpoint returns cross-workspace data — how to fix?

Task: Session 92 - Fix dashboard-stats workspace filter


🎯 Decision Made

Chosen:

Added { workspace } filter to all 4 decision queries (aggregate distribution, aggregate outcomes, countDocuments, find recent)

Options Considered:


💭 Reasoning

The endpoint accepted a workspace query param and used it for agents and handoffs, but all decision queries were unfiltered — returning data from ALL workspaces. This is a data isolation bug. The Decision schema has a workspace field (line 289 of ai-infrastructure.schema.ts) so filtering is trivial.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation