@@ -187,6 +187,7 @@ describe("model switches", () => {
187187 effort ?: string ,
188188 overrides : Partial < ModelSwitchRun > = { } ,
189189 ) : ModelSwitchRun => ( {
190+ id : RunId . make ( `run-${ id } ` ) ,
190191 ordinal,
191192 status : "completed" ,
192193 startedAt : DateTime . makeUnsafe ( "2026-10-11T00:00:00Z" ) ,
@@ -224,6 +225,29 @@ describe("model switches", () => {
224225 ) . toMatchObject ( { label : "Effort changed" , effortChanged : true } ) ;
225226 } ) ;
226227
228+ it ( "marks each steering restart against what it replaced" , ( ) => {
229+ const restart = ( attemptOrdinal : number , message : string , model : string ) => ( {
230+ runId : RunId . make ( "run-b" ) ,
231+ attemptOrdinal,
232+ restartedFrom : {
233+ userMessageId : MessageId . make ( `message-${ message } ` ) ,
234+ modelSelection : { instanceId : from , model } ,
235+ } ,
236+ } ) ;
237+ const switches = resolveModelSwitches (
238+ [
239+ switchRun ( "a" , 1 , "gpt" , undefined , { id : RunId . make ( "run-a" ) } ) ,
240+ switchRun ( "s2" , 2 , "gpt" , undefined , { id : RunId . make ( "run-b" ) } ) ,
241+ ] ,
242+ [ restart ( 3 , "s1" , "max" ) , restart ( 2 , "b" , "mini" ) ] ,
243+ ) ;
244+ expect ( [ ...switches ] . map ( ( [ id , change ] ) => [ id , change . from . model , change . to . model ] ) ) . toEqual ( [
245+ [ "message-b" , "gpt" , "mini" ] ,
246+ [ "message-s1" , "mini" , "max" ] ,
247+ [ "message-s2" , "max" , "gpt" ] ,
248+ ] ) ;
249+ } ) ;
250+
227251 it ( "reads an unset effort as the model's default" , ( ) => {
228252 const providers = [
229253 {
@@ -251,6 +275,7 @@ describe("model switches", () => {
251275 switchRun ( "c" , 3 , "gpt" , "high" ) ,
252276 switchRun ( "d" , 4 , "gpt" ) ,
253277 ] ,
278+ [ ] ,
254279 providers ,
255280 ) ;
256281 expect ( keys ( switches ) ) . toEqual ( [ "c" , "d" ] ) ;
@@ -293,6 +318,7 @@ describe("model switches", () => {
293318 } ) ;
294319 const effortSwitch = resolveModelSwitches (
295320 [ thought ( "a" , 1 ) , thought ( "b" , 2 , "deep" ) ] ,
321+ [ ] ,
296322 providers ,
297323 ) . get ( MessageId . make ( "message-b" ) ) ;
298324 expect ( effortSwitch ?. label ) . toBe ( "Effort changed" ) ;
0 commit comments