Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitade3fce

Browse files
authored
fix(coderd): prevent task working notification for first app status (#20313)
Disclaimer: Claude did all of this, reviewed and committed by me.I find the "task is working" notification straight after creation to beunnecessary.Added logic to skip the notification if the first app status is"working".
1 parent6c99d5e commitade3fce

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

‎coderd/aitasks_test.go‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,16 +1008,26 @@ func TestTasksNotification(t *testing.T) {
10081008
isNotificationSent:false,
10091009
taskPrompt:"NonNotifiedTransition",
10101010
},
1011-
// Should send TemplateTaskWorking when the AI task transitions to'Working'.
1011+
// ShouldNOTsend TemplateTaskWorking when the AI task's FIRST status is'Working' (obvious state).
10121012
{
10131013
name:"TemplateTaskWorking",
10141014
latestAppStatuses:nil,
10151015
newAppStatus:codersdk.WorkspaceAppStatusStateWorking,
10161016
isAITask:true,
1017-
isNotificationSent:true,
1017+
isNotificationSent:false,
10181018
notificationTemplate:notifications.TemplateTaskWorking,
10191019
taskPrompt:"TemplateTaskWorking",
10201020
},
1021+
// Should send TemplateTaskIdle when the AI task's FIRST status is 'Idle' (task completed immediately).
1022+
{
1023+
name:"InitialTemplateTaskIdle",
1024+
latestAppStatuses:nil,
1025+
newAppStatus:codersdk.WorkspaceAppStatusStateIdle,
1026+
isAITask:true,
1027+
isNotificationSent:true,
1028+
notificationTemplate:notifications.TemplateTaskIdle,
1029+
taskPrompt:"InitialTemplateTaskIdle",
1030+
},
10211031
// Should send TemplateTaskWorking when the AI task transitions to 'Working' from 'Idle'.
10221032
{
10231033
name:"TemplateTaskWorkingFromIdle",

‎coderd/workspaceagents.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,13 @@ func (api *API) enqueueAITaskStateNotification(
471471
return
472472
}
473473

474+
// Skip the initial "Working" notification when task first starts.
475+
// This is obvious to the user since they just created the task.
476+
// We still notify on first "Idle" status and all subsequent transitions.
477+
iflen(latestAppStatus)==0&&newAppStatus==codersdk.WorkspaceAppStatusStateWorking {
478+
return
479+
}
480+
474481
// Use the task prompt as the "task" label, fallback to workspace name
475482
parameters,err:=api.Database.GetWorkspaceBuildParameters(ctx,workspaceBuild.ID)
476483
iferr!=nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp