mirror of
https://github.com/openai/codex.git
synced 2026-05-29 07:19:50 +00:00
## Summary - add a scoped level_id to ExtensionData and expose it through level_id() - remove thread_id/turn_id parameters from extension contributor inputs where the scoped ExtensionData already carries that identity - move turn-scoped extension data onto TurnContext so token usage and lifecycle contributors can share the same turn store ## Testing - cargo check -p codex-extension-api -p codex-core --tests - cargo test -p codex-extension-api - cargo test -p codex-guardian - cargo test -p codex-core --lib record_token_usage_info_notifies_extension_contributors - cargo test -p codex-core --lib submission_loop_channel_close_emits_thread_stop_lifecycle - cargo test -p codex-core --lib submission_loop_channel_close_aborts_active_turn_before_thread_stop_lifecycle - just fix -p codex-extension-api - just fix -p codex-guardian - just fix -p codex-core - just fmt ## Note - Attempted cargo test -p codex-core; it aborted in agent::control::tests::spawn_agent_fork_last_n_turns_keeps_only_recent_turns with the existing stack overflow before the full suite completed.
42 lines
1.5 KiB
Rust
42 lines
1.5 KiB
Rust
use codex_extension_api::ExtensionData;
|
|
use codex_protocol::protocol::TurnAbortReason;
|
|
|
|
use crate::session::session::Session;
|
|
|
|
impl Session {
|
|
pub(super) fn emit_turn_start_lifecycle(&self, turn_store: &ExtensionData) {
|
|
for contributor in self.services.extensions.turn_lifecycle_contributors() {
|
|
contributor.on_turn_start(codex_extension_api::TurnStartInput {
|
|
session_store: &self.services.session_extension_data,
|
|
thread_store: &self.services.thread_extension_data,
|
|
turn_store,
|
|
});
|
|
}
|
|
}
|
|
|
|
pub(super) fn emit_turn_stop_lifecycle(&self, turn_store: &ExtensionData) {
|
|
for contributor in self.services.extensions.turn_lifecycle_contributors() {
|
|
contributor.on_turn_stop(codex_extension_api::TurnStopInput {
|
|
session_store: &self.services.session_extension_data,
|
|
thread_store: &self.services.thread_extension_data,
|
|
turn_store,
|
|
});
|
|
}
|
|
}
|
|
|
|
pub(super) fn emit_turn_abort_lifecycle(
|
|
&self,
|
|
reason: TurnAbortReason,
|
|
turn_store: &ExtensionData,
|
|
) {
|
|
for contributor in self.services.extensions.turn_lifecycle_contributors() {
|
|
contributor.on_turn_abort(codex_extension_api::TurnAbortInput {
|
|
reason: reason.clone(),
|
|
session_store: &self.services.session_extension_data,
|
|
thread_store: &self.services.thread_extension_data,
|
|
turn_store,
|
|
});
|
|
}
|
|
}
|
|
}
|