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

fix(agent): disable dev container integration inside sub agents#18781

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

Conversation

DanielleMaywood
Copy link
Contributor

It appears we accidentally broke this logic in a previous PR. This should now correctly disable the agent api as we'd expect.

…gentIt appears we accidentally broke this logic in a previous PR. Thisshould now correctly disable the agent api as we'd expect.
@@ -2441,7 +2441,8 @@ func TestAgent_DevcontainersDisabledForSubAgent(t *testing.T) {

// Setup the agent with devcontainers enabled initially.
//nolint:dogsled
conn, _, _, _, _ := setupAgent(t, manifest, 0, func(*agenttest.Client, *agent.Options) {
conn, _, _, _, _ := setupAgent(t, manifest, 0, func(_ *agenttest.Client, o *agent.Options) {
o.Devcontainers = true
Copy link
ContributorAuthor

@DanielleMaywoodDanielleMaywoodJul 7, 2025
edited
Loading

Choose a reason for hiding this comment

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

It appears the test allowed the regression to occur as it had Dev Containersdisabled by default. This means it didn't properly test the flow we'd expect.

mafredri reacted with thumbs up emoji
Comment on lines +339 to +348
containerAPIOpts := []agentcontainers.Option{
agentcontainers.WithExecer(a.execer),
agentcontainers.WithCommandEnv(a.sshServer.CommandEnv),
agentcontainers.WithScriptLogger(func(logSourceID uuid.UUID) agentcontainers.ScriptLogger {
return a.logSender.GetScriptLogger(logSourceID)
}),
}
containerAPIOpts = append(containerAPIOpts, a.containerAPIOptions...)

a.containerAPI = agentcontainers.NewAPI(a.logger.Named("containers"), containerAPIOpts...)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We're going to create the API by default. This is fine as we onlyInit and thenStart at a later stage. This allows us to assumecontainerAPI will always be anon-nil value.

mafredri reacted with thumbs up emoji
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR restores correct behavior for the dev container API by disabling it when running inside a sub-agent and adjusting the user-facing error messages accordingly.

  • Update the/api/v0/containers handler to checkdevcontainers flag first, then explicitly forbid calls from sub-agents.
  • Adjust test to enableDevcontainers in options and assert on the new error text.
  • Remove conditional guard aroundcontainerAPI instantiation/closure to align API setup with the new flag-based routing.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
agent/api.goRevised routing logic for/api/v0/containers based on flags and manifest parent.
agent/agent_test.goEnabledDevcontainers option in setup and updated expected error messages.
agent/agent.goRemovedif a.devcontainers guard socontainerAPI is always created and closed.
Comments suppressed due to low confidence (1)

agent/agent.go:348

  • SincecontainerAPI is now instantiated unconditionally, consider wrapping its creation in thedevcontainers flag guard to avoid unnecessary resource allocation when the feature is disabled.
a.containerAPI = agentcontainers.NewAPI(a.logger.Named("containers"), containerAPIOpts...)

Comment on lines +2457 to +2458
require.Contains(t, err.Error(), "Dev Containerfeature notsupported.")
require.Contains(t, err.Error(), "Dev Container integration inside other Dev Containers is explicitly not supported.")
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Reminder to runCODER_TEST_USE_DOCKER=1 go test ./coderd ./agent ./agent/agentcontainers if you want to verify the "integration" tests.

@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewJuly 7, 2025 22:05
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

Looks solid! 👍🏻

@DanielleMaywoodDanielleMaywood merged commit0118e75 intomainJul 8, 2025
34 checks passed
@DanielleMaywoodDanielleMaywood deleted the danielle/stop-devcontainer-in-devcontainer branchJuly 8, 2025 10:05
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 8, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

Copilot code reviewCopilotCopilot left review comments

@mafredrimafredrimafredri approved these changes

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@DanielleMaywood@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp