Skip to content

Add safe coding-agent integration removal - #676

Open
almirsarajcic wants to merge 1 commit into
basecamp:mainfrom
almirsarajcic:add-agents-remove
Open

Add safe coding-agent integration removal#676
almirsarajcic wants to merge 1 commit into
basecamp:mainfrom
almirsarajcic:add-agents-remove

Conversation

@almirsarajcic

@almirsarajcic almirsarajcic commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Adds basecamp setup agents --remove, following the ownership and migration safety conventions established in HEY CLI.

The command:

  • removes Basecamp-managed shared and agent-specific skills while preserving unmanaged and user-authored files
  • uninstalls recorded Claude plugin scopes from their owning project directories
  • honors CLAUDE_CONFIG_DIR consistently across setup, health checks, repair, and removal
  • queries Codex state before using codex plugin remove basecamp@37signals --json
  • safely cleans proven legacy Codex and Claude skill installations
  • reports partial failures with structured output and is idempotent
  • never touches Basecamp authentication, configuration, or project data

It also tightens skill install/refresh behavior so unowned skill directories are not overwritten or claimed.

Validation

  • focused command and harness tests
  • formatting, tidy, generated CLI surface, skill drift, and naming checks
  • golangci-lint: 0 issues

The broader CI suite has existing terminal-dependent assertions when run without a real TTY; all feature-specific tests pass.


Summary by cubic

Adds basecamp setup agents --remove to safely remove Basecamp-managed coding-agent integrations without touching authentication, configuration, or project data. Setup now refuses to overwrite or claim unowned skill directories instead of falling back to them.

Removal and safety

  • Removes recorded Claude plugin scopes and Basecamp-owned shared and agent-specific skills.
  • Cleans verified legacy Codex and Claude skill installs while preserving user-authored files.
  • Treats an already-absent Codex plugin as a successful no-op.
  • Resolves CLAUDE_CONFIG_DIR and CODEX_HOME consistently, rejecting relative Claude paths and expanding Codex home aliases.
  • Reports partial failures with structured metadata and supports repeatable cleanup.

Written for commit 5271311. Summary will update on new commits.

Review in cubic

Copilot AI balanced review requested due to automatic review settings September 2, 2026 08:00
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) skills Agent skills docs labels Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removal can hang, mishandle managed fallback directories and cross-volume Claude paths, and drops structured partial results.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds safe removal of Basecamp-managed coding-agent integrations while preserving user-owned files and configuration.

Changes:

  • Adds setup agents --remove for Claude, Codex, and managed skills.
  • Adds ownership safeguards and custom agent-home handling.
  • Adds focused tests, documentation, and CLI surface updates.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File summaries
File Description
.surface Records the new flag.
README.md Documents integration removal.
skills/basecamp/SKILL.md Updates agent guidance.
internal/harness/claude.go Honors custom Claude configuration paths.
internal/harness/codex.go Adds custom-home detection and plugin queries.
internal/harness/codex_test.go Tests custom Codex homes.
internal/commands/wizard_agents.go Registers the removal flag.
internal/commands/skill.go Adds skill ownership protections.
internal/commands/skill_test.go Tests ownership-preserving behavior.
internal/commands/setup_agents_remove.go Implements integration removal.
internal/commands/setup_agents_remove_test.go Covers removal and migration cases.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/skill.go Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 11 files

Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.

Re-trigger cubic

Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/skill.go
Comment thread internal/commands/skill.go
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/skill.go Outdated
Comment thread internal/harness/codex.go Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 08:47
@github-actions github-actions Bot added the output Output formatting and presentation label Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Removal can mask uninstall failures, leave legacy links broken, and overwrite additional files during copy fallback.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread internal/commands/skill.go
Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/setup_agents_remove.go Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 09:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Legacy markerless installations are missed, and relative CODEX_HOME can direct deletion into project paths.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread internal/harness/codex.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/skill.go Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/setup_agents_remove_test.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/skill.go Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 09:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Predefined skill installation can follow a symlink, and managed refresh failures can be permanently skipped.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/skill.go

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/skill.go
Comment thread internal/harness/codex.go Outdated
Comment thread internal/commands/skill.go
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/harness/claude.go Outdated
Comment thread internal/commands/skill.go Outdated
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/setup_agents_remove_test.go Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 10:29

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 14 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/skill_test.go
Comment thread internal/commands/skill_test.go
Comment thread internal/harness/codex.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Symlinked configuration paths can create broken links, and configuration and idempotence edge cases remain unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/skill.go Outdated
Comment thread internal/harness/codex.go Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 10:41
Copilot AI review requested due to automatic review settings September 2, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Legacy Codex installs can remain after a home migration, and transient skill-write failures can leave installations permanently unretryable.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

internal/commands/skill.go:351

  • The predefined wizard has the same retry trap as the non-interactive installer: after the ownership gate creates a new directory, a failed first write leaves it empty, and the next run rejects that empty directory as unmanaged. Remove it on failure when it is still empty so a transient write error remains recoverable.
	writeErr := writeWizardSkill(expandedPath, data, selectedPredefined)
	if writeErr != nil {
		return fmt.Errorf("writing skill file: %w", writeErr)
  • Files reviewed: 15/15 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread internal/commands/setup_agents_remove.go
Comment thread internal/commands/skill.go

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/skill.go
Comment thread internal/commands/skill.go
Comment thread internal/commands/setup_agents_remove.go
Copilot AI review requested due to automatic review settings September 2, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Destructive filesystem cleanup and external plugin operations warrant final human validation despite extensive safety checks and tests.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/setup_agents_remove.go
Copilot AI review requested due to automatic review settings September 2, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Skill refresh still follows symlinked parent directories, conflicting with the removal safety boundary.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread internal/commands/skill.go

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/skill.go
Comment thread internal/commands/setup_agents_remove_test.go Outdated
Comment thread internal/harness/codex.go Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Destructive filesystem cleanup and external plugin operations warrant final human validation despite comprehensive safeguards and tests.

Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 16 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/commands/skill.go
Comment thread internal/harness/agent_config.go Outdated
Comment thread internal/commands/skill.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Claude skill refresh and symlink traversal currently mishandle normal managed links and symlinked ancestors.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

internal/commands/skill.go:562

  • This MkdirAll can follow an existing skills symlink and then create or replace the Basecamp link outside Claude's configured tree. Other new write/removal paths explicitly reject symlinked predefined ancestors, so this setup path should perform the same traversal check before writing.
	if err := os.MkdirAll(symlinkDir, 0o755); err != nil { //nolint:gosec // G301: Skill files are not secrets
  • Files reviewed: 16/16 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread internal/commands/skill.go
Comment thread internal/harness/agent_config.go Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 16 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/commands/skill.go
Comment thread internal/commands/setup_agents_remove.go Outdated
Comment thread internal/harness/agent_config.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Destructive filesystem cleanup and external plugin mutations across multiple migration formats warrant final human validation.

Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 16 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread internal/harness/agent_config.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Managed Claude symlinks currently cause every automatic skill refresh to be treated as failed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

internal/commands/skill.go:730

  • A normal Basecamp-managed Claude skill symlink is always counted as a refresh failure here. hasSymlinkComponent detects the basecamp link, while ownedOrLegacySkillDir(dir) follows that parent link when checking its marker, so it returns true. Consequently every CLI invocation for a Claude user leaves the version sentinel stale and repeatedly rewrites the other managed skills. Exempt a verified link to the managed canonical skill from failure accounting and let repairClaudeSkillLink handle its health.
			if ownedOrLegacySkillDir(dir) || invalidSkillMarker(dir) {
				outcome.failed++
			}
  • Files reviewed: 16/16 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread internal/commands/setup_agents_remove.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two moderate issues can cause false success reporting and prevent legacy Claude skill migration.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

internal/commands/skill.go:627

  • A pre-marker Claude installation created by the old wizard can contain only the shipped SKILL.md. Other paths in this PR recognize that exact payload as legacy-managed, but this check requires a marker, so basecamp skill install and basecamp setup agents reject the legacy directory instead of migrating it. Accept the same proven legacy payload here; copySkillFiles will then add the current ownership marker while preserving extra files for marked installs.
	if !info.IsDir() || !ownedSkillDir(path) {
		return &unmanagedSkillDirError{dir: path}
  • Files reviewed: 16/16 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread internal/commands/setup_agents_remove.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Integration removal and migration safety require final human review.

Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@almirsarajcic

Copy link
Copy Markdown
Author

@cubic-dev-ai, you tired?

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai, you tired?

@almirsarajcic Nope — this is a big change, but the added coverage is doing the heavy lifting. The symlink, ownership, partial-failure, config-path, and idempotency cases are all addressed here.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands CLI command implementations docs output Output formatting and presentation skills Agent skills tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants