Skip to content

feat(sandbox): expose Workdir field in SandboxConfig#853

Open
tuannt23065 wants to merge 1 commit intonextlevelbuilder:devfrom
tuannt23065:feat/sandbox-workdir-config
Open

feat(sandbox): expose Workdir field in SandboxConfig#853
tuannt23065 wants to merge 1 commit intonextlevelbuilder:devfrom
tuannt23065:feat/sandbox-workdir-config

Conversation

@tuannt23065
Copy link
Copy Markdown
Contributor

Tóm tắt

  • Thêm field tuỳ chọn workdir (JSON) vào config.SandboxConfig, map thẳng qua field sandbox.Config.Workdir đã có sẵn.
  • Cho phép mỗi agent (qua JSONB sandbox_config trong DB) override đường dẫn mount workspace bên trong container, thay vì bị khoá cứng ở /workspace.
  • Backward compatible: agent nào không set workdir vẫn dùng default /workspace như cũ.

Lý do

sandbox.Config (internal) vốn đã hỗ trợ custom Workdir — vừa làm working directory vừa làm điểm mount workspace bind-mount bên trong container. Nhưng config.SandboxConfig (JSONB lưu trong agents.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/...
  • Verified end-to-end với agent thật: set sandbox_config.workdir = "/shared", agent workspace trỏ vào host dir, GoClaw spawn sandbox container với -v <host>:/shared -w /shared và scripts chạy đúng như mong đợi.
  • Sandbox integration tests sẵn có vẫn green (không có behavior change khi workdir không set).

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant