Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

mlxrunner: settle the draft caches when a prefill is cancelled

Jesse Grossc01eafa5528e
diff --git a/x/mlxrunner/pipeline.go b/x/mlxrunner/pipeline.go
index e5b8b5fe9..911f345ae 100644
--- a/x/mlxrunner/pipeline.go
+++ b/x/mlxrunner/pipeline.go
@@ -169,6 +169,10 @@ func (r *Runner) prefill(ctx context.Context, session *cacheSession, spec *specu
media.release(position)
for total-processed > 1 {
if err := ctx.Err(); err != nil {
+ // Settle the drafter with the next prompt token so the caches
+ // rest level with the recorded keys and a retry resumes exactly
+ // where this prefill stopped.
+ spec.settle(mlx.FromValues(tokens[processed:processed+1], 1))
return nil, 0, 0, err
}