mirror of
https://github.com/openai/codex.git
synced 2026-11-29 15:36:12 +00:00
Pass sessions directly to session tasks (#36354)
## What changed - Replace `SessionTaskContext` with `Arc<Session>` in the session task run and abort interfaces. - Read extension data from `TurnContext` during regular turns instead of storing and forwarding a duplicate reference through the running task. GitOrigin-RevId: 04bc0d324e5ba781f35ac9c61e811888208b74ae
This commit is contained in:
1 parent
2c005abb07
commit
35eab50501
8 files changed
+36
-106
No files matched your search
@@ -1,10 +1,10 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::SessionTask;
|
||||
use super::SessionTaskContext;
|
||||
use super::SessionTaskResult;
|
||||
use super::emit_compact_metric;
|
||||
use crate::session::TurnInput;
|
||||
use crate::session::session::Session;
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use crate::state::TaskKind;
|
||||
use codex_features::Feature;
|
||||
@@ -26,12 +26,11 @@ impl SessionTask for CompactTask {
|
||||
|
||||
async fn run(
|
||||
self: Arc<Self>,
|
||||
session: Arc<SessionTaskContext>,
|
||||
session: Arc<Session>,
|
||||
ctx: Arc<TurnContext>,
|
||||
_input: Vec<TurnInput>,
|
||||
_cancellation_token: CancellationToken,
|
||||
) -> SessionTaskResult {
|
||||
let session = session.clone_session();
|
||||
let _profile_guard = ctx.turn_timing_state.begin_compaction();
|
||||
if ctx.config.features.enabled(Feature::TokenBudget) {
|
||||
crate::compact_token_budget::run_manual_compact_task(session, ctx).await?;
|
||||
|
||||
Reference in new issue
Block a user