Repository navigation
fix(override): prune services the compose file no longer has - #169
Merged
mstrhakr merged 2 commits intoOct 6, 2026
Merged
Conversation
pruneOrphanOverrideServices() asks docker compose which services the main compose file defines, so it can drop override entries for the rest. The -f list it used included the managed override itself, so an entry for a removed or renamed service (labels only, no image) made compose fail with 'has neither an image nor a build context', the list came back empty, and nothing was ever pruned. The following up then failed on the same entry. The services are now asked for without the managed override and the icon override generated from it. Default file discovery mode is unchanged: it passes no -f flags to leave one out of. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iUWDG8wTp8MhsFDqNC4NL
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Default Compose file discovery still loads the managed override, leaving the reported failure unresolved in that supported mode.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes orphan-service pruning by excluding managed overrides when querying valid Compose services.
Changes:
- Adds filtered Compose file flag construction.
- Adds regression tests for pruning stale override entries.
| File | Description |
|---|---|
source/compose.manager/include/Util.php |
Excludes managed overrides during service discovery. |
tests/unit/PruneOrphanOverrideServicesTest.php |
Tests stale-service pruning behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
With use_default_compose_files on, the services query ran with only --project-directory, so compose found compose.override.yaml next to the compose file by itself and refused the project over the orphan entry. Pruning stayed off in that mode. Name the files with -f in that mode as well, from the same project directory, leaving out the managed override as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PnMScBowJk7yyfEwraTdgg
mstrhakr
pushed a commit
that referenced
this pull request
Oct 8, 2026
… checks The web UI prunes the plugin-managed override before every up; a git deploy did not. When a commit renames or removes a service, the override keeps an entry for it with labels only, and compose refuses the whole stack over a file the user did not write. Prune it after the checkout and before the checks, and log each service removed. This relies on #169: before it, pruneOrphanOverrideServices() never removed anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PnMScBowJk7yyfEwraTdgg
mstrhakr
pushed a commit
that referenced
this pull request
Oct 8, 2026
… checks The web UI prunes the plugin-managed override before every up; a git deploy did not. When a commit renames or removes a service, the override keeps an entry for it with labels only, and compose refuses the whole stack over a file the user did not write. Prune it after the checkout and before the checks, and log each service removed. This relies on #169: before it, pruneOrphanOverrideServices() never removed anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PnMScBowJk7yyfEwraTdgg
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.

What changed
pruneOrphanOverrideServices()runs before every Compose Up to drop override entries for services thecompose file no longer has. To find the valid services,
getMainFileServices()runsdocker compose ... config --services, but the-flist it used included the managed override itself. Anentry for a removed or renamed service holds only labels and no image, so compose failed on it ("has neither
an image nor a build context"), the list came back empty, and nothing was ever pruned. The up that followed
then failed on the same entry.
The services are now listed without the managed override and without the icon override generated from it
(new private
buildComposeFileFlagsWithoutManagedOverride()). Everything else in the file list stays: themain compose file, an indirect stack's own override, and extra compose files from
COMPOSE_FILEor thestack settings, so their services still count as valid.
Related issues
#118 (the stack that wouldn't start after a service was removed; reproduction in my comment there)
Checklist
Testing notes
tests/unit/PruneOrphanOverrideServicesTest.php: a stand-indockeronPATHthat, like compose,fails when handed the override with an image-less entry. It fails before this change and passes after. Full
PHPUnit suite passes.
Util.phpreturns{"changed":false,"removed":[]}and this branch's returns{"changed":true,"removed":["old"]}, with theentry gone from the override and the other one kept.
Notes
use_default_compose_files) are unchanged: they pass no-fflags,so there is no file to leave out, and compose itself loads
compose.override.yamlfrom the folder.