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): fall back to workspace folder name#18466

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

Draft
DanielleMaywood wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromdm-devcontainer-folder-name

Conversation

DanielleMaywood
Copy link
Contributor

This PR changes the logic for how we decide on an agent name.

Previously it followed these steps:

  1. Use a name fromcustomizations.coder.name
  2. Use a name from the terraform resourcecoder_devcontainer
  3. Use the dev container's friendly name

With this change it now does:

  1. Use a name fromcustomizations.coder.name
  2. Use a name from the terraform resourcecoder_devcontainer
  3. Use a name from the workspace folder
  4. Use the dev container's friendly name

We now attempt to construct a valid agent name from the workspace folder. Should we fail to construct a valid agent name from the workspace folder, we will fall back to the dev container's friendly name.

This PR changes the logic for how we decide on an agent name.Previously it followed these steps:1. Use a name from `customizations.coder.name`2. Use a name from the terraform resource `coder_devcontainer`3. Use the dev container's friendly nameWith this change it now does:1. Use a name from `customizations.coder.name`2. Use a name from the terraform resource `coder_devcontainer`3. Use a name from the workspace folder4. Use the dev container's friendly nameWe now attempt to construct a valid agent name from the workspacefolder. Should we fail to construct a valid agent name from theworkspace folder, we will fall back to the dev container's friendlyname.
Appease the linter and make a test case for `safeAgentName`.
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 enhances agent naming by falling back to the workspace folder name before using the container’s friendly name, and cleans up oldpwd-based logic.

  • AddsWorkspace info toDevcontainerConfig and readsWorkspaceFolder
  • IntroducessafeAgentName (plus regex) to sanitize folder names and updates naming logic
  • Removes exec-based workspace detection and updates tests accordingly, plus adds unit tests forsafeAgentName

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
agent/agentcontainers/devcontainercli.goAddedWorkspace field andDevcontainerWorkspace struct
agent/agentcontainers/devcontainer.goRemoved default workspace constant and exec-based logic
agent/agentcontainers/api.goImportedregexp, addedsafeAgentName and collapsed hyphens
agent/agentcontainers/api_test.goUpdated expected agent names/directories in container tests
agent/agentcontainers/api_internal_test.goNew unit tests coveringsafeAgentName transformations
Comments suppressed due to low confidence (2)

agent/agentcontainers/api.go:635

  • [nitpick] Add a comment explaining that this regex collapses multiple consecutive hyphens into a single hyphen for improved clarity.
var consecutiveHyphenRegex = regexp.MustCompile("-+")

agent/agentcontainers/devcontainercli.go:28

  • [nitpick] Consider adding a brief doc comment forDevcontainerWorkspace and itsWorkspaceFolder field to explain how the workspace folder is used in naming.
type DevcontainerWorkspace struct {

DanielleMaywoodand others added2 commitsJune 20, 2025 12:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@DanielleMaywood

[8]ページ先頭

©2009-2025 Movatter.jp