From 9495179923aef341d1d9b7bbfd6ef4423872789e Mon Sep 17 00:00:00 2001 From: Jiang Bohan Date: Tue, 7 Apr 2026 15:01:48 +0800 Subject: [PATCH] fix(daemon): ensure multica CLI is on PATH in agent task environment Prepend the directory of the running multica binary to PATH in the agent's environment variables. This fixes the issue where isolated runtimes (e.g. Codex sandbox) cannot find the multica CLI, causing agent tasks to fail immediately with "command not found: multica". Closes #451 --- server/internal/daemon/daemon.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.go index 9d1b494a..b264d04c 100644 --- a/server/internal/daemon/daemon.go +++ b/server/internal/daemon/daemon.go @@ -921,6 +921,14 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, taskLo "MULTICA_AGENT_ID": task.AgentID, "MULTICA_TASK_ID": task.ID, } + // Ensure the multica CLI is on PATH inside the agent's environment. + // Some runtimes (e.g. Codex) run in an isolated sandbox that may not + // inherit the daemon's PATH. Prepend the directory of the running + // multica binary so that `multica` commands in the agent always resolve. + if selfBin, err := os.Executable(); err == nil { + binDir := filepath.Dir(selfBin) + agentEnv["PATH"] = binDir + string(os.PathListSeparator) + os.Getenv("PATH") + } // Point Codex to the per-task CODEX_HOME so it discovers skills natively // without polluting the system ~/.codex/skills/. if env.CodexHome != "" {