From 0e37086ee468e6e3b697c32b7f02280ee06f5116 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 16 Mar 2026 01:46:20 +0000 Subject: fix: permission denied and host key verification errors; add gemini elaboration fallback --- internal/executor/claude.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'internal/executor/claude.go') diff --git a/internal/executor/claude.go b/internal/executor/claude.go index f8b0ac2..7e79ce0 100644 --- a/internal/executor/claude.go +++ b/internal/executor/claude.go @@ -116,10 +116,11 @@ func (r *ClaudeRunner) Run(ctx context.Context, t *task.Task, e *storage.Executi e.SandboxDir = "" if projectDir != "" { var err error - sandboxDir, err = setupSandbox(projectDir) + sandboxDir, err := setupSandbox(t.Agent.ProjectDir, r.Logger) if err != nil { return fmt.Errorf("setting up sandbox: %w", err) } + effectiveWorkingDir = sandboxDir r.Logger.Info("fresh sandbox created for resume", "sandbox", sandboxDir, "project_dir", projectDir) } @@ -127,10 +128,11 @@ func (r *ClaudeRunner) Run(ctx context.Context, t *task.Task, e *storage.Executi } } else if projectDir != "" { var err error - sandboxDir, err = setupSandbox(projectDir) + sandboxDir, err := setupSandbox(t.Agent.ProjectDir, r.Logger) if err != nil { return fmt.Errorf("setting up sandbox: %w", err) } + effectiveWorkingDir = sandboxDir r.Logger.Info("sandbox created", "sandbox", sandboxDir, "project_dir", projectDir) } @@ -236,8 +238,11 @@ func gitSafe(args ...string) []string { func sandboxCloneSource(projectDir string) string { for _, remote := range []string{"local", "origin"} { out, err := exec.Command("git", gitSafe("-C", projectDir, "remote", "get-url", remote)...).Output() - if err == nil && len(strings.TrimSpace(string(out))) > 0 { - return strings.TrimSpace(string(out)) + if err == nil { + u := strings.TrimSpace(string(out)) + if u != "" && (strings.HasPrefix(u, "/") || strings.HasPrefix(u, "file://")) { + return u + } } } return projectDir @@ -245,7 +250,7 @@ func sandboxCloneSource(projectDir string) string { // setupSandbox prepares a temporary git clone of projectDir. // If projectDir is not a git repo it is initialised with an initial commit first. -func setupSandbox(projectDir string) (string, error) { +func setupSandbox(projectDir string, logger *slog.Logger) (string, error) { // Ensure projectDir is a git repo; initialise if not. if err := exec.Command("git", gitSafe("-C", projectDir, "rev-parse", "--git-dir")...).Run(); err != nil { cmds := [][]string{ -- cgit v1.2.3