Unstable model with output gap

Hello everyone,
I have a rather odd problem - my model fluctuates between running perfectly and failing Blanchard-Kahn conditions for no apparent (hopefully only to me) reason.
I am modeling a fairly standard open DSGE economy with a monetary policy that follows a Taylor Rule (inflation and output gap). I want to model the output gap as a deviation of output from its flexible price level. To do this, I wrote a model that is basically double in size - half the variables evolve in a sticky price environment, and the other half (of the same variables) evolve in a flexible price environment. The two halves do not interact or overlap - except for the definition of output gap in one of the monetary rules.
Taken independently, the sticky and the flexible price models are running fine for all specifications of parameters that I care about. Taken together, i.e., when the “sticky” central bank responds to the “sticky”-“flexible” gap, the model fails to satisfy B-K conditions sometimes - with no discernible pattern of when it fails and when it doesn’t. In those times, the two economies have different steady states - even though they clearly shouldn’t, since price stickiness doesn’t affect steady state.
I am certain there are no typos, and I am wondering if anybody has encountered a similar issue.
I am more than happy to provide additional info if the above explanation isn’t clear, and also to supply the Dynare code.
Thank you for your time and help!
Olena

Please post your MOD file, it’s hard to help without that.

Best

Dear Sébastien,
I am attaching two .mod files (Dynare version 4.0.3)
I am modeling an economy with a housing construction sector that can suffer from delays between the commencement and completion of a project.
The following 4 lags are hard-coded: 0, 1, 4 and 8 periods. Only one of them is uncommented at a time.
Unfortunately, the uncommenting must be done in the following 4 sections: Construction, Flex construction, Market clearing, and Flex market clearing.
In the first file (Gap4.mod) the 4-period delay is uncommented. In the other file (Gap8.mod), the 8-period delay is uncommented.
There is no other difference between the files - I am attaching both for your convenience.
One of them (4-period) runs, while the other doesn’t. It seems that in Gap8, the steady states of the flexible and sticky economies do not coincide, even though the steady state equations are completely independent of the construction lag length.
Thank you very much for your time, and please let me know if more explanation is needed.
Olena
Gap8.mod (29.1 KB)
Gap4.mod (29.1 KB)