Quick Recovery - Codev OpenCode PVC Implementation

Copy-paste this into new session if context is lost


🎯 What Was I Doing?

Implementing OpenCode PVC persistence and plugin auto-init for codev in k8s-lab.

PR: https://github.com/craigedmunds/k8s-lab/pull/23
Branch: feat/opencode-plugin-auto-init


✅ Quick Status Check

# 1. Check PR status
gh pr view 23 --repo craigedmunds/k8s-lab
 
# 2. Check if deployment is updated
kubectl get deployment codev -n code-server -o jsonpath='{.spec.template.spec.containers[0].volumeMounts}' | jq '.[] | select(.name=="opencode-state")'
 
# 3. Run tests
cd /home/coder/src/repos/k8s-lab/components/remote-development/codev
python3 test_pvc_acceptance.py

📋 What Should Happen

After PR merge + ArgoCD sync:

  1. Plugin auto-loads from /home/coder/src/repos/ai-dev/plugins/opencode-bridge
  2. PVC mounted at /home/coder/.local (not .local/share/opencode)
  3. All 11 tests pass (5 for Story 1.5, 6 for Story 1.6)

🔧 Quick Fixes

Plugin Not Found

kubectl exec -n code-server deployment/codev -- \
  test -d /home/coder/src/repos/ai-dev/plugins/opencode-bridge && \
  echo "✅ Exists" || echo "❌ Missing - clone ai-dev repo"

Tests Fail

# Check logs
kubectl logs -n code-server deployment/codev --tail=50 | grep -E "plugin|Bridge"
 
# Restart pod
kubectl rollout restart -n code-server deployment/codev

Need Full Context

Read: /home/coder/src/.ai/projects/infrastructure/codev-opencode-pvc/session-recovery.md


🎯 Success = All Green

✓ Story 1.5 - AC1: PVC mounted at /home/coder/.local
✓ Story 1.5 - AC2: Auth tokens persist in auth.json
✓ Story 1.5 - AC3: Session metadata persists
✓ Story 1.5 - AC4: Message history persists
✓ Story 1.5 - AC5: PVC mount configured correctly
✓ Story 1.6 - AC1: Plugin auto-discovered
✓ Story 1.6 - AC2: Plugin symlinked
✓ Story 1.6 - AC3: Plugin doesn't require Docker rebuild
✓ Story 1.6 - AC4: npm dependencies auto-installed
✓ Story 1.6 - AC5: Graceful degradation
✓ Story 1.6 - AC6: Plugin auto-built