Skip to content

feat(devcontainer): add optional name attribute to prevent sub-agent name collisions#519

Open
mmustafasenoglu wants to merge 1 commit into
coder:mainfrom
mmustafasenoglu:fix-devcontainer-name-collision
Open

feat(devcontainer): add optional name attribute to prevent sub-agent name collisions#519
mmustafasenoglu wants to merge 1 commit into
coder:mainfrom
mmustafasenoglu:fix-devcontainer-name-collision

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Problem

When using for_each or count with coder_devcontainer, all instances share the same Terraform block name, causing sub-agent name collisions:

insert devcontainer "repos" subagent: insert subagent:
pq: workspace agent name "repos" already exists in this workspace build

Fix

Added an optional name attribute to the coder_devcontainer resource schema. When set, this name takes precedence over the Terraform block name when constructing the sub-agent name.

resource "coder_devcontainer" "repos" {
  for_each         = local.repos
  name             = each.value   # new attribute
  agent_id         = coder_agent.dev[0].id
  workspace_folder = "/home/user/workspaces/${each.value}"
  config_path      = "..."
}

Testing

Added TestDevcontainerWithName test case verifying the new attribute is properly stored.

Note: Server-side changes in coder/coder are also needed to read and use this name attribute when constructing the proto.Devcontainer.

Fixes #503

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mmustafasenoglu mmustafasenoglu force-pushed the fix-devcontainer-name-collision branch from af22e85 to 327caa3 Compare June 28, 2026 12:01
…name collisions

When using for_each or count with coder_devcontainer, all instances
share the same Terraform block name, causing sub-agent name collisions.

This change adds an optional 'name' attribute that allows overriding
the sub-agent name. When set, this name takes precedence over the
Terraform block name.

Fixes coder#503
@mmustafasenoglu mmustafasenoglu force-pushed the fix-devcontainer-name-collision branch from 327caa3 to 987edd9 Compare June 28, 2026 12:06
@mmustafasenoglu

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@mmustafasenoglu

Copy link
Copy Markdown
Author

recheck

@mmustafasenoglu

Copy link
Copy Markdown
Author

Hi maintainers!

I've signed the CLA by commenting 'I have read the CLA Document and I hereby sign the CLA' but the CLA Assistant check is still failing. Could you please manually approve the CLA or re-trigger the CLA check?

The PR adds an optional attribute to to prevent sub-agent name collisions when using / (fixes #503).

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coder_devcontainer: sub-agent name collides when using for_each / count; no way to override

1 participant