@@ -25,6 +25,16 @@ async function quitGracefully(): Promise<void> {
2525 await vscode . commands . executeCommand ( "workbench.action.quit" )
2626}
2727
28+ async function waitForMarkedCompletion ( api : RooCodeAPI , taskId : string ) : Promise < void > {
29+ await waitFor ( ( ) =>
30+ api . hasTaskApiConversationHistorySequence ( taskId , {
31+ userText : "RESTART_PERSISTENCE_SMOKE" ,
32+ assistantToolName : "attempt_completion" ,
33+ assistantToolInputText : MARKER ,
34+ } ) ,
35+ )
36+ }
37+
2838async function runCreate ( api : RooCodeAPI ) : Promise < void > {
2939 let taskId : string | undefined
3040 let createPhasePassed = false
@@ -86,16 +96,7 @@ async function runVerify(api: RooCodeAPI): Promise<void> {
8696 const historyItem = await api . getTaskHistoryItem ( taskId )
8797 assert . ok ( historyItem , "Task history item should be available after restart" )
8898 assert . ok ( historyItem . task . includes ( "RESTART_PERSISTENCE_SMOKE" ) , "History title should persist after restart" )
89- const restoredCompletion = await api . hasTaskApiConversationHistorySequence ( taskId , {
90- userText : "RESTART_PERSISTENCE_SMOKE" ,
91- assistantToolName : "attempt_completion" ,
92- assistantToolInputText : MARKER ,
93- } )
94- assert . strictEqual (
95- restoredCompletion ,
96- true ,
97- "Fresh-host history should restore the marked user turn followed by its assistant completion" ,
98- )
99+ await waitForMarkedCompletion ( api , taskId )
99100
100101 await api . resumeTask ( taskId )
101102 await waitFor ( ( ) => taskMessages . some ( ( { type, ask } ) => type === "ask" && ask === "resume_completed_task" ) )
@@ -106,16 +107,7 @@ async function runVerify(api: RooCodeAPI): Promise<void> {
106107 reopenedHistoryItem . task . includes ( "RESTART_PERSISTENCE_SMOKE" ) ,
107108 "Reopened task should retain its persisted history title" ,
108109 )
109- const reopenedCompletion = await api . hasTaskApiConversationHistorySequence ( taskId , {
110- userText : "RESTART_PERSISTENCE_SMOKE" ,
111- assistantToolName : "attempt_completion" ,
112- assistantToolInputText : MARKER ,
113- } )
114- assert . strictEqual (
115- reopenedCompletion ,
116- true ,
117- "Reopened-host history should restore the marked user turn followed by its assistant completion" ,
118- )
110+ await waitForMarkedCompletion ( api , taskId )
119111
120112 await writePhaseResult ( getResultsDir ( ) , {
121113 version : PHASE_RESULT_VERSION ,
0 commit comments