Skip to content

Ensure dockercompose trigger creation uses existing dd/wud.compose.file labels only#6

Merged
Crow-Control merged 5 commits intomainfrom
copilot/fix-container-labels-triggers
Feb 17, 2026
Merged

Ensure dockercompose trigger creation uses existing dd/wud.compose.file labels only#6
Crow-Control merged 5 commits intomainfrom
copilot/fix-container-labels-triggers

Conversation

Copy link

Copilot AI commented Feb 17, 2026

This PR keeps compose trigger creation aligned with the existing label contract and removes the metadata-based fallback that expanded scope beyond the requested fix.

  • Compose trigger source

    • Trigger auto-creation remains based on:
      • dd.compose.file
      • wud.compose.file
    • No additional Docker Compose metadata labels are used for trigger creation.
  • Scope correction from feedback

    • Removed the previously added fallback logic based on:
      • com.docker.compose.project.config_files
      • com.docker.compose.project.working_dir
    • Removed the metadata-specific regression test that validated that fallback behavior.
  • Current behavior

    • Containers create dockercompose triggers when the existing compose file labels are set.
    • Per-container compose options (backup, prune, dryrun, auto, threshold) continue to be passed from dd/wud.compose.* labels as before.
    • Fixed a cached-container edge case in the Docker watcher where compose-labeled containers could return early from store and skip trigger creation; watcher now avoids cache short-circuit when a compose label exists but no compose trigger is cached yet.
  • Additional regression coverage

    • Added a focused Docker watcher unit test for the cached-container path to verify compose trigger creation and triggerInclude population when dd.compose.file is set.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 17, 2026 15:25
Co-authored-by: Crow-Control <7613738+Crow-Control@users.noreply.github.com>
Co-authored-by: Crow-Control <7613738+Crow-Control@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix container labels to create triggers correctly Fix compose-trigger auto-creation for containers missing dd/wud.compose.file Feb 17, 2026
Copilot AI requested a review from Crow-Control February 17, 2026 15:28
@Crow-Control
Copy link
Member

@copilot im not asking for adding extra metadata config, i want the current labels to correctly create triggers.

Co-authored-by: Crow-Control <7613738+Crow-Control@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 17, 2026

@copilot im not asking for adding extra metadata config, i want the current labels to correctly create triggers.

Done — I removed the compose metadata fallback and kept trigger creation scoped to the existing dd.compose.file / wud.compose.file labels only. This is in commit c2a68e4.

Copilot AI changed the title Fix compose-trigger auto-creation for containers missing dd/wud.compose.file Ensure dockercompose trigger creation uses existing dd/wud.compose.file labels only Feb 17, 2026
@Crow-Control
Copy link
Member

@copilot somehow the containerlabels dont create the trigger in the ui?

Co-authored-by: Crow-Control <7613738+Crow-Control@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 17, 2026

@copilot somehow the containerlabels dont create the trigger in the ui?

Fixed — the issue was cached containers returning early before compose trigger creation. I updated the watcher to still create the trigger when dd.compose.file / wud.compose.file is present but no compose trigger is cached yet. Included a focused test for this path in commit b90f120.

@Crow-Control Crow-Control marked this pull request as ready for review February 17, 2026 18:51
Copilot AI review requested due to automatic review settings February 17, 2026 18:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns Docker compose trigger auto-creation strictly to the existing dd.compose.file / wud.compose.file label contract, while fixing an edge case where cached containers could skip compose trigger creation due to an early store short-circuit.

Changes:

  • Prevent early return from addImageDetailsToContainer when a compose file label exists but no compose trigger is cached for that container.
  • Reuse composeFilePath computed up-front for trigger creation.
  • Add a unit test covering the cached-container path to ensure compose trigger creation and triggerInclude population.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/watchers/providers/docker/Docker.ts Adjusts store short-circuit logic to allow compose trigger creation when needed based on dd/wud.compose.file.
app/watchers/providers/docker/Docker.test.ts Adds regression test ensuring cached containers with dd.compose.file still create compose triggers and set triggerInclude.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2426 to +2430
if (
containerInStore !== undefined &&
containerInStore.error === undefined &&
!needsComposeTriggerCreation
) {
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

With this change, if dd/wud.compose.file is set but dockercompose trigger creation fails (exception in ensureDockercomposeTriggerForContainer), composeTriggersByContainer[containerId] remains unset. That means needsComposeTriggerCreation will stay true on every subsequent poll, so the watcher will repeatedly skip the store short-circuit and re-run the full image inspect path just to retry trigger creation, which can add ongoing load/log noise. Consider handling the “container already in store + needs trigger creation” case without inspecting the image (create trigger, update composeTriggersByContainer, and return/update the stored container’s triggerInclude), or add a backoff/sentinel to avoid repeated inspect work on persistent failures.

Suggested change
if (
containerInStore !== undefined &&
containerInStore.error === undefined &&
!needsComposeTriggerCreation
) {
if (containerInStore !== undefined && containerInStore.error === undefined) {

Copilot uses AI. Check for mistakes.
@Crow-Control Crow-Control merged commit 8cf2b0a into main Feb 17, 2026
7 checks passed
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.

3 participants