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

Commit0b96862

Browse files
chore(coderd): introduce TaskAppID and deprecate AITaskSidebarAppID
As we're moving away from the SidebarAppID nomenclature, this PRintroduces a new `TaskAppID` field to `codersdk.WorkspaceBuild` anddeprecates the `AITaskSidebarAppID` field. They both contain the samevalue.
1 parent77e8d2b commit0b96862

File tree

13 files changed

+66
-36
lines changed

13 files changed

+66
-36
lines changed

‎coderd/aitasks.go‎

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

271271
varappID uuid.NullUUID
272-
ifws.LatestBuild.AITaskSidebarAppID!=nil {
272+
ifws.LatestBuild.TaskAppID!=nil {
273273
appID= uuid.NullUUID{
274274
Valid:true,
275-
UUID:*ws.LatestBuild.AITaskSidebarAppID,
275+
UUID:*ws.LatestBuild.TaskAppID,
276276
}
277277
}
278278

@@ -667,9 +667,9 @@ func (api *API) taskDelete(rw http.ResponseWriter, r *http.Request) {
667667
// @Router /api/experimental/tasks/{user}/{id}/send [post]
668668
//
669669
// EXPERIMENTAL: This endpoint is experimental and not guaranteed to be stable.
670-
// taskSend submits task input to thetasks sidebar app by dialing the agent
670+
// taskSend submits task input to thetask app by dialing the agent
671671
// directly over the tailnet. We enforce ApplicationConnect RBAC on the
672-
// workspace and validate thesidebar app health.
672+
// workspace and validate thetask app health.
673673
func (api*API)taskSend(rw http.ResponseWriter,r*http.Request) {
674674
ctx:=r.Context()
675675

@@ -693,7 +693,7 @@ func (api *API) taskSend(rw http.ResponseWriter, r *http.Request) {
693693
return
694694
}
695695

696-
iferr=api.authAndDoWithTaskSidebarAppClient(r,taskID,func(ctx context.Context,client*http.Client,appURL*url.URL)error {
696+
iferr=api.authAndDoWithTaskAppClient(r,taskID,func(ctx context.Context,client*http.Client,appURL*url.URL)error {
697697
agentAPIClient,err:=aiagentapi.NewClient(appURL.String(),aiagentapi.WithHTTPClient(client))
698698
iferr!=nil {
699699
returnhttperror.NewResponseError(http.StatusBadGateway, codersdk.Response{
@@ -749,7 +749,7 @@ func (api *API) taskSend(rw http.ResponseWriter, r *http.Request) {
749749
//
750750
// EXPERIMENTAL: This endpoint is experimental and not guaranteed to be stable.
751751
// taskLogs reads task output by dialing the agent directly over the tailnet.
752-
// We enforce ApplicationConnect RBAC on the workspace and validate thesidebar app health.
752+
// We enforce ApplicationConnect RBAC on the workspace and validate thetask app health.
753753
func (api*API)taskLogs(rw http.ResponseWriter,r*http.Request) {
754754
ctx:=r.Context()
755755

@@ -763,7 +763,7 @@ func (api *API) taskLogs(rw http.ResponseWriter, r *http.Request) {
763763
}
764764

765765
varout codersdk.TaskLogsResponse
766-
iferr:=api.authAndDoWithTaskSidebarAppClient(r,taskID,func(ctx context.Context,client*http.Client,appURL*url.URL)error {
766+
iferr:=api.authAndDoWithTaskAppClient(r,taskID,func(ctx context.Context,client*http.Client,appURL*url.URL)error {
767767
agentAPIClient,err:=aiagentapi.NewClient(appURL.String(),aiagentapi.WithHTTPClient(client))
768768
iferr!=nil {
769769
returnhttperror.NewResponseError(http.StatusBadGateway, codersdk.Response{
@@ -811,16 +811,16 @@ func (api *API) taskLogs(rw http.ResponseWriter, r *http.Request) {
811811
httpapi.Write(ctx,rw,http.StatusOK,out)
812812
}
813813

814-
//authAndDoWithTaskSidebarAppClient centralizes the shared logic to:
814+
//authAndDoWithTaskAppClient centralizes the shared logic to:
815815
//
816816
// - Fetch the task workspace
817817
// - Authorize ApplicationConnect on the workspace
818-
// - Validate the AI task andsidebar app health
818+
// - Validate the AI task andtask app health
819819
// - Dial the agent and construct an HTTP client to the apps loopback URL
820820
//
821821
// The provided callback receives the context, an HTTP client that dials via the
822822
// agent, and the base app URL (as a value URL) to perform any request.
823-
func (api*API)authAndDoWithTaskSidebarAppClient(
823+
func (api*API)authAndDoWithTaskAppClient(
824824
r*http.Request,
825825
taskID uuid.UUID,
826826
dofunc(ctx context.Context,client*http.Client,appURL*url.URL)error,
@@ -855,19 +855,19 @@ func (api *API) authAndDoWithTaskSidebarAppClient(
855855
returnhttperror.ErrResourceNotFound
856856
}
857857
build:=data.builds[0]
858-
ifbuild.HasAITask==nil||!*build.HasAITask||build.AITaskSidebarAppID==nil||*build.AITaskSidebarAppID==uuid.Nil {
858+
ifbuild.HasAITask==nil||!*build.HasAITask||build.TaskAppID==nil||*build.TaskAppID==uuid.Nil {
859859
returnhttperror.NewResponseError(http.StatusBadRequest, codersdk.Response{
860-
Message:"Task is not configured with asidebar app.",
860+
Message:"Task is not configured with atask app.",
861861
})
862862
}
863863

864-
// Find thesidebar app details to get the URL and validate app health.
865-
sidebarAppID:=*build.AITaskSidebarAppID
866-
agentID,sidebarApp,ok:=func() (uuid.UUID, codersdk.WorkspaceApp,bool) {
864+
// Find thetask app details to get the URL and validate app health.
865+
taskAppID:=*build.TaskAppID
866+
agentID,taskApp,ok:=func() (uuid.UUID, codersdk.WorkspaceApp,bool) {
867867
for_,res:=rangebuild.Resources {
868868
for_,agent:=rangeres.Agents {
869869
for_,app:=rangeagent.Apps {
870-
ifapp.ID==sidebarAppID {
870+
ifapp.ID==taskAppID {
871871
returnagent.ID,app,true
872872
}
873873
}
@@ -877,32 +877,32 @@ func (api *API) authAndDoWithTaskSidebarAppClient(
877877
}()
878878
if!ok {
879879
returnhttperror.NewResponseError(http.StatusBadRequest, codersdk.Response{
880-
Message:"Tasksidebarapp not found in latest build.",
880+
Message:"Task app not found in latest build.",
881881
})
882882
}
883883

884884
// Return an informative error if the app isn't healthy rather than trying
885885
// and failing.
886-
switchsidebarApp.Health {
886+
switchtaskApp.Health {
887887
casecodersdk.WorkspaceAppHealthDisabled:
888888
// No health check, pass through.
889889
casecodersdk.WorkspaceAppHealthInitializing:
890890
returnhttperror.NewResponseError(http.StatusServiceUnavailable, codersdk.Response{
891-
Message:"Tasksidebarapp is initializing. Try again shortly.",
891+
Message:"Task app is initializing. Try again shortly.",
892892
})
893893
casecodersdk.WorkspaceAppHealthUnhealthy:
894894
returnhttperror.NewResponseError(http.StatusServiceUnavailable, codersdk.Response{
895-
Message:"Tasksidebarapp is unhealthy.",
895+
Message:"Task app is unhealthy.",
896896
})
897897
}
898898

899899
// Build the direct app URL and dial the agent.
900-
ifsidebarApp.URL=="" {
900+
iftaskApp.URL=="" {
901901
returnhttperror.NewResponseError(http.StatusInternalServerError, codersdk.Response{
902-
Message:"Tasksidebarapp URL is not configured.",
902+
Message:"Task app URL is not configured.",
903903
})
904904
}
905-
parsedURL,err:=url.Parse(sidebarApp.URL)
905+
parsedURL,err:=url.Parse(taskApp.URL)
906906
iferr!=nil {
907907
returnhttperror.NewResponseError(http.StatusInternalServerError, codersdk.Response{
908908
Message:"Internal error parsing task app URL.",

‎coderd/apidoc/docs.go‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/workspacebuilds.go‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,9 @@ func (api *API) convertWorkspaceBuild(
11811181
ifbuild.HasAITask.Valid {
11821182
hasAITask=&build.HasAITask.Bool
11831183
}
1184-
varaiTasksSidebarAppID*uuid.UUID
1184+
vartaskAppID*uuid.UUID
11851185
ifbuild.AITaskSidebarAppID.Valid {
1186-
aiTasksSidebarAppID=&build.AITaskSidebarAppID.UUID
1186+
taskAppID=&build.AITaskSidebarAppID.UUID
11871187
}
11881188

11891189
varhasExternalAgent*bool
@@ -1218,7 +1218,8 @@ func (api *API) convertWorkspaceBuild(
12181218
MatchedProvisioners:&matchedProvisioners,
12191219
TemplateVersionPresetID:presetID,
12201220
HasAITask:hasAITask,
1221-
AITaskSidebarAppID:aiTasksSidebarAppID,
1221+
AITaskSidebarAppID:taskAppID,
1222+
TaskAppID:taskAppID,
12221223
HasExternalAgent:hasExternalAgent,
12231224
},nil
12241225
}

‎codersdk/toolsdk/toolsdk_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ func TestTools(t *testing.T) {
13961396
TaskID:r.Workspace.ID.String(),
13971397
Input:"this is ignored",
13981398
},
1399-
error:"Task is not configured with asidebar app",
1399+
error:"Task is not configured with atask app",
14001400
},
14011401
}
14021402

@@ -1516,7 +1516,7 @@ func TestTools(t *testing.T) {
15161516
args: toolsdk.GetTaskLogsArgs{
15171517
TaskID:r.Workspace.ID.String(),
15181518
},
1519-
error:"Task is not configured with asidebar app",
1519+
error:"Task is not configured with atask app",
15201520
},
15211521
}
15221522

‎codersdk/workspacebuilds.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ type WorkspaceBuild struct {
8989
MatchedProvisioners*MatchedProvisioners`json:"matched_provisioners,omitempty"`
9090
TemplateVersionPresetID*uuid.UUID`json:"template_version_preset_id" format:"uuid"`
9191
HasAITask*bool`json:"has_ai_task,omitempty"`
92-
AITaskSidebarAppID*uuid.UUID`json:"ai_task_sidebar_app_id,omitempty" format:"uuid"`
93-
HasExternalAgent*bool`json:"has_external_agent,omitempty"`
92+
// Deprecated: This field has been replaced with `TaskAppID`
93+
AITaskSidebarAppID*uuid.UUID`json:"ai_task_sidebar_app_id,omitempty" format:"uuid"`
94+
TaskAppID*uuid.UUID`json:"task_app_id,omitempty" format:"uuid"`
95+
HasExternalAgent*bool`json:"has_external_agent,omitempty"`
9496
}
9597

9698
// WorkspaceResource describes resources used to create a workspace, for instance:

‎docs/reference/api/builds.md‎

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp