Bugfix: How to fix 400 Bad Request errors on computer-use goals/sugg...
Documentation for Sessions
🐛 Bugfix: How to fix 400 Bad Request errors on computer-use goals/sugg...
Date: 2026-03-04
Time: 21:29:16 UTC
Session: gspace1-176.5
Agent: backend
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How to fix 400 Bad Request errors on computer-use goals/suggestions, goals/history, and goals/confidence endpoints?
Task: Fix computer-use 400 errors and clean up console noise
🎯 Decision Made
Chosen:
Use @UseGuards(JwtAuthGuard) + @Public() + @CurrentUser() to extract userId from JWT token on the backend, with query param fallback for backward compatibility. Return empty results instead of throwing 400 when userId is missing.
Options Considered:
- No alternatives documented
💭 Reasoning
The frontend's VittoApiService methods (getGoalSuggestions, getGoalHistory, getGoalConfidence) didn't pass userId as a query parameter, but the backend controller required it. The JWT token was already being sent by the auth interceptor, so the cleanest fix was to extract userId from the JWT on the backend using the established @Public() + @CurrentUser() soft-auth pattern (same as sessions.controller.ts). This avoids modifying multiple frontend API methods and is more secure since userId comes from the verified JWT rather than client-supplied query params.
📁 Files Involved
APIs/backend-ai-api/src/app/infrastructure/controllers/computer-use.controller.tslibs/libs-ui/auth-ui/src/lib/interceptors/auth.interceptor.tslibs/libs-ai/vitto-hub/src/lib/components/computer-use-panel/computer-use-panel.component.html
🔗 Related
- Decision ID:
dev_1772659756703_oq21ra4 - Session: 176
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation