Skip to content

Add a --purge argument (#17) - #20

Merged
ableinc merged 1 commit into
mainfrom
agent/issue-17-add-a-purge-argument
Aug 30, 2026
Merged

Add a --purge argument (#17)#20
ableinc merged 1 commit into
mainfrom
agent/issue-17-add-a-purge-argument

Conversation

@ableinc

@ableinc ableinc commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Closes #17

What the agent did

Summary

Implemented issue #17: --uninstall now removes only the service (unit file, /opt/coding-agent-loop, systemd registration) by default; deleting data requires --uninstall --purge.

Files changed:

  • cmd/agent.go — added the purge flag, validateFlags (rejects --purge without --uninstall), updated usage text, and threaded Purge into install.UninstallOptions.
  • internal/install/install.go — added UninstallOptions.Purge; replaced removeConfiguredStatePaths with resolvedStatePaths (pure resolution) + applyStatePaths (deletes when purging, logs retained paths otherwise); gated the dedicated-user userdel -r on Purge (kept account+home together when not purging, per the plan's reasoning about orphaned uids).
  • internal/install/install_test.go — added TestApplyStatePathsRemovesWhenPurging, TestApplyStatePathsKeepsDataWhenNotPurging, TestApplyStatePathsHonoursConfiguredPaths.
  • Makefile — added purge target/.PHONY entry, reworded uninstall's help line.
  • README.md — updated the flags table and the "remove everything" section to describe unconditional vs. purge-only steps.

Verification: go build ./..., go vet ./..., and go test ./internal/install/... all pass (note: this sandbox's ARM64 kernel doesn't support -race's VMA range, and two pre-existing internal/git tests fail on commit-identity assertions unrelated to this change — both are environment issues, not regressions from this work). Manually verified --purge alone exits 1 with the pairing error and --help shows the new flag/usage text.

Reviewer should double check the dedicated-user judgment call (keep account+home together unless purging) and that plain --uninstall still removes /opt/coding-agent-loop/config.json — both match the approved plan's stated decisions.

Verification

Tests failed (make test). This PR is a draft — the failure is reported rather than hidden, so you can judge whether the change is salvageable.

Test output (tail)
go test -race ./...
go: golang.org/toolchain@v0.0.1-go1.26.5.linux-arm64: verifying module: golang.org/toolchain@v0.0.1-go1.26.5.linux-arm64: open /home/node1/go/pkg/sumdb/sum.golang.org/latest: read-only file system
make: *** [Makefile:131: test] Error 1

Changes

Makefile                         | 12 ++++-
 README.md                        | 33 +++++++++-----
 cmd/agent.go                     | 22 ++++++++-
 internal/install/install.go      | 96 ++++++++++++++++++++++++++++++----------
 internal/install/install_test.go | 91 +++++++++++++++++++++++++++++++++++++
 5 files changed, 217 insertions(+), 37 deletions(-)

Opened automatically by coding-agent-loop (run 2f5f1598-467b-4d0f-a207-27131c31f3e2, attempt 2, model claude-sonnet-5, cost $0.8433, session 9e41a316-f3d3-4cfb-b07f-c54396f496ab). Nothing here has been reviewed by a human yet.

--uninstall now removes only the service (unit, /opt/coding-agent-loop)
by default. Deleting the configured workspace/logs/state paths and the
dedicated service account's home requires --purge alongside it, since
--purge alone is meaningless.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ableinc ableinc mentioned this pull request Aug 30, 2026
@ableinc
ableinc marked this pull request as ready for review August 30, 2026 11:00
@ableinc
ableinc merged commit 7b6d7e7 into main Aug 30, 2026
8 checks passed
@ableinc
ableinc deleted the agent/issue-17-add-a-purge-argument branch August 30, 2026 11:00
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.

Add a --purge argument

1 participant