From b459d405312487b74149cc7591653b78adf559d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C3=A2n?= Date: Fri, 10 Jul 2026 15:56:31 +0700 Subject: [PATCH] feat(sandbox): expose Workdir field in SandboxConfig (#853) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Claude Opus 4.6 (1M context) --- internal/config/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 767094a6..0f5eefb4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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 {