feat(sandbox): expose Workdir field in SandboxConfig#853
Open
tuannt23065 wants to merge 1 commit intonextlevelbuilder:devfrom
Open
feat(sandbox): expose Workdir field in SandboxConfig#853tuannt23065 wants to merge 1 commit intonextlevelbuilder:devfrom
tuannt23065 wants to merge 1 commit intonextlevelbuilder:devfrom
Conversation
The internal sandbox.Config already supports a custom container Workdir that doubles as the workspace mount target, but config.SandboxConfig (the JSONB-backed per-agent config) did not expose it. Without this, agents must use the hardcoded /workspace mount point even when their scripts expect a different in-container path. Adds an optional "workdir" JSON field that maps through to sandbox.Config.Workdir. Backward compatible — existing agents without workdir set fall back to the /workspace default. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tóm tắt
workdir(JSON) vàoconfig.SandboxConfig, map thẳng qua fieldsandbox.Config.Workdirđã có sẵn.sandbox_configtrong DB) override đường dẫn mount workspace bên trong container, thay vì bị khoá cứng ở/workspace.workdirvẫn dùng default/workspacenhư cũ.Lý do
sandbox.Config(internal) vốn đã hỗ trợ customWorkdir— vừa làm working directory vừa làm điểm mount workspace bind-mount bên trong container. Nhưngconfig.SandboxConfig(JSONB lưu trongagents.sandbox_config) lại không expose field này ra. Hệ quả: bất kỳ agent nào có scripts hardcode đường dẫn khác/workspace(ví dụ tooling mong đợi/shared,/srv,/data, ...) đều không có cách nào để GoClaw mount workspace vào đúng vị trí — chỉ còn 2 workaround cồng kềnh: patch lại toàn bộ scripts, hoặc bake symlink vào sandbox image.Patch 4 dòng này đóng được khe hở đó mà không thay đổi behavior với user hiện tại.
Test plan
go build ./internal/config/...go vet ./internal/config/...sandbox_config.workdir = "/shared", agent workspace trỏ vào host dir, GoClaw spawn sandbox container với-v <host>:/shared -w /sharedvà scripts chạy đúng như mong đợi.workdirkhông set).