Bugfix: Why did VFS module loading from GitLab return 401?

Documentation for Sessions

🐛 Bugfix: Why did VFS module loading from GitLab return 401?

Date: 2026-03-15
Time: 23:14:03 UTC
Session: gspace1-224.8
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

Why did VFS module loading from GitLab return 401?

Task: Fix VFS module loading 401 error


🎯 Decision Made

Chosen:

Created GitProviderController on backend-api exposing GitLabProviderService as REST endpoints at /api/git-provider/repos/:repoPath/(tree|file|files|branches). The endpoint simply didn't exist.

Options Considered:

  1. Fix auth interceptor (wrong diagnosis)
  2. Create REST controller on backend-api (chosen — correct root cause)
  3. Change ai-api to inject service directly (cross-API boundary violation)

💭 Reasoning

Root cause: StudioRepoController on backend-ai-api (port 3001) proxies HTTP requests to backend-api (port 3000) at /api/git-provider/repos/{repoPath}/* endpoints. But GitLabProviderService was only an injectable NestJS service — no controller exposed it as REST. Previous S224 session misdiagnosed as 'auth token not sent to ai-api port 3001' — the auth interceptor works correctly for all requests. The actual failure was HTTP 401/404 because the endpoint didn't exist on backend-api, not because of missing auth headers. Fix: created GitProviderController with 4 endpoints (tree, file, files, branches) delegating to GitLabProviderService. Also added listFilesRecursive() method since existing listFiles had recursive=false hardcoded.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation