What tense should I use after "to ensure" clause? [closed]

It depends what you want the sentence to mean. Note: Your examples aren't complete sentences - I'll add a subject.

All the following are correct but they have different meanings:

John debugged the code to ensure the game works properly. e.g. John worked all day yesterday and debugged the code so that it works properly today.

John will debug the code to ensure the game works properly. e.g. John will debug the code tomorrow to ensure the game works in time for next week's demonstration

John debugged the code to ensure the game worked properly.

e.g. In 1990, John debugged the code to ensure that it worked in time for the release date in January 1991.

John has debugged the code to ensure the game will work properly. e.g. After working through the weekend, John has finally debugged the code to ensure it will work properly when the manager comes to see a demo tomorrow.