@@ -20,7 +20,7 @@ import (
2020const (
2121 // writeStabilizeEchoTimeout is the timeout for the echo
2222 // detection WaitFor loop in writeStabilize Phase 1. The
23- // effective ceiling may be slightly longer because the 1s
23+ // effective ceiling may be slightly longer because the
2424 // stability check inside the condition runs outside
2525 // WaitFor's timeout select. Non-echoing agents (e.g. TUI
2626 // agents using bracketed paste) will hit this timeout,
@@ -438,12 +438,12 @@ func (c *PTYConversation) sendMessage(ctx context.Context, messageParts ...Messa
438438// Phase 1 (echo detection): writes the message text and waits
439439// for the screen to change and stabilize. This detects agents
440440// that echo typed input. If the screen doesn't change within
441- // writeStabilizeEchoTimeout, this is non-fatal — many TUI
441+ // writeStabilizeEchoTimeout, this is non-fatal. Many TUI
442442// agents buffer bracketed-paste input without rendering it.
443443//
444444// Phase 2 (processing detection): writes a carriage return
445445// and waits for the screen to change, indicating the agent
446- // started processing. This phase is fatal on timeout — if the
446+ // started processing. This phase is fatal on timeout: if the
447447// agent doesn't react to Enter, it's unresponsive.
448448func (c * PTYConversation ) writeStabilize (ctx context.Context , messageParts ... MessagePart ) error {
449449 screenBeforeMessage := c .cfg .AgentIO .ReadScreen ()
@@ -452,7 +452,8 @@ func (c *PTYConversation) writeStabilize(ctx context.Context, messageParts ...Me
452452 return xerrors .Errorf ("failed to write message part: %w" , err )
453453 }
454454 }
455- // wait for the screen to stabilize after the message is written
455+ // Phase 1: wait for the screen to stabilize after the
456+ // message is written (echo detection).
456457 if err := util .WaitFor (ctx , util.WaitTimeout {
457458 Timeout : writeStabilizeEchoTimeout ,
458459 MinInterval : 50 * time .Millisecond ,
@@ -488,7 +489,8 @@ func (c *PTYConversation) writeStabilize(ctx context.Context, messageParts ...Me
488489 )
489490 }
490491
491- // wait for the screen to change after the carriage return is written
492+ // Phase 2: wait for the screen to change after the
493+ // carriage return is written (processing detection).
492494 screenBeforeCarriageReturn := c .cfg .AgentIO .ReadScreen ()
493495 lastCarriageReturnTime := time.Time {}
494496 if err := util .WaitFor (ctx , util.WaitTimeout {
0 commit comments