@@ -289,15 +289,23 @@ func (c *Conversation) writeMessageWithConfirmation(ctx context.Context, message
289289
290290 // wait for the screen to change after the carriage return is written
291291 screenBeforeCarriageReturn := c .cfg .AgentIO .ReadScreen ()
292+ lastCarriageReturnTime := time.Time {}
292293 if err := util .WaitFor (ctx , util.WaitTimeout {
293294 Timeout : 15 * time .Second ,
294295 MinInterval : 25 * time .Millisecond ,
295296 }, func () (bool , error ) {
296- if _ , err := c .cfg .AgentIO .Write ([]byte ("\r " )); err != nil {
297- return false , xerrors .Errorf ("failed to write carriage return: %w" , err )
297+ // we don't want to spam additional carriage returns because the agent may process them
298+ // (aider does this), but we do want to retry sending one if nothing's
299+ // happening for a while
300+ if time .Since (lastCarriageReturnTime ) >= 3 * time .Second {
301+ lastCarriageReturnTime = time .Now ()
302+ if _ , err := c .cfg .AgentIO .Write ([]byte ("\r " )); err != nil {
303+ return false , xerrors .Errorf ("failed to write carriage return: %w" , err )
304+ }
298305 }
299306 time .Sleep (25 * time .Millisecond )
300307 screen := c .cfg .AgentIO .ReadScreen ()
308+
301309 return screen != screenBeforeCarriageReturn , nil
302310 }); err != nil {
303311 return xerrors .Errorf ("failed to wait for processing to start: %w" , err )
0 commit comments