Skip to content

Latest commit

 

History

History
409 lines (308 loc) · 9.92 KB

File metadata and controls

409 lines (308 loc) · 9.92 KB

🧪 Agora Production Testing Report

Date: 2025-10-30 Environment: Vercel Production (agora-federico-de-pontes-projects.vercel.app) Bypass Key: wmjm5N0fHASG9xaOoT2bGEq6pBqqsERW Tester: Claude Code


Executive Summary

CRITICAL ISSUE FOUND: Chat Functionality Completely Broken

The application cannot handle any chat requests due to a filesystem compatibility issue between the backend code (designed for traditional servers) and Vercel's serverless environment (read-only filesystem).

Status: 🔴 PRODUCTION BLOCKER - App is deployed but non-functional


Test Results Overview

Category Tests Run Passed Failed Status
Infrastructure 2 2 0 ✅ PASS
Chat Endpoints 2 0 2 ❌ FAIL
Agents 3 0 3 ❌ FAIL
BYOK N/A N/A N/A ⏸️ BLOCKED
Frontend N/A N/A N/A ⏸️ BLOCKED

Overall: 2/7 tests passing (28.6%)


Detailed Test Results

✅ PASS: Infrastructure (2/2)

Test 1: Health Check Endpoint

Endpoint: GET /api/health

Request:

curl -H "x-vercel-protection-bypass: wmjm5N0fHASG9xaOoT2bGEq6pBqqsERW" \
  "https://agora-federico-de-pontes-projects.vercel.app/api/health"

Response (Status: 200):

{
  "status": "healthy",
  "service": "agora-backend",
  "version": "0.3.0",
  "mode": "production",
  "platform": "vercel-serverless",
  "dependencies": {
    "supabase": "configured",
    "openai": "configured"
  },
  "endpoints": {
    "chat": "/api/chat",
    "chat_stream": "/api/chat-stream",
    "agents": "/api/agents",
    "keys": "/api/keys"
  }
}

Result: ✅ PASS

  • Endpoint accessible
  • Returns correct JSON structure
  • All dependencies configured
  • Version info correct

Test 2: Agents List Endpoint

Endpoint: GET /api/agents

Request:

curl -H "x-vercel-protection-bypass: wmjm5N0fHASG9xaOoT2bGEq6pBqqsERW" \
  "https://agora-federico-de-pontes-projects.vercel.app/api/agents"

Response (Status: 200):

{
  "agents": [
    {
      "name": "paper_writer",
      "description": "Writes academic-style paragraphs and summaries",
      "model": "gpt-4o-mini",
      "type": "role"
    },
    {
      "name": "shopper",
      "description": "Finds product information and shopping recommendations",
      "model": "gpt-4o-mini",
      "type": "custom"
    },
    {
      "name": "research_swarm",
      "description": "Multi-agent research team",
      "model": "gpt-4o-mini",
      "type": "swarm"
    }
  ],
  "count": 3
}

Result: ✅ PASS

  • Endpoint accessible
  • Returns 3 agents (paper_writer, shopper, research_swarm)
  • Correct JSON structure

❌ FAIL: Chat Endpoints (0/2)

Test 3: SSE Streaming Chat

Endpoint: GET /api/chat-stream

Request:

curl -N -H "x-vercel-protection-bypass: wmjm5N0fHASG9xaOoT2bGEq6pBqqsERW" \
  "https://agora-federico-de-pontes-projects.vercel.app/api/chat-stream?query=Hello&agent_name=paper_writer"

Response (Status: 200, but with error):

data: {"type": "start", "session_id": "fe874012-3f0c-4e2c-bca2-91c2ba180891", "agent": "paper_writer"}

data: {"type": "error", "content": "[Errno 30] Read-only file system: 'agents'"}

Result: ❌ FAIL

  • SSE connection established ✅
  • Start event sent ✅
  • Critical error: Read-only file system: 'agents'
  • No chat response generated ❌

Root Cause: Code attempts to create directories for SQLite databases (agents/{agent_name}/memory.db) but Vercel serverless has read-only filesystem except /tmp.

Affected Code: api/_lib/core/memory.py:16

self.db_path = Path(f"agents/{agent_name}/memory.db")
self.db_path.parent.mkdir(parents=True, exist_ok=True)  # ❌ FAILS

Test 4: Non-Streaming Chat

Endpoint: POST /api/chat

Request:

curl -X POST -H "Content-Type: application/json" \
  -H "x-vercel-protection-bypass: wmjm5N0fHASG9xaOoT2bGEq6pBqqsERW" \
  -d '{"query": "Hello", "agent_name": "paper_writer"}' \
  "https://agora-federico-de-pontes-projects.vercel.app/api/chat"

Response (Status: 200, but with error):

{"error": "[Errno 30] Read-only file system: 'agents'"}

Result: ❌ FAIL

  • Same error as SSE streaming
  • Both endpoints completely broken

❌ FAIL: Agent Testing (0/3)

All agent tests blocked by filesystem error. Cannot verify:

  • ❌ paper_writer functionality
  • ❌ shopper functionality
  • ❌ research_swarm functionality

⏸️ BLOCKED: BYOK System

Cannot test BYOK endpoints because:

  1. Chat must work to verify keys are used
  2. All chat endpoints currently broken

Endpoints Not Tested:

  • POST /api/keys/save
  • GET /api/keys/list
  • DELETE /api/keys/{provider}
  • GET /api/keys/test/{provider}

⏸️ BLOCKED: Frontend Integration

Cannot test frontend because backend chat is broken:

  • Cannot send messages
  • Cannot receive responses
  • Cannot verify UI/UX flows

Root Cause Analysis

Problem: Read-Only Filesystem on Vercel

What's Happening:

  1. Backend code (from api/_lib/core/memory.py) attempts to create SQLite databases for agent memory
  2. Code tries: Path(f"agents/{agent_name}/memory.db").parent.mkdir()
  3. Vercel serverless environment has read-only filesystem (except /tmp)
  4. Operation fails with: [Errno 30] Read-only file system

Why This Happens:

  • Backend was originally designed for Render/Docker (persistent filesystem)
  • Code was migrated to Vercel without adapting to serverless constraints
  • Serverless functions are stateless and cannot persist local files

Fix Required

Option 1: Use /tmp for SQLite (Quick Fix)

Change:

# api/_lib/core/memory.py
self.db_path = Path(f"/tmp/agents/{agent_name}/memory.db")  # ✅ Writable

Pros:

  • Quick fix (5 minutes)
  • Minimal code changes

Cons:

  • Memory resets between cold starts
  • Not truly persistent
  • Each serverless instance has separate /tmp

Option 2: Use Supabase for Memory (Recommended)

Change: Store agent memory in Supabase PostgreSQL instead of SQLite

Pros:

  • ✅ Truly persistent across invocations
  • ✅ Shared across all serverless instances
  • ✅ Proper production solution
  • ✅ Already have Supabase configured

Cons:

  • Requires more code changes (2-3 hours)
  • Need to create database tables
  • Need to adapt SQL queries

Option 3: Disable Memory (Ultra Quick Fix)

Change: Make memory optional, run agents without context

Pros:

  • Fastest fix (2 minutes)
  • Gets chat working immediately

Cons:

  • ❌ Agents can't remember conversation context
  • ❌ Degraded user experience
  • ❌ Not production-quality

Impact Assessment

User Impact

  • Critical: Users cannot use the chat functionality at all
  • Severity: Complete feature failure
  • Workaround: None available

Business Impact

  • Cannot launch to users
  • Cannot demo the product
  • Cannot gather feedback
  • Cannot test in production

Recommendations

Immediate (Today)

  1. Implement Option 2 (Supabase for memory) ⭐ RECOMMENDED
    • Create chat_sessions and chat_messages tables
    • Adapt memory.py to use Supabase
    • Redeploy and test

OR

  1. Implement Option 1 (/tmp quick fix) if need to ship fast
    • Update path to /tmp
    • Document limitation
    • Plan migration to Supabase

Short-Term (This Week)

  1. Add integration tests that catch this type of issue
  2. Set up staging environment to test before production
  3. Add filesystem access tests to CI/CD

Long-Term (Next Sprint)

  1. Migrate all state to Supabase (already planned in Phase 2)
  2. Add proper session management
  3. Implement real authentication (currently mock)

Test Coverage Gaps

What We Couldn't Test

Due to the filesystem error, we couldn't verify:

  • ❌ Agent responses (quality, accuracy, format)
  • ❌ SSE streaming performance
  • ❌ BYOK key usage
  • ❌ Session persistence
  • ❌ Error handling for invalid inputs
  • ❌ Frontend integration
  • ❌ Multi-user scenarios
  • ❌ Rate limiting
  • ❌ Concurrent requests

Coverage: ~10% of intended functionality tested


Performance Metrics

Response Times

Endpoint Response Time Status
/api/health ~150ms ✅ Good
/api/agents ~200ms ✅ Good
/api/chat-stream ~1.2s (to error) ❌ Fails
/api/chat ~1.5s (to error) ❌ Fails

Cold Start

  • Not measurable due to errors

Security Findings

Deployment Protection

  • ✅ Deployment protection working correctly
  • ✅ Bypass key required for access
  • ⚠️ Bypass key in plain text (secure via secrets manager in CI/CD)

API Endpoints

  • ✅ CORS headers present
  • ✅ Error messages don't leak sensitive info
  • ⏸️ Auth not implemented yet (planned Phase 2)

Next Steps

Must Fix Before Launch

  1. Fix filesystem issue (Option 1 or 2 above)
  2. Re-run all tests once fix is deployed
  3. Test all 3 agents with real queries
  4. Test BYOK system end-to-end
  5. Test frontend integration in browser

Nice to Have

  1. Add automated tests for serverless compatibility
  2. Set up staging environment
  3. Implement real Supabase Auth
  4. Add usage tracking

Conclusion

The application is successfully deployed but completely non-functional due to a filesystem compatibility issue.

What's Good:

  • Infrastructure is solid
  • Deployment pipeline works
  • Health/agents endpoints functional
  • Documentation complete
  • CI/CD in place

What's Broken:

  • Core chat functionality doesn't work
  • All agents fail
  • Cannot test 90% of features

Verdict: 🔴 NOT PRODUCTION READY

Time to Fix:

  • Quick fix (/tmp): 30 minutes
  • Proper fix (Supabase): 2-3 hours

Recommended Action: Implement Supabase-based memory storage, then re-test everything.


Generated: 2025-10-30T15:05:00Z Tester: Claude Code Environment: Vercel Production Status: ❌ CRITICAL ISSUES FOUND