mirror of
https://github.com/openai/codex.git
synced 2026-09-08 15:50:34 +00:00
## Summary - Remove `ghost_snapshot` / `GhostCommit` from the Responses API surface and generated SDK/schema artifacts. - Keep legacy config loading compatible, but make undo a no-op that reports the feature is unavailable. - Clean up core history, compaction, telemetry, rollout, and tests to stop carrying ghost snapshot items. ## Testing - Unit tests passed for `codex-protocol`, `codex-core` targeted undo and compaction flows, `codex-rollout`, and `codex-app-server-protocol`. - Regenerated config and app-server schemas plus Python SDK artifacts and verified they match the checked-in outputs.
73 lines
1.9 KiB
Rust
73 lines
1.9 KiB
Rust
use std::sync::Arc;
|
|
|
|
use crate::session::turn_context::TurnContext;
|
|
use crate::state::TaskKind;
|
|
use crate::tasks::SessionTask;
|
|
use crate::tasks::SessionTaskContext;
|
|
use codex_protocol::protocol::EventMsg;
|
|
use codex_protocol::protocol::UndoCompletedEvent;
|
|
use codex_protocol::protocol::UndoStartedEvent;
|
|
use codex_protocol::user_input::UserInput;
|
|
use tokio_util::sync::CancellationToken;
|
|
|
|
pub(crate) struct UndoTask;
|
|
|
|
impl UndoTask {
|
|
pub(crate) fn new() -> Self {
|
|
Self
|
|
}
|
|
}
|
|
|
|
impl SessionTask for UndoTask {
|
|
fn kind(&self) -> TaskKind {
|
|
TaskKind::Regular
|
|
}
|
|
|
|
fn span_name(&self) -> &'static str {
|
|
"session_task.undo"
|
|
}
|
|
|
|
async fn run(
|
|
self: Arc<Self>,
|
|
session: Arc<SessionTaskContext>,
|
|
ctx: Arc<TurnContext>,
|
|
_input: Vec<UserInput>,
|
|
cancellation_token: CancellationToken,
|
|
) -> Option<String> {
|
|
session
|
|
.session
|
|
.services
|
|
.session_telemetry
|
|
.counter("codex.task.undo", /*inc*/ 1, &[]);
|
|
let sess = session.clone_session();
|
|
sess.send_event(
|
|
ctx.as_ref(),
|
|
EventMsg::UndoStarted(UndoStartedEvent {
|
|
message: Some("Undo in progress...".to_string()),
|
|
}),
|
|
)
|
|
.await;
|
|
|
|
if cancellation_token.is_cancelled() {
|
|
sess.send_event(
|
|
ctx.as_ref(),
|
|
EventMsg::UndoCompleted(UndoCompletedEvent {
|
|
success: false,
|
|
message: Some("Undo cancelled.".to_string()),
|
|
}),
|
|
)
|
|
.await;
|
|
return None;
|
|
}
|
|
|
|
let completed = UndoCompletedEvent {
|
|
success: false,
|
|
message: Some("Undo is no longer available.".to_string()),
|
|
};
|
|
|
|
sess.send_event(ctx.as_ref(), EventMsg::UndoCompleted(completed))
|
|
.await;
|
|
None
|
|
}
|
|
}
|