Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
refactor(execenv): collapse codex plugin cache stale-link branches (#1697)
Bohan Jiang12e6ca99066b
diff --git a/server/internal/daemon/execenv/codex_home.go b/server/internal/daemon/execenv/codex_home.goindex 46b4a79c60..6df7591f76 100644--- a/server/internal/daemon/execenv/codex_home.go+++ b/server/internal/daemon/execenv/codex_home.go@@ -131,18 +131,14 @@ func exposeSharedCodexPluginCache(codexHome, sharedHome string) error {}if fi, err := os.Lstat(dst); err == nil {- target, readlinkErr := os.Readlink(dst)- if readlinkErr == nil {- if target == src {+ isLink := fi.Mode()&os.ModeSymlink != 0+ if isLink {+ if target, readlinkErr := os.Readlink(dst); readlinkErr == nil && target == src {return nil}if err := os.Remove(dst); err != nil {return fmt.Errorf("remove stale plugin cache link: %w", err)}- } else if fi.Mode()&os.ModeSymlink != 0 {- if err := os.Remove(dst); err != nil {- return fmt.Errorf("remove stale plugin cache symlink: %w", err)- }} else {if err := os.RemoveAll(dst); err != nil {return fmt.Errorf("remove stale plugin cache path: %w", err)@@ -213,7 +209,6 @@ func ensureSymlink(src, dst string) error {// codex_sandbox.go's ensureCodexSandboxConfig so they can be updated// idempotently without touching user-managed keys.)-// copyFileIfExists copies src to dst. If src doesn't exist, it's a no-op.// If dst already exists, it's not overwritten.func copyFileIfExists(src, dst string) error {