pub struct RecordingLlmClient { /* private fields */ }Expand description
A transparent LlmClientTrait that records each turn into a shared transcript.
Why: Captures the conversation for the run report without modifying the agent
loop. Wrapping the shared client means PM and engineer turns land in one
ordered transcript while usage still accrues on the inner client.
What: Forwards chat to the inner client, then appends a TurnRecord tagged
with this wrapper’s role and the request’s model. A poisoned transcript
lock is treated as a no-op record (the run must not panic mid-flight).
Test: run_task::tests::end_to_end_pm_delegates_to_engineer.
Implementations§
Source§impl RecordingLlmClient
impl RecordingLlmClient
Sourcepub fn new(
inner: Arc<dyn LlmClientTrait>,
role: impl Into<String>,
transcript: SharedTranscript,
) -> Self
pub fn new( inner: Arc<dyn LlmClientTrait>, role: impl Into<String>, transcript: SharedTranscript, ) -> Self
Wrap inner, tagging recorded turns with role.
Why: Each agent (PM, engineer) needs its own labelled recorder sharing the
same transcript sink so the report can distinguish their turns.
What: Stores the inner client, the role label, and the shared transcript.
Test: run_task::tests::end_to_end_pm_delegates_to_engineer.
Trait Implementations§
Source§impl LlmClientTrait for RecordingLlmClient
impl LlmClientTrait for RecordingLlmClient
Source§fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Forward the chat call and record the resulting turn.
Why: The transcript must reflect exactly what the model returned; recording
after the call (on success) keeps the report faithful and never fabricates
turns for failed requests.
What: Calls the inner client; on Ok, appends a TurnRecord with the
RESOLVED model slug (#1475 bug 2 — resp.resolved_model(&req.model),
which prefers the provider-reported model and falls back to the
requested slug when the response omits one), the response’s first
text, and its tool-call names; returns the response unchanged. Errors
propagate untouched (and are not recorded).
Test: run_task::tests::end_to_end_pm_delegates_to_engineer,
run_task::tests::transcript_records_resolved_model_not_requested_slug.
Auto Trait Implementations§
impl !RefUnwindSafe for RecordingLlmClient
impl !UnwindSafe for RecordingLlmClient
impl Freeze for RecordingLlmClient
impl Send for RecordingLlmClient
impl Sync for RecordingLlmClient
impl Unpin for RecordingLlmClient
impl UnsafeUnpin for RecordingLlmClient
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
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