@@ -409,14 +409,12 @@ func TestPartsToString(t *testing.T) {
409409
410410func TestInitialPromptReadiness (t * testing.T ) {
411411 now := time .Now ()
412- changing := st .ConversationStatusChanging
413- stable := st .ConversationStatusStable
414412
415413 t .Run ("agent not ready - status remains changing" , func (t * testing.T ) {
416414 cfg := st.ConversationConfig {
417415 GetTime : func () time.Time { return now },
418416 SnapshotInterval : 1 * time .Second ,
419- ScreenStabilityLength : 2 * time . Second ,
417+ ScreenStabilityLength : 0 ,
420418 AgentIO : & testAgent {screen : "loading..." },
421419 ReadyForInitialPrompt : func (message string ) bool {
422420 return message == "ready"
@@ -426,11 +424,9 @@ func TestInitialPromptReadiness(t *testing.T) {
426424
427425 // Fill buffer with stable snapshots, but agent is not ready
428426 c .AddSnapshot ("loading..." )
429- c .AddSnapshot ("loading..." )
430- c .AddSnapshot ("loading..." )
431427
432428 // Even though screen is stable, status should be changing because agent is not ready
433- assert .Equal (t , changing , c .Status ())
429+ assert .Equal (t , st . ConversationStatusChanging , c .Status ())
434430 assert .False (t , c .ReadyForInitialPrompt )
435431 assert .False (t , c .InitialPromptSent )
436432 })
@@ -439,7 +435,7 @@ func TestInitialPromptReadiness(t *testing.T) {
439435 cfg := st.ConversationConfig {
440436 GetTime : func () time.Time { return now },
441437 SnapshotInterval : 1 * time .Second ,
442- ScreenStabilityLength : 2 * time . Second ,
438+ ScreenStabilityLength : 0 ,
443439 AgentIO : & testAgent {screen : "loading..." },
444440 ReadyForInitialPrompt : func (message string ) bool {
445441 return message == "ready"
@@ -449,15 +445,11 @@ func TestInitialPromptReadiness(t *testing.T) {
449445
450446 // Agent not ready initially
451447 c .AddSnapshot ("loading..." )
452- c .AddSnapshot ("loading..." )
453- c .AddSnapshot ("loading..." )
454- assert .Equal (t , changing , c .Status ())
448+ assert .Equal (t , st .ConversationStatusChanging , c .Status ())
455449
456450 // Agent becomes ready
457451 c .AddSnapshot ("ready" )
458- c .AddSnapshot ("ready" )
459- c .AddSnapshot ("ready" )
460- assert .Equal (t , stable , c .Status ())
452+ assert .Equal (t , st .ConversationStatusStable , c .Status ())
461453 assert .True (t , c .ReadyForInitialPrompt )
462454 assert .False (t , c .InitialPromptSent )
463455 })
@@ -466,7 +458,7 @@ func TestInitialPromptReadiness(t *testing.T) {
466458 cfg := st.ConversationConfig {
467459 GetTime : func () time.Time { return now },
468460 SnapshotInterval : 1 * time .Second ,
469- ScreenStabilityLength : 2 * time . Second ,
461+ ScreenStabilityLength : 0 ,
470462 AgentIO : & testAgent {screen : "loading..." },
471463 ReadyForInitialPrompt : func (message string ) bool {
472464 return false // Agent never ready
@@ -475,12 +467,10 @@ func TestInitialPromptReadiness(t *testing.T) {
475467 // Empty initial prompt means no need to wait for readiness
476468 c := st .NewConversation (context .Background (), cfg , "" )
477469
478- c .AddSnapshot ("loading..." )
479- c .AddSnapshot ("loading..." )
480470 c .AddSnapshot ("loading..." )
481471
482472 // Status should be stable because no initial prompt to wait for
483- assert .Equal (t , stable , c .Status ())
473+ assert .Equal (t , st . ConversationStatusStable , c .Status ())
484474 assert .False (t , c .ReadyForInitialPrompt )
485475 assert .True (t , c .InitialPromptSent ) // Set to true when initial prompt is empty
486476 })
@@ -489,7 +479,7 @@ func TestInitialPromptReadiness(t *testing.T) {
489479 cfg := st.ConversationConfig {
490480 GetTime : func () time.Time { return now },
491481 SnapshotInterval : 1 * time .Second ,
492- ScreenStabilityLength : 2 * time . Second ,
482+ ScreenStabilityLength : 0 ,
493483 AgentIO : & testAgent {screen : "processing..." },
494484 ReadyForInitialPrompt : func (message string ) bool {
495485 return false // Agent never ready
@@ -499,47 +489,11 @@ func TestInitialPromptReadiness(t *testing.T) {
499489 // Manually mark as sent to simulate that initial prompt was already sent
500490 c .InitialPromptSent = true
501491
502- c .AddSnapshot ("processing..." )
503- c .AddSnapshot ("processing..." )
504492 c .AddSnapshot ("processing..." )
505493
506494 // Status should be stable because initial prompt was already sent
507- assert .Equal (t , stable , c .Status ())
495+ assert .Equal (t , st . ConversationStatusStable , c .Status ())
508496 assert .False (t , c .ReadyForInitialPrompt )
509497 assert .True (t , c .InitialPromptSent )
510498 })
511-
512- t .Run ("agent readiness detected once - stays ready" , func (t * testing.T ) {
513- cfg := st.ConversationConfig {
514- GetTime : func () time.Time { return now },
515- SnapshotInterval : 1 * time .Second ,
516- ScreenStabilityLength : 2 * time .Second ,
517- AgentIO : & testAgent {screen : "ready" },
518- ReadyForInitialPrompt : func (message string ) bool {
519- return message == "ready"
520- },
521- }
522- c := st .NewConversation (context .Background (), cfg , "initial prompt here" )
523-
524- // Agent becomes ready
525- c .AddSnapshot ("ready" )
526- c .AddSnapshot ("ready" )
527- c .AddSnapshot ("ready" )
528- assert .Equal (t , stable , c .Status ())
529- assert .True (t , c .ReadyForInitialPrompt )
530-
531- // After agent is detected as ready, normal status logic applies
532- // Screen changes should cause changing status
533- c .AddSnapshot ("changing" )
534- assert .Equal (t , changing , c .Status ())
535- assert .True (t , c .ReadyForInitialPrompt )
536-
537- // Once screen stabilizes again, status should be stable
538- // ReadyForInitialPrompt remains true
539- c .AddSnapshot ("stable now" )
540- c .AddSnapshot ("stable now" )
541- c .AddSnapshot ("stable now" )
542- assert .Equal (t , stable , c .Status ())
543- assert .True (t , c .ReadyForInitialPrompt )
544- })
545499}
0 commit comments