Skip to content

armgit / ax

Public Imported from GitHub
0

Agent Executor (AX) is Google's open agentic orchestration runtime

Go

Set workdir for interactions execution. (#324)

Junjie Wang6afbf90a8f3c
diff --git a/internal/harness/antigravityinteractions/antigravityinteractions.go b/internal/harness/antigravityinteractions/antigravityinteractions.go
index 430ed5a..cb84faf 100644
--- a/internal/harness/antigravityinteractions/antigravityinteractions.go
+++ b/internal/harness/antigravityinteractions/antigravityinteractions.go
@@ -365,6 +365,15 @@ func (e *antigravityInteractionsExecution) Run(ctx context.Context, handler harn
return fmt.Errorf("Run called with no queued input and no work pending")
}
+ // Set the working directory for this execution. Substrate resets the
+ // process cwd to the OCI spec's root directory, "/" after gVisor
+ // restore. We need to explicitly set it for each execution.
+ if workDir := os.Getenv("AX_HARNESS_WORKDIR"); workDir != "" {
+ if err := os.Chdir(workDir); err != nil {
+ return fmt.Errorf("set working directory %q: %w", workDir, err)
+ }
+ }
+
res, err := e.harness.postTurn(ctx, token, e.harness.newRequest(input, prevID))
if err != nil {
return fmt.Errorf("interaction turn failed: %w", err)