@@ -793,8 +793,9 @@ func TestExpMcpReporter(t *testing.T) {
793
793
}
794
794
795
795
runs := []struct {
796
- name string
797
- tests []test
796
+ name string
797
+ tests []test
798
+ disableAgentAPI bool
798
799
}{
799
800
// In this run the AI agent starts with a state change but forgets to update
800
801
// that it finished.
@@ -954,6 +955,29 @@ func TestExpMcpReporter(t *testing.T) {
954
955
},
955
956
},
956
957
},
958
+ // When AgentAPI is not being used, we accept agent state updates as-is.
959
+ {
960
+ name : "KeepAgentState" ,
961
+ tests : []test {
962
+ {
963
+ state : codersdk .WorkspaceAppStatusStateWorking ,
964
+ summary : "doing work" ,
965
+ expected : & codersdk.WorkspaceAppStatus {
966
+ State : codersdk .WorkspaceAppStatusStateWorking ,
967
+ Message : "doing work" ,
968
+ },
969
+ },
970
+ {
971
+ state : codersdk .WorkspaceAppStatusStateIdle ,
972
+ summary : "finished" ,
973
+ expected : & codersdk.WorkspaceAppStatus {
974
+ State : codersdk .WorkspaceAppStatusStateIdle ,
975
+ Message : "finished" ,
976
+ },
977
+ },
978
+ },
979
+ disableAgentAPI : true ,
980
+ },
957
981
}
958
982
959
983
for _ , run := range runs {
@@ -1019,15 +1043,19 @@ func TestExpMcpReporter(t *testing.T) {
1019
1043
}
1020
1044
}
1021
1045
1022
- inv , _ := clitest . New ( t ,
1046
+ args := [] string {
1023
1047
"exp" , "mcp" , "server" ,
1024
- // We need the agent credentials, AI AgentAPI url, and a slug for reporting.
1048
+ // We need the agent credentials, AI AgentAPI url (if not
1049
+ // disabled), and a slug for reporting.
1025
1050
"--agent-url" , client .URL .String (),
1026
1051
"--agent-token" , r .AgentToken ,
1027
1052
"--app-status-slug" , "vscode" ,
1028
- "--ai-agentapi-url" , aiAgentAPIURL ,
1029
1053
"--allowed-tools=coder_report_task" ,
1030
- )
1054
+ }
1055
+ if ! run .disableAgentAPI {
1056
+ args = append (args , "--ai-agentapi-url" , aiAgentAPIURL )
1057
+ }
1058
+ inv , _ := clitest .New (t , args ... )
1031
1059
inv = inv .WithContext (ctx )
1032
1060
1033
1061
pty := ptytest .New (t )
0 commit comments