session_sequences table fell behind when sessions were inserted with
explicit session_number (e.g., retro imports), causing duplicate key
violations on next auto-assigned number. Function now syncs forward
by checking MAX(session_number) before assigning.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>