# Automated Demo System Troubleshooting

## Common Issues

### Tool Forwarder Not Receiving Function Calls

**Symptoms**: Tavus calls function but slides don't appear

**Diagnosis**:
1. Check Railway logs: `railway logs --service slide-system | grep tool-forwarder`
2. Verify bot joined Daily.co room: Check active participants
3. Check Supabase: `SELECT * FROM active_bots WHERE bot_type='tool_forwarder'`

**Fix**:
- Restart tool forwarder: `POST /api/bots/tool-forwarder/kill/:bot_id` then respawn
- Verify WebSocket connection in bot logs
- Check Tavus function call payload format

### Deck Generation Timeout

**Symptoms**: Loading state persists >60 seconds

**Diagnosis**:
1. Check Railway API logs: `railway logs | grep "slidev/generate"`
2. Verify GitHub Pages build status
3. Check Supabase deck metadata

**Fix**:
- Use default deck: Set `use_default_deck: true` in function call
- Increase timeout in demo UI
- Verify Railway API health: `GET /api/health`

### Screenshare Bot Doesn't Spawn

**Symptoms**: Deck generated but slides don't appear

**Diagnosis**:
1. Check bot spawn logs: `railway logs | grep screenshare-bot`
2. Verify deck URL accessible: `curl [deck-url]`
3. Check Supabase: `SELECT * FROM active_bots WHERE bot_type='screenshare'`

**Fix**:
- Manually spawn: `POST /api/bots/screenshare/spawn` with deck URL
- Verify Python dependencies installed
- Check Daily.co room capacity

### Presentation Mode Not Activating

**Symptoms**: Slides appear but layout doesn't switch

**Diagnosis**:
1. Check browser console for errors
2. Verify screenshare participant detected: `useParticipants()`
3. Check `useScreenVideoTrack()` hook state

**Fix**:
- Refresh demo UI
- Verify `<Conversation>` component updated (Task #003)
- Check participant user_name includes 'screenshare-bot'

## Performance Optimization

### Reduce Discovery Duration

- Update Tavus prompt: Make greeting shorter
- Reduce conversation depth: Skip clarifying questions
- Call `generate_custom_deck()` earlier

### Speed Up Deck Generation

- Use default deck: `use_default_deck: true`
- Pre-build common decks and cache
- Optimize Slidev build process

### Faster Bot Spawn

- Keep warm bot instances (future)
- Optimize Python startup (reduce dependencies)
- Use Railway's faster instance types
