Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(daemon): preserve mise agent shim entrypoints (MUL-9130) (#10466)
Multica Eveeef8f937e432
diff --git a/server/internal/daemon/canonical_path.go b/server/internal/daemon/canonical_path.goindex abb1bce369..e829363bac 100644--- a/server/internal/daemon/canonical_path.go+++ b/server/internal/daemon/canonical_path.go@@ -13,10 +13,10 @@ func canonicalPath(path string) (string, error) {// discoveredExecutablePath canonicalizes ordinary executable symlinks but// preserves entrypoints backed by a known name-dispatching shim. Volta's-// volta-shim and Vite Plus's vp select the managed package from the invoked-// name; spawning the final target directly turns `claude --version` into-// `volta-shim --version` or `vp --version`, so the daemon reads the manager's-// version instead of the agent's and drops the runtime (#6183, #6702).+// volta-shim, Vite Plus's vp, and mise select the managed command from the+// invoked name. Spawning the final target directly probes the manager's+// version instead of the agent's; `mise app-server` also treats app-server+// as a mise task instead of starting Codex (#6183, #6702, #10451).//// The entrypoint's parent is still canonicalized. This keeps paths stable when// their containing directory is a symlink or an ephemeral version-manager@@ -47,7 +47,7 @@ func isNameDispatchingAgentShim(path string) bool {// extensions: these managers use wrappers or trampolines rather than// name-dispatching symlinks, and that is a Windows shape this file never// compiles for.- return base == "volta-shim" || base == "vp"+ return base == "volta-shim" || base == "vp" || base == "mise"}var executablePathForLaunch = executablePathForLaunchDefaultdiff --git a/server/internal/daemon/canonical_path_test.go b/server/internal/daemon/canonical_path_test.goindex 5e829ffa3c..4e724bb430 100644--- a/server/internal/daemon/canonical_path_test.go+++ b/server/internal/daemon/canonical_path_test.go@@ -15,9 +15,12 @@ func TestIsNameDispatchingAgentShim_RequiresExactDispatcherName(t *testing.T) {}{{name: "Volta", path: filepath.Join("manager", "volta-shim"), want: true},{name: "Vite Plus", path: filepath.Join("manager", "vp"), want: true},+ {name: "mise", path: filepath.Join("manager", "mise"), want: true},{name: "case insensitive", path: filepath.Join("manager", "VP"), want: true},{name: "short name prefix", path: filepath.Join("manager", "vpn"), want: false},{name: "short name word", path: filepath.Join("manager", "vproxy"), want: false},+ {name: "mise prefix", path: filepath.Join("manager", "mise-helper"), want: false},+ {name: "mise extension", path: filepath.Join("manager", "mise.exe"), want: false},{name: "extension is not stripped", path: filepath.Join("manager", "volta-shim.exe"), want: false},{name: "ordinary version target", path: filepath.Join("manager", "claude-2.1.216"), want: false},}diff --git a/server/internal/daemon/config_test.go b/server/internal/daemon/config_test.goindex 5b0c02350f..63f516dc5f 100644--- a/server/internal/daemon/config_test.go+++ b/server/internal/daemon/config_test.go@@ -23,22 +23,29 @@ func TestResolveAgentExecutablePath_PreservesDispatchShimName(t *testing.T) {t.Skip("creating symlinks requires elevated privileges on Windows")}- for _, shimName := range []string{"volta-shim", "vp"} {- t.Run(shimName, func(t *testing.T) {+ for _, tt := range []struct {+ shimName string+ command string+ }{+ {shimName: "volta-shim", command: "claude"},+ {shimName: "vp", command: "claude"},+ {shimName: "mise", command: "codex"},+ } {+ t.Run(tt.shimName, func(t *testing.T) {managerDir := t.TempDir()- manager := filepath.Join(managerDir, shimName)- if err := os.WriteFile(manager, []byte("#!/bin/sh\nprintf '%s\\n' \"${0##*/}\"\n"), 0o755); err != nil {+ manager := filepath.Join(managerDir, tt.shimName)+ if err := os.WriteFile(manager, []byte("#!/bin/sh\nprintf '%s\\n' \"${0##*/}\" \"$1\" \"$PWD\"\n"), 0o755); err != nil {t.Fatalf("write dispatcher: %v", err)}binDir := t.TempDir()- entrypoint := filepath.Join(binDir, "claude")+ entrypoint := filepath.Join(binDir, tt.command)if err := os.Symlink(manager, entrypoint); err != nil {t.Fatalf("symlink dispatcher: %v", err)}t.Setenv("PATH", binDir)- got, err := resolveAgentExecutablePath("claude")+ got, err := resolveAgentExecutablePath(tt.command)if err != nil {t.Fatalf("resolveAgentExecutablePath: %v", err)}@@ -46,16 +53,29 @@ func TestResolveAgentExecutablePath_PreservesDispatchShimName(t *testing.T) {if err != nil {t.Fatalf("resolve bin directory: %v", err)}- want := filepath.Join(realBinDir, "claude")+ want := filepath.Join(realBinDir, tt.command)if got != want {t.Fatalf("resolved path = %q, want command-preserving entrypoint %q", got, want)}- output, err := exec.Command(got, "--version").CombinedOutput()+ workDir, err := filepath.EvalSymlinks(t.TempDir())if err != nil {- t.Fatalf("run resolved entrypoint: %v: %s", err, output)+ t.Fatalf("resolve task workdir: %v", err)+ }+ args := []string{"--version"}+ if tt.command == "codex" {+ args = append(args, "app-server")}- if got := strings.TrimSpace(string(output)); got != "claude" {- t.Fatalf("dispatcher observed command name %q, want claude", got)+ for _, arg := range args {+ cmd := exec.Command(got, arg)+ cmd.Dir = workDir+ output, err := cmd.CombinedOutput()+ if err != nil {+ t.Fatalf("run resolved entrypoint with %s: %v: %s", arg, err, output)+ }+ wantOutput := tt.command + "\n" + arg + "\n" + workDir + "\n"+ if string(output) != wantOutput {+ t.Fatalf("dispatcher invocation = %q, want %q", output, wantOutput)+ }}})}