fix(codeagent-wrapper): improve CI, version handling and temp dir

- CI: fetch tags for version detection
- Makefile: inject version via ldflags
- Add CODEAGENT_TMPDIR support for macOS permission issues
- Inject ANTHROPIC_BASE_URL/API_KEY for claude backend

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
cexll
2026-01-28 11:55:55 +08:00
parent 2b8bfd714c
commit cd3115446d
12 changed files with 283 additions and 19 deletions

View File

@@ -1088,6 +1088,8 @@ func RunCodexTaskWithContext(parentCtx context.Context, taskSpec TaskSpec, backe
}
}
injectTempEnv(cmd)
// For backends that don't support -C flag (claude, gemini), set working directory via cmd.Dir
// Codex passes workdir via -C flag, so we skip setting Dir for it to avoid conflicts
if cfg.Mode != "resume" && commandName != "codex" && cfg.WorkDir != "" {
@@ -1397,6 +1399,22 @@ waitLoop:
return result
}
func injectTempEnv(cmd commandRunner) {
if cmd == nil {
return
}
env := make(map[string]string, 3)
for _, k := range []string{"TMPDIR", "TMP", "TEMP"} {
if v := strings.TrimSpace(os.Getenv(k)); v != "" {
env[k] = v
}
}
if len(env) == 0 {
return
}
cmd.SetEnv(env)
}
func cancelReason(commandName string, ctx context.Context) string {
if ctx == nil {
return "Context cancelled"