Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Util.php’s new envpath resolution for COMPOSE_FILE discovery is inconsistent with existing envpath semantics (stack-dir metadata + absolute-only), which can break discovery for indirect stacks with a configured envpath.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves Compose Manager’s UX and stack discovery by adding an editor-modal behavior toggle, reducing/noising-down Docker load warnings while improving error detail, and making Compose project discovery more robust when the compose file is specified via .env (COMPOSE_FILE), plus a compose wrapper script change to better match “run from project dir” semantics.
Changes:
- Add an “advanced” setting to prevent the editor modal from closing when clicking outside the modal, and wire it into the modal overlay click handler.
- Improve Docker load WebSocket error/reconnect logging structure (and log level), to reduce warnings and capture more useful fields.
- Enhance compose file discovery in PHP to fall back to COMPOSE_FILE in the resolved env file; adjust compose wrapper to
cdinto the project directory for default discovery; add a unit test covering.env-only compose file declaration.
File summaries
| File | Description |
|---|---|
| tests/unit/StackInfoTest.php | Adds coverage to ensure stacks load when compose file is declared only via .env COMPOSE_FILE. |
| source/compose.manager/scripts/compose.sh | Switches from --project-directory to cd into workdir to align Compose discovery with validated CLI behavior. |
| source/compose.manager/javascript/composeManagerMain.js | Adds modal “don’t close on outside click” behavior gated by config; improves dockerload WebSocket error logging payload. |
| source/compose.manager/include/Util.php | Adds compose-file discovery via COMPOSE_FILE in resolved env file and adds envpath-based env resolution helper. |
| source/compose.manager/default.cfg | Introduces default value for the new editor modal behavior setting. |
| source/compose.manager/compose.manager.settings.page | Adds UI checkbox to configure/persist the new editor modal behavior setting. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| $stackDir = rtrim($path, '/'); | ||
| $envPathMetadata = $stackDir . '/envpath'; | ||
| if (is_file($envPathMetadata)) { | ||
| $raw = @file_get_contents($envPathMetadata); | ||
| $candidate = $raw === false ? '' : trim($raw); |
…tack envpath metadata resolution For indirect stacks, metadata files (including envpath) live in the stack directory ($this->path), but getComposeFilePath() was called with the indirect path ($this->composeSource). This prevented envpath discovery for indirect stacks. Changes: - Add optional $stackPath parameter to getComposeFilePath() - Update resolveProjectEnvFilePath() to accept both compose path and stack path - Pass $this->path as stack path when resolving compose file - Look for envpath metadata in stack directory regardless of indirect path This ensures indirect stacks with envpath metadata can properly discover compose files via COMPOSE_FILE variable, matching the behavior of direct stacks.
Update getExplicitEnvFilePath() to handle relative paths in envpath metadata, matching the behavior of resolveProjectEnvFilePath(). Previously, relative envpath values (e.g., 'config/.env') would not be resolved correctly when used in compose commands. Now both absolute and relative paths are supported, with relative paths resolved against the stack directory. This ensures consistency between compose file discovery and env-file argument construction for stacks with relative envpath metadata.
Add two new test cases to verify indirect stacks can properly discover compose files via envpath metadata: 1. testIndirectStackLoadsWhenComposeFileViaEnvpath: Tests indirect stack with absolute envpath pointing to a .env file that declares COMPOSE_FILE 2. testIndirectStackLoadsWhenComposeFileViaRelativeEnvpath: Tests indirect stack with relative envpath (resolved relative to stack directory) pointing to a .env file that declares COMPOSE_FILE Also normalize returned paths in resolveComposeFileFromEnvFile() using realpath() to ensure consistent path representation across different resolution paths. These tests verify the fixes in the previous commits work correctly for indirect stacks with custom envpath metadata.
This pull request introduces several improvements and fixes to the Compose Manager, focusing on enhanced user experience, improved error logging, and more robust handling of Docker Compose project discovery. The main changes include a new advanced editor modal option, improved WebSocket error logging, better Compose file resolution from
.envfiles, and a safer approach to handling project directories in the shell script. Unit tests were also added to ensure correct behavior.User Experience Improvements
compose.manager.settings.page) allowing users to prevent the editor modal from closing when clicking outside it, reducing accidental interruptions during editing. The setting is available in the UI, persisted in config, and respected by the JavaScript modal logic. [1] [2] [3]Error Handling and Logging
composeManagerMain.jsto capture more detailed error information, making debugging and monitoring more effective.Docker Compose Project Discovery
Util.phpto support discovering the compose file via theCOMPOSE_FILEvariable in.envfiles, including support for customenvpathmetadata. This makes Compose project detection more robust and flexible.Shell Script Robustness
compose.sh) tocdinto the project directory instead of passing--project-directory, ensuring Docker Compose discovery works consistently with the validated workflow. [1] [2] [3]Testing
.envfile.