1. Move session detection BEFORE checking if fork process is still running. Previous code broke out of loop if forked process exited, skipping detection. 2. Add database query debugging when detection fails to help diagnose why opencode session list might miss newly created sessions.