8000 feat(agent/agentcontainers): implement ignore customization for devcontainers by mafredri · Pull Request #18530 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat(agent/agentcontainers): implement ignore customization for devcontainers #18530

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 5 commits into from
Jun 24, 2025
Merged
Changes from 1 commit
Commits
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
consistency
  • Loading branch information
mafredri committed Jun 24, 2025
commit 2807a9d55683f96f90d3a1069e6571426e12a6bc
18 changes: 9 additions & 9 deletions agent/agentcontainers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,8 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
return xerrors.Errorf("read devcontainer config: %w", err)
}

ignore := config.Configuration.Customizations.Coder.Ignore
if ignore {
dcIgnored := config.Configuration.Customizations.Coder.Ignore
if dcIgnored {
proc.stop()
if proc.agent.ID != uuid.Nil {
// Unlock while doing the delete operation.
Expand All @@ -1158,7 +1158,7 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
proc.agent = SubAgent{}
proc.containerID = ""
api.injectedSubAgentProcs[dc.WorkspaceFolder] = proc
api.ignoredDevcontainers[dc.WorkspaceFolder] = ignore
api.ignoredDevcontainers[dc.WorkspaceFolder] = dcIgnored
return nil
}
}
Expand Down Expand Up @@ -1201,10 +1201,10 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
ranSubAgent := false

// Clean up if injection fails.
var ignored, setIgnored bool
var dcIgnored, setDCIgnored bool
defer func() {
if setIgnored {
api.ignoredDevcontainers[dc.WorkspaceFolder] = ignored
if setDCIgnored {
api.ignoredDevcontainers[dc.WorkspaceFolder] = dcIgnored
}
if !ranSubAgent {
proc.stop()
Expand Down Expand Up @@ -1284,8 +1284,8 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c

// We only allow ignore to be set in the root customization layer to
// prevent weird interactions with devcontainer features.
ignored, setIgnored = config.Configuration.Customizations.Coder.Ignore, true
if ignored {
dcIgnored, setDCIgnored = config.Configuration.Customizations.Coder.Ignore, true
if dcIgnored {
return nil
}

Expand Down Expand Up @@ -1337,7 +1337,7 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
api.logger.Error(ctx, "unable to read devcontainer config", slog.Error(err))
}

if ignored {
if dcIgnored {
proc.stop()
if proc.agent.ID != uuid.Nil {
// If we stop the subagent, we also need to delete it.
Expand Down
0