Make compaction transitions recoverable

This commit is contained in:
Georg Bauer
2026-07-26 10:56:19 +02:00
parent 6aa45b2cf0
commit 2a14b93335
13 changed files with 329 additions and 26 deletions

View File

@@ -122,6 +122,7 @@ impl GenerationService {
turn: TurnSettings,
messages: Vec<ChatTurn>,
reason: &str,
checkpoint: PathBuf,
idle_timeout: Duration,
) -> Result<ActiveGeneration, String> {
let cancel = Arc::new(AtomicBool::new(false));
@@ -132,7 +133,7 @@ impl GenerationService {
engine,
turn,
messages,
checkpoint: CheckpointTarget::OneShot(PathBuf::new()),
checkpoint: CheckpointTarget::Local(checkpoint),
compact_reason: Some(reason.to_owned()),
idle_timeout,
cancel: Arc::clone(&cancel),
@@ -261,10 +262,14 @@ fn run_command(
});
};
if let Some(reason) = &command.compact_reason {
let CheckpointTarget::Local(checkpoint) = &command.checkpoint else {
unreachable!("compaction checkpoints are local")
};
let result = generator.compact(
&command.messages,
&command.turn,
reason,
checkpoint,
&command.cancel,
&mut progress,
);