Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

fix(workspace): install Cursor CLI and pinned dsh in capability-dropped sandboxes (#597)

crispinhu27e48ced5fa09d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 258f94ec..111bd8ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ Platform releases use `vX.Y.Z` tags and publish `ghcr.io/tencent/loopforge`. Loo
## Unreleased
- The platform image bundles DeepSeek Harness `@deepseek-ai/[email protected]` next to Codex and CodeBuddy, so a DeepSeek key works in conversations and SOP roles without an install step. 0.3.8 had no `dsh` and answered a DeepSeek Harness chat with “AI 助手生成失败,请稍后重试”. The image download grows by about 180 MB. An installation without the image installs the same pinned version from the conversation: every dsh release is a prerelease requiring Node 24.9, and npm on Node 22 found no version for the bare package name.
+- A conversation workspace whose image lacks the chosen CLI installs Cursor CLI and Antigravity again. The sandbox drops every capability, so the installer's `tar` running as root could not restore the archive owner (`Cannot change ownership to uid 2000`), and the turn failed with “准备 cursor 原生CLI失败”. The workspace install of DeepSeek Harness uses the pinned `@deepseek-ai/[email protected]` with relaxed engines, as the platform install already did; the bare package name resolved to no version.
- A DeepSeek Harness reply longer than 8 KB (about 2,700 Chinese characters) is shown in full. `dsh --json` cuts every event string at 8 KiB and only its `final` event carries the whole answer, so the chat stopped mid-sentence while the saved reply was complete.
- SOP sandboxes of the published image install OpenCode, Kimi Code and Pi on first use, as they already did for Claude Code. An SOP role on one of these CLIs used to fail with `exec: <cli>: not found` (exit 127) even after a conversation installed it.
- Run logs and telemetry redact every environment variable ending in `_API_KEY`, `_TOKEN`, `_SECRET` or `_PASSWORD`. Agent CLI keys such as `DEEPSEEK_API_KEY`, and `AGENTFLOW_CLI_API_KEY` used with a custom Base URL, used to appear in clear text in the `docker exec` line of an SOP run log, readable by project members. Rotate a key that ran an SOP role before this release.
diff --git a/internal/runtime/conversation_sandbox.go b/internal/runtime/conversation_sandbox.go
index 1f92a276..78930adb 100644
--- a/internal/runtime/conversation_sandbox.go
+++ b/internal/runtime/conversation_sandbox.go
@@ -131,11 +131,15 @@ func ensureConversationCLI(ctx context.Context, sandbox Sandbox, provider, home
func conversationCLISetup(provider, binary string) (string, error) {
packages := map[string]string{
"codebuddy": "@tencent-ai/codebuddy-code", "codex": "@openai/codex", "claude-code": "@anthropic-ai/claude-code",
- AgentCLIOpenCode: "opencode-ai", AgentCLIKimi: "@moonshot-ai/kimi-code", AgentCLIPi: "@earendil-works/pi-coding-agent", AgentCLIDeepSeek: "@deepseek-ai/dsh",
+ AgentCLIOpenCode: "opencode-ai", AgentCLIKimi: "@moonshot-ai/kimi-code", AgentCLIPi: "@earendil-works/pi-coding-agent", AgentCLIDeepSeek: "@deepseek-ai/dsh@" + DeepSeekHarnessVersion,
}
installer := ""
if pkg := packages[provider]; pkg != "" {
- installer = "npm install --no-audit --no-fund --prefix /opt/loopforge/conversation-cli " + shellSingleQuote(pkg) + " >&2\nln -sf ../node_modules/.bin/" + shellSingleQuote(binary) + " /opt/loopforge/conversation-cli/bin/" + shellSingleQuote(binary)
+ flags := ""
+ if provider == AgentCLIDeepSeek {
+ flags = "--engine-strict=false "
+ }
+ installer = "npm install --no-audit --no-fund " + flags + "--prefix /opt/loopforge/conversation-cli " + shellSingleQuote(pkg) + " >&2\nln -sf ../node_modules/.bin/" + shellSingleQuote(binary) + " /opt/loopforge/conversation-cli/bin/" + shellSingleQuote(binary)
} else {
switch provider {
case AgentCLIZCode:
@@ -150,9 +154,12 @@ func conversationCLISetup(provider, binary string) (string, error) {
return "", fmt.Errorf("不支持的会话CLI %s", provider)
}
}
+ // Setup runs as root in a --cap-drop=ALL container, where GNU tar's default
+ // of restoring archive owners fails with EPERM.
return "set -eu\n" +
`PATH=/opt/loopforge/conversation-cli/bin:/opt/loopforge/conversation-cli/.local/bin:$PATH
-export PATH
+TAR_OPTIONS=--no-same-owner
+export PATH TAR_OPTIONS
if ! command -v python3 >/dev/null 2>&1; then
if command -v apt-get >/dev/null 2>&1; then apt-get update >&2 && apt-get install -y python3 >&2
elif command -v apk >/dev/null 2>&1; then apk add --no-cache python3 >&2