pub struct QuestionResumePrePass;Expand description
Resolves dangling ask_question calls once their answers have arrived
(#1660).
The RESUME half of the question-pause phase — the question-pause SIBLING
of ResumePrePass, not a reuse of it. The pause/emit half (recognizing
a fresh ask_question call and short-circuiting the batch) lives in the
in-loop QUESTION-PAUSE PHASE (run_turn_with) because CollectedTurn/
tool_calls are loop-body locals, not fields on TurnCtx — the same
seam constraint ResumePrePass’s own module doc notes for the approval
gate. This step only ever RESOLVES calls already dangling in the input
transcript.
Atomicity mirrors ResumePrePass: every dangling ask_question call’s
disposition is computed FIRST; if ANY question across ANY of them is
still missing a crate::RunTurnOptions::question_answers entry, the
WHOLE resume re-pauses — UNLESS the dispatch also carries genuinely new
turn input (invariant I8), in which case the whole batch instead gets a
transcript-only “still pending” interim splice and the turn continues
(see the branch below for why: a provider requires every tool_use in
one assistant turn to receive a tool_result together, so a partial
splice — real answers for some calls, nothing for others — would corrupt
the transcript either way, real or interim). Only once every question in
every dangling call has a verified answer does this step build the
durable three-state result JSON (invariant I4) and splice it into both
TurnCtx::messages and TurnCtx::outputs.
Trait Implementations§
Source§impl<P, T> TurnStep<P, T> for QuestionResumePrePass
impl<P, T> TurnStep<P, T> for QuestionResumePrePass
Source§fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 mut TurnCtx<'life2, P, T>,
) -> Pin<Box<dyn Future<Output = Result<StepOutcome, P::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 mut TurnCtx<'life2, P, T>,
) -> Pin<Box<dyn Future<Output = Result<StepOutcome, P::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl Freeze for QuestionResumePrePass
impl RefUnwindSafe for QuestionResumePrePass
impl Send for QuestionResumePrePass
impl Sync for QuestionResumePrePass
impl Unpin for QuestionResumePrePass
impl UnsafeUnpin for QuestionResumePrePass
impl UnwindSafe for QuestionResumePrePass
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more