Here's the move (I only play CSA vs AI in Apr '61 campaign):
First turn move Winchester militia to Harper's Ferry, usually take it. Send bulk of forces used at Sumter on thier way to Harper's Ferry
Second turn send a new 1 star to Harper's Ferry
Third turn send a supply unit to Harper's Ferry
Once the Reserve Bde in Richmond activates, send it as well. I'm essentially trying to build a 18K - 20K division to hold Harper's Ferry
This has worked OK for me in the past and I can often hold Harper's Ferry at least through most of '61.
The problem I'm running into now is when the Union attacks Harper's Ferry, which it can do from turn 3 on. What I'm seeing is my units will win the battle but end up set to passive after the turn and have retreated. This has even happened in Winchester with the Shenandoah force with Johnston's stack set to passive and retreating.
What causes a unit to retreat after winning a battle? In my latest game I had Ruggles in Harper's Ferry with the militia. They were outside the city and set to defend. They were attacked in Day 4 by a small union force which they bested. After the turn is over, Ruggles is in Winchester set to passive and the Union controls Harper's Ferry. To make it worse, my supply wagon arrives after the retreat and is lost

Anyone else seen this or can let me know what I'm doing wrong? I'm running 1.09,
Here's some pics to demonstrate.
Here's the battle report:
Here's the status after the turn resolves:
and here's the lines from the logs about the battle and moves: