Skip to content

Commit 7a3c8a3

Browse files
committed
improve doc on container workspace folder, add todo
1 parent 34aa574 commit 7a3c8a3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

agent/agentcontainers/api.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,9 +1010,15 @@ func (api *API) injectSubAgentIntoContainerLocked(ctx context.Context, dc coders
10101010
// The preparation of the subagent is done, now we can create the
10111011
// subagent record in the database to receive the auth token.
10121012
createdAgent, err := api.subAgentClient.Create(ctx, SubAgent{
1013-
Name: dc.Name,
1014-
Directory: "/workspace", // TODO(mafredri): Use a more appropriate directory.
1015-
OperatingSystem: "linux", // Assuming Linux for dev containers.
1013+
Name: dc.Name,
1014+
// The default workspaceFolder for devcontainers is /workspaces.
1015+
// However, it can be changed by setting {"workspaceFolder": "/src"}
1016+
// in the devcontainer.json. This information is not encoded into
1017+
// the container labels, so we must rely on the values parsed from
1018+
// the devcontainer.json file on disk.
1019+
// TODO(mafredri): Support custom workspace folders in the future.
1020+
Directory: DevcontainerDefaultContainerWorkspaceFolder,
1021+
OperatingSystem: "linux", // Assuming Linux for dev containers.
10161022
Architecture: arch,
10171023
})
10181024
if err != nil {

agent/agentcontainers/devcontainer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const (
1818
// DevcontainerConfigFileLabel is the label that contains the path to
1919
// the devcontainer.json configuration file.
2020
DevcontainerConfigFileLabel = "devcontainer.config_file"
21+
// The default workspace folder inside the devcontainer.
22+
DevcontainerDefaultContainerWorkspaceFolder = "/workspaces"
2123
)
2224

2325
const devcontainerUpScriptTemplate = `

0 commit comments

Comments
 (0)