# Next Session: Fix Audio Pipeline & SER Sidecar Startup

**Priority:** HIGH — voice pipeline is broken without these
**Parallel session:** Can run independently of Google Maps and WhatsApp sessions
**Estimated effort:** 30-60 minutes (diagnosis + fix + verify)

## Problem

The audio pipeline (`her-os-audio`) and SER sidecar (`her-os-ser`) didn't start during session 13 deployment — their `run.sh` hung when called via `start.sh` over SSH. Annie's text channels (Telegram, WhatsApp, dashboard) work without them, but **voice is broken** (no STT, no speaker verification, no emotion recognition).

## Architecture Reminder

```
Voice call (WebRTC/phone)
  → her-os-audio (port 9100) — WhisperX STT + pyannote diarization
      → her-os-ser (port 9101) — emotion2vec+ large + audeering wav2vec2 (~1.26 GB VRAM)
  → Annie voice (port 7860) — Pipecat pipeline
```

Both containers run on Docker bridge network `her-os-audio-net`. SER is reached via Docker DNS (`http://her-os-ser:9101`).

## Diagnosis Steps

1. **SSH to Titan and check what's there:**
   ```bash
   ssh titan
   docker ps -a | grep -E 'audio|ser'   # Are containers exited? Missing entirely?
   docker network ls | grep audio-net    # Does the bridge network exist?
   ss -tlnp | grep -E '9100|9101'       # Are ports in use by something else?
   ```

2. **Try manual start and watch output:**
   ```bash
   cd ~/workplace/her/her-os/services/audio-pipeline
   ./run.sh   # Watch — does it hang? Error? Build?
   ```

3. **Common failure modes:**
   - Docker image rebuild triggered (takes 10-20 min if Dockerfile changed)
   - Port conflict from zombie container (`docker rm -f her-os-audio her-os-ser`)
   - Bridge network `her-os-audio-net` missing (`docker network create her-os-audio-net`)
   - GPU allocation conflict (SER needs ~1.26 GB VRAM — check with `nvidia-smi`)
   - Stale `__pycache__` (clear with `find . -name '__pycache__' -exec rm -rf {} +`)

4. **Check Docker logs if containers exited:**
   ```bash
   docker logs her-os-audio 2>&1 | tail -30
   docker logs her-os-ser 2>&1 | tail -30
   ```

## Context Files
- `memory/feedback_use_start_stop_sh.md` — normally start.sh handles everything, but it hung on the audio-pipeline SSH step
- `services/audio-pipeline/run.sh` — the script that hung
- `services/audio-pipeline/docker-compose.yml` — container definitions
- ADR-020 in `docs/PROJECT.md` — Docker bridge network architecture (fixes 31+ restart crash-loop from port TIME_WAIT conflicts)

## Fix & Verify

After fixing, verify all three:
```bash
# 1. Containers running
docker ps | grep -E 'audio|ser'
# Should show: her-os-audio Up, her-os-ser Up

# 2. Health endpoints
curl http://localhost:9100/health   # Audio pipeline
curl http://localhost:9101/health   # SER sidecar

# 3. GPU VRAM
nvidia-smi | grep -A2 "MiB"
# SER should be using ~1.26 GB

# 4. Full voice test (if WebRTC client available)
# Or test via audio pipeline API:
# curl -X POST http://localhost:9100/v1/transcribe -F "audio=@test.wav"
```

## If run.sh Needs Debugging

The `run.sh` script likely does:
1. `docker compose build` (if Dockerfile changed — this is the slow step)
2. `docker compose up -d`
3. Wait for health check

If step 1 hangs, check if a Docker build is running: `docker ps -a --filter "status=created"`. If the image is already built, skip rebuild: `docker compose up -d --no-build`.
