Max( ) fails in the stochastic environment?

I defined a variable in dynare, as x= max(1, y) since this variable cannot be beyond 1, say a probability.

Unfortunately, dynare returned me with such a warning,
"WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about “Expressions”, for more details. ".

I didn’t find the solution in the reference manual. My question is how to limit the domain of a variable in dynare in a stochastic context?

In the stochastic context (except for extended path), the model must be differentiable. max operators introduce non-differentiabilities and will (mostly) be ignored. You can try to limit domains using transformations like:
for parameters with support [LB Inf): LB+exp(x) (inverse transformation of log(x-LB))
for parameters with support [LB UB]: (UB+exp(x)*LB)./(1+exp(x)) (inverse tranformation of log((UB-x)./(x-LB)))

However, a first order approximation will always approximate this linearly, i.e. in an unbounded way.

Thank you.

It is the IRFs that bother me. I can see that both the transformation and max ( ) work at the steady state, but fail at the IRFs. The response moved over the boundaries.

Just to clarify, does it fail only for first order approximation or for higher orders as well? Actually, I used 2nd order approximation.

Kinks cannot be smoothly approximated at all.
Any boundary will be violated with some probability for derivative-based approximations. There is no way to avoid this, even for nth-order approximations.