Force unwind unconditionally resets position state to Opened, discarding user's prior CloseRequested intent
finalizeForceUnwind always reverts non-terminal positions to Opened, silently discarding any prior CloseRequested intent and forcing the user to re-signal after every unwind cycle.
Description
When finalizeForceUnwind completes a non-terminal unwind, it unconditionally resets the position state to Opened:
// LeveragedPredictionVaultV1.sol:L1487-1488positionStates[positionKey] =currentState == Types.PositionState.UnwindPending ? Types.PositionState.Opened : currentState;
At finalization time, currentState is always UnwindPending (set by forceUnwind), so the ternary always evaluates to Opened. If the position was in CloseRequested before the unwind was initiated, that state is silently discarded. There is no mechanism to preserve or restore it through the unwind cycle.
The user must discover off-chain that their close request was dropped and re-submit requestClose. In a multi-unwind scenario, this can happen repeatedly, each unwind cycle erases the close intent, requiring the user to re-signal after every cycle with no on-chain notification.
Recommendation
Store the pre-unwind state before transitioning to UnwindPending and restore it after finalization. For example, add a preUnwindState field to the position struct:
// In forceUnwind:position.preUnwindState = currentState; // save CloseRequested or Opened// In finalizeForceUnwind:positionStates[positionKey] =currentState == Types.PositionState.UnwindPending ? position.preUnwindState : currentState;
This ensures a user's close intent survives unwind cycles without requiring them to re-signal.
Resolution
Fixed. New preUnwindState field records pre-unwind state; non-terminal finalizeForceUnwind restores it.

