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

feat(agent/agentcontainers): support apps for dev container agents#18346

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 16 commits intomainfromdm-sub-agent-apps-configuration-2
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
eb8a469
feat(agent/agentcontainers): support apps for dev container agents
DanielleMaywoodJun 12, 2025
0dc5bb2
chore: copilot feedback
DanielleMaywoodJun 12, 2025
bcd6689
chore: more changes
DanielleMaywoodJun 13, 2025
91fd4e7
chore: pass env variables + remove accidental commit
DanielleMaywoodJun 13, 2025
c273b23
chore: fix some tests
DanielleMaywoodJun 13, 2025
8698100
chore: fix issues
DanielleMaywoodJun 17, 2025
8ec61b6
chore: fix and update test
DanielleMaywoodJun 17, 2025
ab2e82e
chore: fix oopsie
DanielleMaywoodJun 18, 2025
4db77af
test: add organization sharing level
DanielleMaywoodJun 18, 2025
d3a2583
chore: CODER_DEPLOYMENT_URL -> CODER_URL
DanielleMaywoodJun 18, 2025
20e832a
chore: remove all the pointers
DanielleMaywoodJun 18, 2025
336997b
chore: handle in CloneConfig as well
DanielleMaywoodJun 18, 2025
0ae2616
chore: rename WithUserName and WithWorkspaceName to WithManifestInfo
DanielleMaywoodJun 18, 2025
e17b228
chore: just use PATH
DanielleMaywoodJun 18, 2025
d1da3a1
chore: app deduplication
DanielleMaywoodJun 18, 2025
c6652a1
chore: appease linter
DanielleMaywoodJun 18, 2025
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
PrevPrevious commit
NextNext commit
chore: app deduplication
  • Loading branch information
@DanielleMaywood
DanielleMaywood committedJun 18, 2025
commitd1da3a1cbd31f47fc006f22c7ae8506132ea532e
23 changes: 21 additions & 2 deletionsagent/agentcontainers/api.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1139,7 +1139,7 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
codersdk.DisplayAppPortForward: true,
}

varapps []SubAgentApp
varappsWithPossibleDuplicates []SubAgentApp

if config, err := api.dccli.ReadConfig(ctx, dc.WorkspaceFolder, dc.ConfigPath,
[]string{
Expand All@@ -1165,7 +1165,7 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
displayAppsMap[app] = enabled
}

apps = append(apps, customization.Apps...)
appsWithPossibleDuplicates = append(appsWithPossibleDuplicates, customization.Apps...)
}
}

Expand All@@ -1177,6 +1177,25 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
}
slices.Sort(displayApps)

appSlugs := make(map[string]struct{})
apps := make([]SubAgentApp, 0, len(appsWithPossibleDuplicates))

// We want to deduplicate the apps based on their slugs here.
// As we want to prioritize later apps, we will walk through this
// backwards.
for _, app := range slices.Backward(appsWithPossibleDuplicates) {
if _, slugAlreadyExists := appSlugs[app.Slug]; slugAlreadyExists {
continue
}

appSlugs[app.Slug] = struct{}{}
apps = append(apps, app)
}

// Apps is currently in reverse order here, so by reversing it we restore
// it to the original order.
slices.Reverse(apps)

subAgentConfig.DisplayApps = displayApps
subAgentConfig.Apps = apps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We should log app creation errors from the response after agent creation too.

}
Expand Down
42 changes: 42 additions & 0 deletionsagent/agentcontainers/api_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1688,6 +1688,48 @@ func TestAPI(t *testing.T) {
assert.Equal(t, int32(3), subAgent.Apps[2].Order)
},
},
{
name: "AppDeduplication",
customization: []agentcontainers.CoderCustomization{
{
Apps: []agentcontainers.SubAgentApp{
{
Slug: "foo-app",
Hidden: true,
Order: 1,
},
{
Slug: "bar-app",
},
},
},
{
Apps: []agentcontainers.SubAgentApp{
{
Slug: "foo-app",
Order: 2,
},
{
Slug: "baz-app",
},
},
},
},
afterCreate: func(t *testing.T, subAgent agentcontainers.SubAgent) {
require.Len(t, subAgent.Apps, 3)

// As the original "foo-app" gets overriden by the later "foo-app",
// we expect "bar-app" to be first in the order.
assert.Equal(t, "bar-app", subAgent.Apps[0].Slug)
assert.Equal(t, "foo-app", subAgent.Apps[1].Slug)
assert.Equal(t, "baz-app", subAgent.Apps[2].Slug)

// We do not expect the properties from the original "foo-app" to be
// carried over.
assert.Equal(t, false, subAgent.Apps[1].Hidden)
assert.Equal(t, int32(2), subAgent.Apps[1].Order)
},
},
}

for _, tt := range tests {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp