oficina / equipo Public

fix: install without TMPDIR, keeping scratch in the user cache

The runner installer refused to start when TMPDIR was unset, which is the
normal case for most shells, so onboarding would fail for real users (and
did in CI). It now uses TMPDIR when set and otherwise the user's cache
directory, so scratch stays on disk. All tests pass with TMPDIR unset.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 4a2d1d5f914909f628cf34c331f730446388ff59 parent b6b23cf
1 file changed, +14 −4
  • internal/runner/setup/install.go +14 −4

CI passed — run details

diff --git a/internal/runner/setup/install.go b/internal/runner/setup/install.go
index 86eb38ce..a2f7be75 100644
--- a/internal/runner/setup/install.go
+++ b/internal/runner/setup/install.go
@@ -77,11 +77,21 @@ func installUser(ctx context.Context, o InstallOptions, h installHost) (r Instal
if json.Unmarshal(raw, &m) != nil || m.Validate(o.Release) != nil {
return fail("runner.install.release")
}
- // Each attempt owns exactly one private scratch directory on the configured disk.
- if os.Getenv("TMPDIR") == "" {
- return fail("runner.install.scratch")
+ // Each attempt owns exactly one private scratch directory. TMPDIR wins
+ // when set; otherwise the user's cache directory keeps it on disk, since
+ // /tmp may be a shared RAM disk.
+ scratchRoot := os.Getenv("TMPDIR")
+ if scratchRoot == "" {
+ cache, ce := os.UserCacheDir()
+ if ce != nil {
+ return fail("runner.install.scratch")
+ }
+ scratchRoot = filepath.Join(cache, "equipo", "install")
+ if os.MkdirAll(scratchRoot, 0o700) != nil {
+ return fail("runner.install.scratch")
+ }
}
- scratch, e := os.MkdirTemp(os.Getenv("TMPDIR"), "equipo-install-")
+ scratch, e := os.MkdirTemp(scratchRoot, "equipo-install-")
if e != nil {
return fail("runner.install.scratch")
}