fix(agentworker): the agent works from its worktree, so a resumed stage in an OpenShell sandbox finds the repository

This commit is contained in:
sam committed 2026-11-15 00:07:29 +11:00
1 parent 7a311a3c74
commit 998c72f8d3
1 file changed
+7
+7
View File
@@ -5,6 +5,7 @@ import (
"context"
"log/slog"
"net/http"
"os"
"time"
"github.com/samcharles93/archie-core/internal/agentexec"
@@ -125,6 +126,12 @@ func run(ctx context.Context, settings Settings, log *slog.Logger, dependencies
return &StartupError{Operation: "model proxy", Err: err}
}
}
// Commands run with no directory of their own run in the worktree. The
// runtime's starting directory is not it: an OpenShell sandbox starts
// elsewhere, and a resumed stage carries no directory.
if err := os.Chdir(workDir); err != nil {
return &StartupError{Operation: "enter worktree", Err: err}
}
dependencies.markSafe(ctx, workDir, log)
// The task is known before connecting: the worker logs in as its task,