Files
compound-engineering-plugin…/tests
Trevin Chow 99284a64c6 feat(codex): clean up orphan sidecar dirs for retained agents
When writing Codex custom agents, delete any same-basename sibling
directory under agentsRoot if the retained agent declares zero
sidecarDirs. Previously, cleanupRemovedAgents only swept the sibling
directory when the TOML itself was being removed — a same-name agent
that lost its sidecar between plugin versions left an orphan directory
indefinitely.

The new sweep is narrowly scoped: it only runs against base names of
agents in the current install and only when the agent declares no
sidecars, so unrelated directories under agentsRoot are untouched.
Gated by isSafeManagedPath to match the existing cleanup safety
pattern.

Tests cover the three scenarios: orphan removed when agent has no
sidecars, sidecar preserved when agent declares one, unrelated
directory left alone.

Per docs/plans/2026-04-21-001-refactor-flatten-agents-directory-plan.md
Unit 4b.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 01:59:43 -07:00
..