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

Commit8ea956f

Browse files
authored
feat: add app status tracking to the backend (#17163)
This does ~95% of the backend work required to integrate the AI work.Most left to integrate from the tasks branch is just frontend, whichwill be a lot smaller I believe.The real difference between this branch and that one is the abstraction-- this now attaches statuses to apps, and returns the latest statusreported as part of a workspace.This change enables us to have a similar UX to in the tasks branch, butfor agents other than Claude Code as well. Any app can report statusnow.
1 parent489641d commit8ea956f

35 files changed

+1668
-69
lines changed

‎cli/testdata/coder_list_--output_json.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"most_recently_seen": null
7070
}
7171
},
72+
"latest_app_status": null,
7273
"outdated": false,
7374
"name": "test-workspace",
7475
"autostart_schedule": "CRON_TZ=US/Central 30 9 * * 1-5",

‎coderd/apidoc/docs.go

Lines changed: 127 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: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/coderd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,7 @@ func New(options *Options) *API {
12281228
}))
12291229
r.Get("/rpc",api.workspaceAgentRPC)
12301230
r.Patch("/logs",api.patchWorkspaceAgentLogs)
1231+
r.Patch("/app-status",api.patchWorkspaceAgentAppStatus)
12311232
// Deprecated: Required to support legacy agents
12321233
r.Get("/gitauth",api.workspaceAgentsGitAuth)
12331234
r.Get("/external-auth",api.workspaceAgentsExternalAuth)

‎coderd/database/db2sdk/db2sdk.go

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ func AppSubdomain(dbApp database.WorkspaceApp, agentName, workspaceName, ownerNa
487487
}.String()
488488
}
489489

490-
funcApps(dbApps []database.WorkspaceApp,agent database.WorkspaceAgent,ownerNamestring,workspace database.Workspace) []codersdk.WorkspaceApp {
490+
funcApps(dbApps []database.WorkspaceApp,statuses []database.WorkspaceAppStatus,agent database.WorkspaceAgent,ownerNamestring,workspace database.Workspace) []codersdk.WorkspaceApp {
491491
sort.Slice(dbApps,func(i,jint)bool {
492492
ifdbApps[i].DisplayOrder!=dbApps[j].DisplayOrder {
493493
returndbApps[i].DisplayOrder<dbApps[j].DisplayOrder
@@ -498,8 +498,14 @@ func Apps(dbApps []database.WorkspaceApp, agent database.WorkspaceAgent, ownerNa
498498
returndbApps[i].Slug<dbApps[j].Slug
499499
})
500500

501+
statusesByAppID:=map[uuid.UUID][]database.WorkspaceAppStatus{}
502+
for_,status:=rangestatuses {
503+
statusesByAppID[status.AppID]=append(statusesByAppID[status.AppID],status)
504+
}
505+
501506
apps:=make([]codersdk.WorkspaceApp,0)
502507
for_,dbApp:=rangedbApps {
508+
statuses:=statusesByAppID[dbApp.ID]
503509
apps=append(apps, codersdk.WorkspaceApp{
504510
ID:dbApp.ID,
505511
URL:dbApp.Url.String,
@@ -516,14 +522,33 @@ func Apps(dbApps []database.WorkspaceApp, agent database.WorkspaceAgent, ownerNa
516522
Interval:dbApp.HealthcheckInterval,
517523
Threshold:dbApp.HealthcheckThreshold,
518524
},
519-
Health:codersdk.WorkspaceAppHealth(dbApp.Health),
520-
Hidden:dbApp.Hidden,
521-
OpenIn:codersdk.WorkspaceAppOpenIn(dbApp.OpenIn),
525+
Health:codersdk.WorkspaceAppHealth(dbApp.Health),
526+
Hidden:dbApp.Hidden,
527+
OpenIn:codersdk.WorkspaceAppOpenIn(dbApp.OpenIn),
528+
Statuses:WorkspaceAppStatuses(statuses),
522529
})
523530
}
524531
returnapps
525532
}
526533

534+
funcWorkspaceAppStatuses(statuses []database.WorkspaceAppStatus) []codersdk.WorkspaceAppStatus {
535+
returnList(statuses,WorkspaceAppStatus)
536+
}
537+
538+
funcWorkspaceAppStatus(status database.WorkspaceAppStatus) codersdk.WorkspaceAppStatus {
539+
return codersdk.WorkspaceAppStatus{
540+
ID:status.ID,
541+
CreatedAt:status.CreatedAt,
542+
AgentID:status.AgentID,
543+
AppID:status.AppID,
544+
NeedsUserAttention:status.NeedsUserAttention,
545+
URI:status.Uri.String,
546+
Icon:status.Icon.String,
547+
Message:status.Message,
548+
State:codersdk.WorkspaceAppStatusState(status.State),
549+
}
550+
}
551+
527552
funcProvisionerDaemon(dbDaemon database.ProvisionerDaemon) codersdk.ProvisionerDaemon {
528553
result:= codersdk.ProvisionerDaemon{
529554
ID:dbDaemon.ID,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp