fix: improve tmate connection info retrieval

- Add proper wait and retry logic for tmate initialization
- Tmate needs time to connect to servers before showing SSH info
- Try multiple times with delays to get connection details
This commit is contained in:
Andy Lee
2025-08-12 00:42:28 +00:00
parent 101a45a04f
commit ce9ae5f7f9
3 changed files with 22 additions and 5 deletions

View File

@@ -290,10 +290,27 @@ jobs:
fi
# Start tmate session in background
echo "Starting tmate session..."
tmate -S debug-session new-session -d
echo "🔗 Tmate session created. Connection info:"
tmate -S debug-session display -p '#{tmate_ssh}'
echo "🔗 Web session: $(tmate -S debug-session display -p '#{tmate_web}')"
# Wait for tmate to initialize and get connection info
echo "Waiting for tmate to initialize..."
sleep 5
# Try multiple times to get connection info
for i in {1..10}; do
SSH_INFO=$(tmate -S debug-session display -p '#{tmate_ssh}' 2>/dev/null || echo "")
WEB_INFO=$(tmate -S debug-session display -p '#{tmate_web}' 2>/dev/null || echo "")
if [[ -n "$SSH_INFO" && "$SSH_INFO" != "connecting..." ]]; then
echo "🔗 SSH: $SSH_INFO"
echo "🔗 Web: $WEB_INFO"
break
fi
echo "Attempt $i: Still connecting... (SSH: '$SSH_INFO')"
sleep 2
done
echo "⏱️ Session will timeout after 30 minutes"
echo "💡 You can now SSH in and run: pytest tests/ -vv --capture=no"
echo "💡 Or run diagnostics: bash scripts/diagnose_hang.sh"