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/agentcontainers): chown coder binary#18611

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
DanielleMaywood merged 3 commits intomainfromdanielle/maybe-fix-devcontainer
Jun 26, 2025

Conversation

DanielleMaywood
Copy link
Contributor

No description provided.

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 adds achown step to ensure thecoder binary inside the container is owned by the container user, and updates tests to expect this new step.

  • Inject achown ExecAs call inmaybeInjectSubAgentIntoContainerLocked to set binary ownership.
  • Add matching mockedExecAs(... chown ...) expectations in multiple tests.

Reviewed Changes

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

FileDescription
agent/agentcontainers/api.goInsert a shell-basedchown call to set ownership on the agent binary
agent/agentcontainers/api_test.goAdd mockedExecAs expectations for thechown call in tests
Comments suppressed due to low confidence (1)

agent/agentcontainers/api.go:1445

  • [nitpick] The comment mentions ensuring the binary is executable, but this block actually changes ownership via chown. Consider updating the comment to reflect setting ownership (e.g., "Ensure the agent binary is owned by the container user").
// Make sure the agent binary is executable so we can run it.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewJune 26, 2025 15:37
@DanielleMaywoodDanielleMaywood merged commit5ae320e intomainJun 26, 2025
36 checks passed
@DanielleMaywoodDanielleMaywood deleted the danielle/maybe-fix-devcontainer branchJune 26, 2025 15:42
// Make sure the agent binary is executable so we can run it.
if _, err := api.ccli.ExecAs(ctx, container.ID, "root", "/bin/sh", "-c", fmt.Sprintf("chown $(id -u):$(id -g) %s", coderPathInsideContainer)); err != nil {
return xerrors.Errorf("set agent binary ownership: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to chown the folder as well or not?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I don't think so.

Copy link
Member

Choose a reason for hiding this comment

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

It worked for me without

@@ -1442,6 +1442,11 @@ func (api *API) maybeInjectSubAgentIntoContainerLocked(ctx context.Context, dc c
return xerrors.Errorf("set agent binary executable: %w", err)
}

// Make sure the agent binary is executable so we can run it.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Make sure the agent binary isexecutable so we can run it.
// Make sure the agent binary isowned by a valid user so we can run it.

Perhaps?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oops, just hit the green button as you replied 🤦‍♀️ Second time I've done this 😅

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I've got another PR up so I'll add add the change to that PR, I need to be a little less quick on merging

@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 26, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

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.

3 participants
@DanielleMaywood@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp