HOTFIX: refuse coder project_root that contains .springdrift/#173
Merged
seamus-brady merged 1 commit intomainfrom Apr 26, 2026
Merged
HOTFIX: refuse coder project_root that contains .springdrift/#173seamus-brady merged 1 commit intomainfrom
seamus-brady merged 1 commit intomainfrom
Conversation
The auto-wire defaulted project_root to cwd when not explicitly set.
Springdrift's cwd contains its own .springdrift/ data dir, so the
OpenCode container would happily edit the agent's own state — and the
source code, when the operator ran the agent from its own repo. The
coder was actively scribbling into the running checkout.
Two fixes:
1. Drop the cwd fallback. project_root must be explicitly configured
in [coder] project_root. Without it, real-coder mode is disabled
with a clear startup message pointing at the config option.
2. New project_root_safe/1 guard. Refuses any project_root that:
- is empty or '.'
- contains a .springdrift/ subdirectory
- is itself a .springdrift/ directory
Refusal logs to startup output and slog with the exact reason.
The fresh-install convenience promise bends here — operating-on-self
is too sharp a footgun for a 'works out of the box' default. Operator
must pick a project_root explicitly.
Build clean, format clean, 2190 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The auto-wire I added in v0.10.0 (#168 family) defaulted
[coder] project_rootto cwd when not explicitly set, with the goal of making fresh installs "just work". Springdrift's cwd contains its own.springdrift/data dir — and when the operator runs the agent from inside its own source repo, the OpenCode container is bind-mounted at/workspace/projectover the Springdrift checkout. The coder agent was actively scribbling on the running source code.This is critical-severity. Hot-fix.
Fix
Two changes to
maybe_build_real_coder_depsinsrc/springdrift.gleam:Drop the cwd fallback.
project_rootmust be explicitly configured under[coder] project_root. When unset, real-coder mode is disabled with a clear startup message pointing the operator at the config option.New
project_root_safe/1guard. Refuses anyproject_rootthat:".".springdrift/subdirectory (the load-bearing case — operator pointed the coder at the directory the agent is running in).springdrift/directoryRefusal logs to startup output AND
slogwith the exact reason so the operator can see what triggered.What's now impossible
.springdrift/memory / cycle log / identity / planner stateWhat changes for operators
Fresh installs no longer auto-enable real-coder. The startup message now reads:
Once operators set
[coder] project_root = "/path/to/some-project"and that path doesn't contain.springdrift/, the coder activates normally.Test plan
gleam buildcleangleam formatcleangleam test— 2190 passing/Users/seamus/Repos/springdrift: confirm the startup message names the missing config and real-coder is disabled[coder] project_root = "/Users/seamus/Repos/springdrift"explicitly: confirm the guard refuses with the contains-.springdrift/reason[coder] project_root = "/Users/seamus/coder-scratch"(a clean dir): confirm real-coder activates normally🤖 Generated with Claude Code