@@ -790,11 +790,12 @@ func TestExpMcpReporter(t *testing.T) {
790
790
}
791
791
}
792
792
793
- makeMessageEvent := func (id int64 ) * codersdk.ServerSentEvent {
793
+ makeMessageEvent := func (id int64 , role agentapi. ConversationRole ) * codersdk.ServerSentEvent {
794
794
return & codersdk.ServerSentEvent {
795
795
Type : ServerSentEventTypeMessageUpdate ,
796
796
Data : agentapi.EventMessageUpdate {
797
- Id : id ,
797
+ Id : id ,
798
+ Role : role ,
798
799
},
799
800
}
800
801
}
@@ -813,7 +814,7 @@ func TestExpMcpReporter(t *testing.T) {
813
814
return
814
815
}
815
816
// Send initial message.
816
- send (* makeMessageEvent (0 ))
817
+ send (* makeMessageEvent (0 , agentapi . RoleAgent ))
817
818
listening <- send
818
819
<- closed
819
820
}))
@@ -902,13 +903,17 @@ func TestExpMcpReporter(t *testing.T) {
902
903
URI : "https://dev.coder.com" ,
903
904
},
904
905
},
905
- // Terminal becomes active again according to the screen watcher, but
906
- // message length is the same . This could be the LLM being active again,
907
- // but it could also be the user messing around. We will prefer not
908
- // updating the status so the "working" update here should be skipped.
906
+ // Terminal becomes active again according to the screen watcher, but no
907
+ // new user message . This could be the LLM being active again, but it
908
+ // could also be the user messing around. We will prefer not updating the
909
+ // status so the "working" update here should be skipped.
909
910
{
910
911
event : makeStatusEvent (agentapi .StatusRunning ),
911
912
},
913
+ // Agent messages are ignored.
914
+ {
915
+ event : makeMessageEvent (1 , agentapi .RoleAgent ),
916
+ },
912
917
// LLM reports that it failed and URI is blank.
913
918
{
914
919
state : codersdk .WorkspaceAppStatusStateFailure ,
@@ -923,10 +928,10 @@ func TestExpMcpReporter(t *testing.T) {
923
928
{
924
929
event : makeStatusEvent (agentapi .StatusRunning ),
925
930
},
926
- // ... but this time the message length has increased so we know there is
927
- // LLM activity. This time the "working" update will not be skipped.
931
+ // ... but this time we have a new user message so we know there is LLM
932
+ // activity. This time the "working" update will not be skipped.
928
933
{
929
- event : makeMessageEvent (1 ),
934
+ event : makeMessageEvent (2 , agentapi . RoleUser ),
930
935
expected : & codersdk.WorkspaceAppStatus {
931
936
State : codersdk .WorkspaceAppStatusStateWorking ,
932
937
Message : "oops" ,
0 commit comments