The Battle of Bunker Hill

The Battle of Bunker Hill is a quest in Fallout 4.

Quick walkthrough
Father wants you to go with a Courser to Bunker Hill and teleport back some escaped synths. If you warn The Railroad they want you to kill the Courser and leave the area. If you warn the Brotherhood of Steel they want you to kill the escaped synths.

Detailed walkthrough
Father wants you to go to Bunker Hill to send some escaped synths back inside The Institute. You will meet up with Courser X4-18 who is going to teleport them back. Bunker Hill is under protection of The Railroad, a group of people who help runaway synths. You can optionally inform Desdemona that the Institute are coming to get their synths back, that way they are prepared. You can also optionally inform Elder Maxson about the attack. If you have talked to both Desdemona and Maxson, X4-18 will be suspicious of your lateness, causing it to call for backup.

When the battle starts, and if you were to report the Battle to either the Brotherhood or the Railroad, a large firefight will erupt in and around the settlement. The main doorway into the settlement is locked, requiring the Sole Survivor to walk around and head to the right-side of the settlement where an opened door can be found. The inhabitants of Bunker Hill will cower during this firefight, and will most likely not get killed by either the Synths, Brotherhood or the Railroad.

Once inside Bunker Hill, there should be a small doorway into a basement where you will find the runaway synths Z3-22, B2-57, Y9-15 and F6-33. Should X4-18 still be with you once you've reached the synths, you've got the choice to let them go, or capture them. Choosing the former will force X4-18 to go hostile. A new objective will be added where you are to talk to Father in the roof of the ruins of C.I.T. There you will have to talk to Father and explain your actions at Bunker Hill. From here, you have a choice to choose if you want to still be a part of the Institute.

Behind the scenes
The title of this quest is a reference to the historical Battle of Bunker Hill, an important conflict of the American Revolutionary War occurring near Bunker Hill in 1775.

Bugs

 * None of the faction NPCs will be hostile to the player, even upon attacking them
 * This can be exploited for easy EXP as there are no repercussions.
 * If you join the Brotherhood of Steel after starting this quest, the optional quest stage to inform them will not appear.
 * Verified. However, the quest will proceed as if the Sole Survivor had informed the Brotherhood, and they will take part in the battle.
 * Verified. Additionally the same situation is true for the Railroad.
 * The front gate will be locked once the battle starts, and will remain locked for the duration of the game unless the player clears out all the turrets inside the hideout, where the four synths are kept. All turrets must be destroyed while this quest is still active since they become invincible once the quest is completed. This bug and its workaround applies no matter which faction the player supports.
 * Should Doc Weathers and his Caravan guards be in the area, they will be hostile to all faction members, be aware that Doc Weathers dresses in a lab coat.
 * After completing the quest, the characters living in Bunker Hill can be stuck crouching in a cowering position, although they can still be interacted with and talked to. Leaving the area and continuing the quest line seems to fix this.
 * After informing The Brotherhood (and possibly The Railroad, needs verification), killing the courser before meeting the synths can break the quest, causing the synths to think they're being freed by the Railroad (even if you've destroyed the Railroad). Killing them when you do meet them and you've already killed the courser will result in a 'kill the courser' objective (which is impossible seeing as he's already dead), and 'Speak with Father' objective (note: not to be confused with 'speak with Father in the C.I.T. ruins'), and a quest marker inside The Institute, which disappears when you're inside The Institute, and Father is no-where to be found.
 * If you talk to Desdemona after arriving at the Institute and are also sided with the Minutemen, you will be unable to warn her about the attack until you say you will side with the Railroad. Wehenver you try to talk to her, Desdemona will ask you to work with the Railroad instead of the Minutemen, giving you no chance to tell her about the threat to the Synths on Bunker Hill. There doesn't seem to be a way to warn the Railroad without entering Underground Undercover.
 * All Railroad members will become hostile to the synths once you have killed the courser.
 * Game Will freeze when near the CIT Ruins, when you're going to talk to Father. Has been fixed as of Patch 1.2.
 * One or more of the factions will inexplicably become hostile toward the inhabitants of bunker hill, prompting such confusing scenes as a railroad heavy repeatedly firing his weapon at an unarmed and cowering child.