mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-17 18:14:13 +00:00
feat(sandbox): expose Workdir field in SandboxConfig (#853)
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: tuannt23065 <tuannt23065@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 file changed
+4
@@ -426,6 +426,7 @@ type SandboxConfig struct {
|
||||
User string `json:"user,omitempty"` // container user (e.g. "1000:1000", "nobody")
|
||||
TmpfsSizeMB int `json:"tmpfs_size_mb,omitempty"` // default tmpfs size in MB (0 = Docker default)
|
||||
MaxOutputBytes int `json:"max_output_bytes,omitempty"` // limit exec output capture (default 1MB)
|
||||
Workdir string `json:"workdir,omitempty"` // container workdir + workspace mount target (default "/workspace")
|
||||
|
||||
// Pruning (matching TS SandboxPruneSettings)
|
||||
IdleHours int `json:"idle_hours,omitempty"` // prune containers idle > N hours (default 24)
|
||||
@@ -499,6 +500,9 @@ func (sc *SandboxConfig) ToSandboxConfig() sandbox.Config {
|
||||
if sc.MaxOutputBytes > 0 {
|
||||
cfg.MaxOutputBytes = sc.MaxOutputBytes
|
||||
}
|
||||
if sc.Workdir != "" {
|
||||
cfg.Workdir = sc.Workdir
|
||||
}
|
||||
|
||||
// Pruning
|
||||
if sc.IdleHours > 0 {
|
||||
|
||||
Reference in new issue
Block a user