Skip to content

Coder default project_root: $TMPDIR scratch dir (cross-platform, auto-created)#174

Merged
seamus-brady merged 1 commit intomainfrom
hotfix/coder-default-scratch-dir
Apr 26, 2026
Merged

Coder default project_root: $TMPDIR scratch dir (cross-platform, auto-created)#174
seamus-brady merged 1 commit intomainfrom
hotfix/coder-default-scratch-dir

Conversation

@seamus-brady
Copy link
Copy Markdown
Owner

Summary

Follow-up to PR #173. That fix made [coder] project_root mandatory after dropping the cwd fallback — too much friction for the operator who's just trying to use the defaulted-everything-else coder.

This PR restores the "just works" experience without the self-edit footgun:

  • macOS: defaults to $TMPDIR/springdrift-coder-workspace (e.g. /var/folders/.../T/springdrift-coder-workspace). $TMPDIR is per-user and kernel-managed.
  • Linux: $TMPDIR usually unset; falls back to /tmp/springdrift-coder-workspace.

Auto-created with simplifile.create_directory_all. Stable across restarts of the same instance so the coder remembers previous commits inside the workspace.

The safety guard from #173 (project_root_safe) still runs and structurally still works — but the default path is structurally disjoint from cwd, so it can never contain the running agent's .springdrift/ data and the guard never fires for the default.

Test plan

  • gleam build clean
  • gleam format clean
  • gleam test2190 passing
  • macOS: launch fresh instance, confirm log says project_root=/var/folders/.../T/springdrift-coder-workspace
  • Linux: launch fresh instance, confirm log says project_root=/tmp/springdrift-coder-workspace
  • Override path: set [coder] project_root = "/Users/x/some-project", confirm it's used

🤖 Generated with Claude Code

Followup to the project-root self-edit hotfix. The previous fix made
`[coder] project_root` mandatory, but that's too much friction —
operators shouldn't have to write a config line just to use the
defaulted-everything-else coder.

New behaviour: when project_root isn't configured, default to
`${TMPDIR}/springdrift-coder-workspace` (auto-created on first
boot). Cross-platform:

  * macOS: $TMPDIR is set per-user (e.g.
    /var/folders/.../T/), kernel-managed, persistent across reboots
  * Linux: $TMPDIR usually unset; fall back to /tmp/

Trailing slashes are stripped so the join produces a single
separator regardless of OS.

The temp dir is structurally disjoint from cwd, so it can never
contain the running agent's .springdrift/ data — the safety guard
from the prior hotfix still runs, but now never fires for the
default. Operators with a real project repo override via
`[coder] project_root = ...` exactly as before.

Build clean, format clean, 2190 tests pass.
@seamus-brady seamus-brady merged commit af2b18f into main Apr 26, 2026
1 check passed
@seamus-brady seamus-brady deleted the hotfix/coder-default-scratch-dir branch April 26, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant