Synth Retention

Synth Retention is an Institute main quest in Fallout 4.

Detailed walkthrough
Speak with Father about The Institute, he'll request help dealing with a renegade synth turned raider at Libertalia. There will be a Courser companion at Nahant Wharf who needs to be collected first. Once he is collected, fight along the network of ships until the target is reached. On entering the cabin. X6-88 will initiate conversation and provide Gabriel's recall code.

On reaching the top of the ship Gabriel will initiate conversation, no matter what a fight will break out, but there's a couple of persuasion checks that give extra choices like the password for the Master locked terminal that can open a nearby safe. Once the fight is over X6-88 will teleport out with Gabriel.

If one is quick enough with a weapon with high enough damage (a fully upgraded combat shotgun will do) the player can simply kill Gabriel, much to X6-88's dismay. This option will require extreme speed and luck. Another option to kill Gabriel is to toss two bottlecap mines before ending the dialogue. Use the barrel for cover (tested). Another possible option is to move away from Gabriel, making sure to bring along X6-88 so he doesn't call out the recall code. Yet another option is to switch to VATS right after entering the rooftop and kill Gabriel using Fat Man (you would probably want to use some chems to boost your damage resistance, like Med-X). Moving to the top of the ship, above the terminal and safe to the plank will make them hostile, allowing you to kill Gabriel. This will also trigger different dialogues from many of the Institute scientists and Father.

On returning to the Institute there will be another discussion with Father, he'll provide quarters upon entering them the mission is complete and The Battle of Bunker Hill begins.

Bugs

 * If the quest doesn't update when you visit your quarters you can try to visit Libertalia again.
 * X6-88 may not appear next to your quarters at the Institute, preventing the final objective from being completed. To fix it, fast travel to Libertalia and speak to X6-88. Unfortunately on Xbox One and PS4 this method doesn't always work. To further fix this, he will mostly at all times be located at a small boat directly between Libertalia and Nordhagen Beach. Simply locate him and being shooting him. After he takes some damage, the game will prompt as the quest completed. If you desire to acquire him later on, do not finish him off and instead evade him.
 * For PC gamers you can alternatively, open the console and type "prid 000e210a" followed by "moveto player" while standing in front of your quarters. Close the console and open it again, which will force X6-88 back into his normal routine.
 * X6-88 may get stuck underwater when attempting to attack nearby raiders before being able to speaking to him the first time.
 * This can be fixed by simply entering the captain's quarters at Libertalia, progressing the quest and moving X6-88.
 * After killing Gabriel, the quest description will remain the same as if he was deactivated by the recall code, mentioning the now dead synth being returned to the Institute and the success of the mission.
 * If you manage to kill Gabriel his body can't be selected and looted.
 * Sometimes the game may crash to desktop the closer you get to the Libertalia.