From e184b1e5b06317764d828c793f7876ebc2d4799a Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Thu, 2 Apr 2026 00:55:41 +0000 Subject: [PATCH 1/2] fix(kugetsu): export KUGETSU_TEMP_DIR for subagent workflows Export KUGETSU_TEMP_DIR in cmd_delegate so subagents can use it instead of /tmp which may be blocked by opencode. Default: ~/.local/share/opencode/tool-output This allows agents to write temp files in an allowed directory instead of /tmp which is blocked in headless mode. Fixes #73 --- skills/kugetsu/scripts/kugetsu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/skills/kugetsu/scripts/kugetsu b/skills/kugetsu/scripts/kugetsu index 29348bc..3b77ea0 100755 --- a/skills/kugetsu/scripts/kugetsu +++ b/skills/kugetsu/scripts/kugetsu @@ -563,8 +563,10 @@ cmd_delegate() { mkdir -p "$LOGS_DIR" local log_file="$LOGS_DIR/delegate-$(date +%s).log" + local temp_dir="${KUGETSU_TEMP_DIR:-$HOME/.local/share/opencode/tool-output}" + mkdir -p "$ENV_DIR" - local env_sh="set -a; " + local env_sh="set -a; export KUGETSU_TEMP_DIR='$temp_dir'; " if [ -f "$ENV_DIR/pm-agent.env" ]; then env_sh="${env_sh}source '$ENV_DIR/pm-agent.env'; " elif [ -f "$ENV_DIR/default.env" ]; then -- 2.49.1 From c0d43149334c41cdfc770bc9024b17aacb69c428 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Thu, 2 Apr 2026 01:18:49 +0000 Subject: [PATCH 2/2] test: add KUGETSU_TEMP_DIR export test Add unit test to verify KUGETSU_TEMP_DIR is exported in cmd_delegate. Also update SKILL.md to document KUGETSU_TEMP_DIR config option. --- skills/kugetsu/SKILL.md | 1 + skills/kugetsu/tests/test-kugetsu-v2.sh | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/skills/kugetsu/SKILL.md b/skills/kugetsu/SKILL.md index 4308870..c3a7684 100644 --- a/skills/kugetsu/SKILL.md +++ b/skills/kugetsu/SKILL.md @@ -47,6 +47,7 @@ A default config file is created during `kugetsu init` with commented examples: | Variable | Default | Description | |----------|---------|-------------| | `MAX_CONCURRENT_AGENTS` | 3 | Maximum number of concurrent dev agents | +| `KUGETSU_TEMP_DIR` | `~/.local/share/opencode/tool-output` | Temp directory for subagent tool output (useful in headless environments where /tmp is restricted) | ### Environment Variables for Agents diff --git a/skills/kugetsu/tests/test-kugetsu-v2.sh b/skills/kugetsu/tests/test-kugetsu-v2.sh index 6ee0b4f..9d474d7 100644 --- a/skills/kugetsu/tests/test-kugetsu-v2.sh +++ b/skills/kugetsu/tests/test-kugetsu-v2.sh @@ -634,6 +634,15 @@ else fi echo "" +# Test E7: KUGETSU_TEMP_DIR is exported in cmd_delegate +echo "--- Test: KUGETSU_TEMP_DIR export in cmd_delegate ---" +if grep -q "KUGETSU_TEMP_DIR" "$KUGETSU" && grep -q "export KUGETSU_TEMP_DIR" "$KUGETSU"; then + pass "KUGETSU_TEMP_DIR is exported to delegated agents" +else + fail "KUGETSU_TEMP_DIR not found in cmd_delegate export" +fi +echo "" + # Cleanup env files rm -rf ~/.kugetsu/env 2>/dev/null || true -- 2.49.1