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

Commit7726d34

Browse files
authored
Merge branch 'main' into jakehwll/routing-ai-governance
2 parents0ae26ca +f3d950d commit7726d34

File tree

92 files changed

+2540
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2540
-495
lines changed

‎.github/.linkspector.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ ignorePatterns:
2626
-pattern:"claude.ai"
2727
-pattern:"splunk.com"
2828
-pattern:"stackoverflow.com/questions"
29+
-pattern:"developer.hashicorp.com/terraform/language"
2930
aliveStatusCodes:
3031
-200

‎.github/workflows/deploy.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ jobs:
121121
flux --namespace flux-system reconcile source chart coder-coder-provisioner
122122
flux --namespace coder reconcile helmrelease coder
123123
flux --namespace coder reconcile helmrelease coder-provisioner
124+
flux --namespace coder reconcile helmrelease coder-provisioner-tagged
125+
flux --namespace coder reconcile helmrelease coder-provisioner-tagged-prebuilds
124126
125127
# Just updating Flux is usually not enough. The Helm release may get
126128
# redeployed, but unless something causes the Deployment to update the
@@ -136,6 +138,8 @@ jobs:
136138
kubectl --namespace coder rollout status deployment/coder-provisioner
137139
kubectl --namespace coder rollout restart deployment/coder-provisioner-tagged
138140
kubectl --namespace coder rollout status deployment/coder-provisioner-tagged
141+
kubectl --namespace coder rollout restart deployment/coder-provisioner-tagged-prebuilds
142+
kubectl --namespace coder rollout status deployment/coder-provisioner-tagged-prebuilds
139143
140144
deploy-wsproxies:
141145
runs-on:ubuntu-latest

‎.github/workflows/traiage.yaml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ jobs:
189189
TEMPLATE_PRESET:${{ steps.determine-inputs.outputs.template_preset }}
190190
run:|
191191
# Fetch issue description using `gh` CLI
192-
issue_description=$(gh issue view "${ISSUE_URL}")
192+
#shellcheck disable=SC2016 # The template string should not be subject to shell expansion
193+
issue_description=$(gh issue view "${ISSUE_URL}" \
194+
--json 'title,body,comments' \
195+
--template '{{printf "%s\n\n%s\n\nComments:\n" .title .body}}{{range $k, $v := .comments}} - {{index $v.author "login"}}: {{printf "%s\n" $v.body}}{{end}}')
193196
194197
# Write a prompt to PROMPT_FILE
195198
PROMPT=$(cat <<EOF

‎agent/agent.go‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,11 +781,15 @@ func (a *agent) reportConnectionsLoop(ctx context.Context, aAPI proto.DRPCAgentC
781781
logger.Debug(ctx,"reporting connection")
782782
_,err:=aAPI.ReportConnection(ctx,payload)
783783
iferr!=nil {
784-
returnxerrors.Errorf("failed to report connection: %w",err)
784+
// Do not fail the loop if we fail to report a connection, just
785+
// log a warning.
786+
// Related to https://github.com/coder/coder/issues/20194
787+
logger.Warn(ctx,"failed to report connection to server",slog.Error(err))
788+
// keep going, we still need to remove it from the slice
789+
}else {
790+
logger.Debug(ctx,"successfully reported connection")
785791
}
786792

787-
logger.Debug(ctx,"successfully reported connection")
788-
789793
// Remove the payload we sent.
790794
a.reportConnectionsMu.Lock()
791795
a.reportConnections[0]=nil// Release the pointer from the underlying array.
@@ -816,6 +820,13 @@ func (a *agent) reportConnection(id uuid.UUID, connectionType proto.Connection_T
816820
ip=host
817821
}
818822

823+
// If the IP is "localhost" (which it can be in some cases), set it to
824+
// 127.0.0.1 instead.
825+
// Related to https://github.com/coder/coder/issues/20194
826+
ifip=="localhost" {
827+
ip="127.0.0.1"
828+
}
829+
819830
a.reportConnectionsMu.Lock()
820831
defera.reportConnectionsMu.Unlock()
821832

‎biome.jsonc‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"options": {
4646
"paths": {
4747
"@mui/material":"Use @mui/material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
48-
"@mui/icons-material":"Use @mui/icons-material/<name> instead. See: https://material-ui.com/guides/minimizing-bundle-size/.",
4948
"@mui/material/Avatar":"Use components/Avatar/Avatar instead.",
5049
"@mui/material/Alert":"Use components/Alert/Alert instead.",
5150
"@mui/material/Popover":"Use components/Popover/Popover instead.",

‎cli/exp_task_status_test.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ STATE CHANGED STATUS HEALTHY STATE MESSAGE
193193
"workspace_agent_id": null,
194194
"workspace_agent_lifecycle": null,
195195
"workspace_agent_health": null,
196+
"workspace_app_id": null,
196197
"initial_prompt": "",
197198
"status": "running",
198199
"current_state": {

‎coderd/agentapi/connectionlog.go‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ func (a *ConnLogAPI) ReportConnection(ctx context.Context, req *agentproto.Repor
6161
returnnil,xerrors.Errorf("get workspace by agent id: %w",err)
6262
}
6363

64+
// Some older clients may incorrectly report "localhost" as the IP address.
65+
// Related to https://github.com/coder/coder/issues/20194
66+
logIPRaw:=req.GetConnection().GetIp()
67+
iflogIPRaw=="localhost" {
68+
logIPRaw="127.0.0.1"
69+
}
70+
logIP:=database.ParseIP(logIPRaw)// will return null if invalid
71+
6472
reason:=req.GetConnection().GetReason()
6573
connLogger:=*a.ConnectionLogger.Load()
6674
err=connLogger.Upsert(ctx, database.UpsertConnectionLogParams{
@@ -73,7 +81,7 @@ func (a *ConnLogAPI) ReportConnection(ctx context.Context, req *agentproto.Repor
7381
AgentName:workspaceAgent.Name,
7482
Type:connectionType,
7583
Code:code,
76-
Ip:database.ParseIP(req.GetConnection().GetIp()),
84+
Ip:logIP,
7785
ConnectionID: uuid.NullUUID{
7886
UUID:connectionID,
7987
Valid:true,

‎coderd/agentapi/connectionlog_test.go‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ package agentapi_test
33
import (
44
"context"
55
"database/sql"
6-
"net"
76
"sync/atomic"
87
"testing"
98
"time"
109

1110
"github.com/google/uuid"
12-
"github.com/sqlc-dev/pqtype"
1311
"github.com/stretchr/testify/require"
1412
"go.uber.org/mock/gomock"
1513
"google.golang.org/protobuf/types/known/timestamppb"
@@ -75,6 +73,9 @@ func TestConnectionLog(t *testing.T) {
7573
action:agentproto.Connection_CONNECT.Enum(),
7674
typ:agentproto.Connection_JETBRAINS.Enum(),
7775
time:dbtime.Now(),
76+
// Sometimes, JetBrains clients report as localhost, see
77+
// https://github.com/coder/coder/issues/20194
78+
ip:"localhost",
7879
},
7980
{
8081
name:"Reconnecting PTY Connect",
@@ -129,6 +130,12 @@ func TestConnectionLog(t *testing.T) {
129130
},
130131
})
131132

133+
expectedIPRaw:=tt.ip
134+
ifexpectedIPRaw=="localhost" {
135+
expectedIPRaw="127.0.0.1"
136+
}
137+
expectedIP:=database.ParseIP(expectedIPRaw)
138+
132139
require.True(t,connLogger.Contains(t, database.UpsertConnectionLogParams{
133140
Time:dbtime.Time(tt.time).In(time.UTC),
134141
OrganizationID:workspace.OrganizationID,
@@ -146,7 +153,7 @@ func TestConnectionLog(t *testing.T) {
146153
Int32:tt.status,
147154
Valid:*tt.action==agentproto.Connection_DISCONNECT,
148155
},
149-
Ip:pqtype.Inet{Valid:true,IPNet: net.IPNet{IP:net.ParseIP(tt.ip),Mask:net.CIDRMask(32,32)}},
156+
Ip:expectedIP,
150157
Type:agentProtoConnectionTypeToConnectionLog(t,*tt.typ),
151158
DisconnectReason: sql.NullString{
152159
String:tt.reason,

‎coderd/aitasks.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,14 @@ func taskFromWorkspace(ws codersdk.Workspace, initialPrompt string) codersdk.Tas
268268
}
269269
}
270270

271+
varappID uuid.NullUUID
272+
ifws.LatestBuild.AITaskSidebarAppID!=nil {
273+
appID= uuid.NullUUID{
274+
Valid:true,
275+
UUID:*ws.LatestBuild.AITaskSidebarAppID,
276+
}
277+
}
278+
271279
return codersdk.Task{
272280
ID:ws.ID,
273281
OrganizationID:ws.OrganizationID,
@@ -279,9 +287,11 @@ func taskFromWorkspace(ws codersdk.Workspace, initialPrompt string) codersdk.Tas
279287
TemplateDisplayName:ws.TemplateDisplayName,
280288
TemplateIcon:ws.TemplateIcon,
281289
WorkspaceID: uuid.NullUUID{Valid:true,UUID:ws.ID},
290+
WorkspaceBuildNumber:ws.LatestBuild.BuildNumber,
282291
WorkspaceAgentID:taskAgentID,
283292
WorkspaceAgentLifecycle:taskAgentLifecycle,
284293
WorkspaceAgentHealth:taskAgentHealth,
294+
WorkspaceAppID:appID,
285295
CreatedAt:ws.CreatedAt,
286296
UpdatedAt:ws.UpdatedAt,
287297
InitialPrompt:initialPrompt,

‎coderd/aitasks_test.go‎

Lines changed: 70 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",
@@ -1051,6 +1061,64 @@ func TestTasksNotification(t *testing.T) {
10511061
notificationTemplate:notifications.TemplateTaskIdle,
10521062
taskPrompt:"This is a very long task prompt that should be truncated to 160 characters. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
10531063
},
1064+
// Should send TemplateTaskCompleted when the AI task transitions to 'Complete'.
1065+
{
1066+
name:"TemplateTaskCompleted",
1067+
latestAppStatuses: []codersdk.WorkspaceAppStatusState{codersdk.WorkspaceAppStatusStateWorking},
1068+
newAppStatus:codersdk.WorkspaceAppStatusStateComplete,
1069+
isAITask:true,
1070+
isNotificationSent:true,
1071+
notificationTemplate:notifications.TemplateTaskCompleted,
1072+
taskPrompt:"TemplateTaskCompleted",
1073+
},
1074+
// Should send TemplateTaskFailed when the AI task transitions to 'Failure'.
1075+
{
1076+
name:"TemplateTaskFailed",
1077+
latestAppStatuses: []codersdk.WorkspaceAppStatusState{codersdk.WorkspaceAppStatusStateWorking},
1078+
newAppStatus:codersdk.WorkspaceAppStatusStateFailure,
1079+
isAITask:true,
1080+
isNotificationSent:true,
1081+
notificationTemplate:notifications.TemplateTaskFailed,
1082+
taskPrompt:"TemplateTaskFailed",
1083+
},
1084+
// Should send TemplateTaskCompleted when the AI task transitions from 'Idle' to 'Complete'.
1085+
{
1086+
name:"TemplateTaskCompletedFromIdle",
1087+
latestAppStatuses: []codersdk.WorkspaceAppStatusState{codersdk.WorkspaceAppStatusStateIdle},
1088+
newAppStatus:codersdk.WorkspaceAppStatusStateComplete,
1089+
isAITask:true,
1090+
isNotificationSent:true,
1091+
notificationTemplate:notifications.TemplateTaskCompleted,
1092+
taskPrompt:"TemplateTaskCompletedFromIdle",
1093+
},
1094+
// Should send TemplateTaskFailed when the AI task transitions from 'Idle' to 'Failure'.
1095+
{
1096+
name:"TemplateTaskFailedFromIdle",
1097+
latestAppStatuses: []codersdk.WorkspaceAppStatusState{codersdk.WorkspaceAppStatusStateIdle},
1098+
newAppStatus:codersdk.WorkspaceAppStatusStateFailure,
1099+
isAITask:true,
1100+
isNotificationSent:true,
1101+
notificationTemplate:notifications.TemplateTaskFailed,
1102+
taskPrompt:"TemplateTaskFailedFromIdle",
1103+
},
1104+
// Should NOT send notification when transitioning from 'Complete' to 'Complete' (no change).
1105+
{
1106+
name:"NoNotificationCompleteToComplete",
1107+
latestAppStatuses: []codersdk.WorkspaceAppStatusState{codersdk.WorkspaceAppStatusStateComplete},
1108+
newAppStatus:codersdk.WorkspaceAppStatusStateComplete,
1109+
isAITask:true,
1110+
isNotificationSent:false,
1111+
taskPrompt:"NoNotificationCompleteToComplete",
1112+
},
1113+
// Should NOT send notification when transitioning from 'Failure' to 'Failure' (no change).
1114+
{
1115+
name:"NoNotificationFailureToFailure",
1116+
latestAppStatuses: []codersdk.WorkspaceAppStatusState{codersdk.WorkspaceAppStatusStateFailure},
1117+
newAppStatus:codersdk.WorkspaceAppStatusStateFailure,
1118+
isAITask:true,
1119+
isNotificationSent:false,
1120+
taskPrompt:"NoNotificationFailureToFailure",
1121+
},
10541122
} {
10551123
t.Run(tc.name,func(t*testing.T) {
10561124
t.Parallel()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp