10000 feat(coderd/agentapi): allow inserting apps for sub agents by DanielleMaywood · Pull Request #18129 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat(coderd/agentapi): allow inserting apps for sub agents #18129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 5, 2025
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: do some more defensive programming
  • Loading branch information
DanielleMaywood committed Jun 5, 2025
commit c8916e12460bd44e4193138faa2277ebc78862df
21 changes: 18 additions & 3 deletions coderd/agentapi/subagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,32 @@
health = database.WorkspaceAppHealthInitializing
}

sharingLevel := database.AppSharingLevelOwner
var sharingLevel database.AppSharingLevel
switch app.GetShare() {
case agentproto.CreateSubAgentRequest_App_OWNER:
sharingLevel = database.AppSharingLevelOwner
case agentproto.CreateSubAgentRequest_App_AUTHENTICATED:
sharingLevel = database.AppSharingLevelAuthenticated
case agentproto.CreateSubAgentRequest_App_PUBLIC:
sharingLevel = database.AppSharingLevelPublic
default:
return codersdk.ValidationError{
Field: "share",
Detail: fmt.Sprint("%q is not a valid app sharing level"),

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / lint

printf: fmt.Sprint call has possible Printf formatting directive %q (govet)

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-race

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-race-pg

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg-16

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go (macos-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go (ubuntu-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go (windows-2022)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg (macos-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg (ubuntu-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 129 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg (ubuntu-latest)

fmt.Sprint call has possible Printf formatting directive %q
}
}

openIn := database.WorkspaceAppOpenInSlimWindow
if app.GetOpenIn() == agentproto.CreateSubAgentRequest_App_TAB {
var openIn database.WorkspaceAppOpenIn
switch app.GetOpenIn() {
case agentproto.CreateSubAgentRequest_App_SLIM_WINDOW:
openIn = database.WorkspaceAppOpenInSlimWindow
case agentproto.CreateSubAgentRequest_App_TAB:
openIn = database.WorkspaceAppOpenInTab
default:
return codersdk.ValidationError{
Field: "open_in",
Detail: fmt.Sprint("%q is not an open in setting"),

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / lint

printf: fmt.Sprint call has possible Printf formatting directive %q (govet)

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-race

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-race-pg

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg-16

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go (macos-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go (ubuntu-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go (windows-2022)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg (macos-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg (ubuntu-latest)

fmt.Sprint call has possible Printf formatting directive %q

Check failure on line 142 in coderd/agentapi/subagent.go

View workflow job for this annotation

GitHub Actions / test-go-pg (ubuntu-latest)

fmt.Sprint call has possible Printf formatting directive %q
}
}

_, err := a.Database.InsertWorkspaceApp(ctx, database.InsertWorkspaceAppParams{
Expand Down
Loading
0