coder / coder/internal

fix(provisioner/terraform): hasExternalAgentResources has same count=0 false-positive as hasAITaskResources

Open
#1,536 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Description

`hasExternalAgentResources` in `provisioner/terraform/resources.go` scans Terraform graph DOT output for `coder_external_agent` node labels, returning `true` regardless of `count`. This is the same class of bug fixed for `hasAITaskResources` in coder/coder#25197.

A template with `coder_external_agent` at `count = 0` will incorrectly report `HasExternalAgents = true`, which:
- Blocks the chat tool from creating workspaces from that template
- Disables workspace actions in the UI
- Affects template search filtering via `has_external_agent:true`

## Fix

Replace the graph-based `hasExternalAgentResources()` with instance-based detection, matching the approach used for `HasAITasks` in coder/coder#25197.

## References

- Sibling fix: coder/coder#25197
- Review comment: https://github.com/coder/coder/pull/25197#discussion_r3235066078

> Generated with [Coder Agents](https://coder.com/agents)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.