Synth Retention

Synth Retention is an Institute main quest in Fallout 4.

Detailed walkthrough
Speak with Father about the Institute, he will request help dealing with a renegade synth turned raider at Libertalia. There will be a courser companion at Nahant Wharf or the shore northeast of Nordhagen Beach, depending on from which direction the player comes, who needs to be collected first. Once he is collected, fight along with the network of ships until the target is reached. Upon entering the cabin, the courser companion, X6-88 will initiate a conversation and provide Gabriel's recall code.

On reaching the top of the ship Gabriel will initiate conversation, and no matter what, a fight will break out. Using the synth's factory reset code will disable Gabriel and keep the fight limited to a few raiders. There are 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.

The player character can kill Gabriel, much to X6-88's dismay. This will also trigger different dialogues from many of the Institute scientists and Father. Upon returning to the Institute there will be another discussion with Father, and he will provide quarters for the Sole Survivor. Upon entering them, the mission is complete, and the Battle of Bunker Hill begins.

Bugs

 * X6-88 may not appear next to the player's quarters at the Institute, preventing the final objective from being completed.
 * This can be fixed by fast-traveling back to Libertalia, locating X6-88 (he will mostly at all times be located at a small boat directly between Libertalia and Nordhagen Beach), and begin shooting him. After he takes some damage, the game will prompt the quest as completed.
 * Alternatively, open the console and type 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 speak 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 cannot be selected and looted.