mirror of
https://github.com/openai/codex.git
synced 2026-05-19 18:52:57 +00:00
Fix compact client clippy failure
This commit is contained in:
@@ -202,6 +202,11 @@ pub struct ModelClient {
|
||||
state: Arc<ModelClientState>,
|
||||
}
|
||||
|
||||
pub(crate) struct CompactConversationOptions<'a> {
|
||||
pub(crate) mode: Option<&'static str>,
|
||||
pub(crate) compaction_trace: &'a CompactionTraceContext,
|
||||
}
|
||||
|
||||
/// A turn-scoped streaming session created from a [`ModelClient`].
|
||||
///
|
||||
/// The session establishes a Responses WebSocket connection lazily and reuses it across multiple
|
||||
@@ -409,15 +414,14 @@ impl ModelClient {
|
||||
///
|
||||
/// The model selection and telemetry context are passed explicitly to keep `ModelClient`
|
||||
/// session-scoped.
|
||||
pub async fn compact_conversation_history(
|
||||
pub(crate) async fn compact_conversation_history(
|
||||
&self,
|
||||
prompt: &Prompt,
|
||||
model_info: &ModelInfo,
|
||||
effort: Option<ReasoningEffortConfig>,
|
||||
summary: ReasoningSummaryConfig,
|
||||
session_telemetry: &SessionTelemetry,
|
||||
mode: Option<&'static str>,
|
||||
compaction_trace: &CompactionTraceContext,
|
||||
options: CompactConversationOptions<'_>,
|
||||
) -> Result<Vec<ResponseItem>> {
|
||||
if prompt.input.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
@@ -466,7 +470,7 @@ impl ModelClient {
|
||||
parallel_tool_calls: prompt.parallel_tool_calls,
|
||||
reasoning,
|
||||
text,
|
||||
mode,
|
||||
mode: options.mode,
|
||||
};
|
||||
|
||||
let mut extra_headers = ApiHeaderMap::new();
|
||||
@@ -477,7 +481,7 @@ impl ModelClient {
|
||||
extra_headers.extend(build_conversation_headers(Some(
|
||||
self.state.conversation_id.to_string(),
|
||||
)));
|
||||
let trace_attempt = compaction_trace.start_attempt(&payload);
|
||||
let trace_attempt = options.compaction_trace.start_attempt(&payload);
|
||||
let result = client
|
||||
.compact_input(&payload, extra_headers)
|
||||
.await
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::Prompt;
|
||||
use crate::client::CompactConversationOptions;
|
||||
use crate::compact::CompactionAnalyticsAttempt;
|
||||
use crate::compact::InitialContextInjection;
|
||||
use crate::compact::compaction_status_from_result;
|
||||
@@ -118,8 +119,10 @@ pub(crate) async fn run_remote_prefix_compact_task(
|
||||
turn_context.reasoning_effort,
|
||||
turn_context.reasoning_summary,
|
||||
&turn_context.session_telemetry,
|
||||
Some(PREFIX_COMPACTION_MODE),
|
||||
&compaction_trace,
|
||||
CompactConversationOptions {
|
||||
mode: Some(PREFIX_COMPACTION_MODE),
|
||||
compaction_trace: &compaction_trace,
|
||||
},
|
||||
)
|
||||
.or_else(|err| async {
|
||||
let total_usage_breakdown = sess.get_total_token_usage_breakdown().await;
|
||||
@@ -232,8 +235,10 @@ async fn run_remote_compact_task_inner_impl(
|
||||
turn_context.reasoning_effort,
|
||||
turn_context.reasoning_summary,
|
||||
&turn_context.session_telemetry,
|
||||
/*mode*/ None,
|
||||
&compaction_trace,
|
||||
CompactConversationOptions {
|
||||
mode: None,
|
||||
compaction_trace: &compaction_trace,
|
||||
},
|
||||
)
|
||||
.or_else(|err| async {
|
||||
let total_usage_breakdown = sess.get_total_token_usage_breakdown().await;
|
||||
|
||||
Reference in New Issue
Block a user