pub fn spawn_prompt_registration_check(
is_auto: bool,
auto_turn_pending: &mut bool,
in_flight_live: bool,
) -> boolExpand description
Pure decision logic for the spawn_prompt registration re-check (Bug 1 fix).
Models the guard that runs inside the registration lock just before
in_flight is written. Returns true if it is safe to proceed with
registration (caller should write in_flight and clear auto_turn_pending);
returns false if the reservation was revoked by an intervening Abort and
the caller must abort the spawned task (drop start_tx).
Rules (identical to the re-check in spawn_prompt):
- Non-auto prompts (
!is_auto) always returntrue— they are validated byhandle_prompt’sis_busy()check before reaching here. - Auto prompts:
trueiffauto_turn_pending && !in_flight_live. - If returning
false, the helper also defensively clearsauto_turn_pending.
Used by spawn_prompt and by integration tests (not the replica scheduler).