Skip to content

fix(watch): skip sync+exec triggers on bind-mounted paths - #14328

Merged
ndeloof merged 1 commit into
docker:mainfrom
glours:fix-watch-sync-exec-bind-mount-check
Oct 12, 2026
Merged

ndeloof merged 1 commit into
docker:mainfrom
glours:fix-watch-sync-exec-bind-mount-check

Conversation

@glours

@glours glours commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

What this PR does

isSync() gates the check that skips watch triggers whose path is also bind-mounted, and the initial_sync handling. It didn't list sync+exec, so a sync+exec trigger on a bind-mounted path was monitored instead of skipped with a warning. Its sync writes back to the host, the watcher sees it as a new change, and it loops forever.

Add sync+exec to isSync(), so it's handled like sync and sync+restart. As a consequence, initial_sync now also applies to sync+exec triggers, as it does for the other sync+x actions.

sync+exec triggers whose host path is bind-mounted are now skipped with the existing warning, whatever their target.

Related issue

Related to #14326

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

A sync into a path that is also bind-mounted writes back to the host,
which the watcher sees as a new change and syncs again, looping
forever. isSync, which gates the bind mount check, missed sync+exec,
so only sync and sync+restart triggers were skipped with a warning.

Include sync+exec in isSync. This also makes initial_sync apply to
sync+exec triggers, as it does for the other sync+x actions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours
glours requested review from a team as code owners October 12, 2026 12:59
@glours
glours requested a review from ndeloof October 12, 2026 12:59
@glours glours mentioned this pull request Oct 12, 2026

@docker-agent docker-agent 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.

Assessment: 🟡 NEEDS ATTENTION

Comment thread pkg/compose/watch.go Resolved
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ndeloof ndeloof 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.

LGTM. sync+exec was the only syncing action missing from isSync(), so a sync+exec trigger on a bind-mounted path was monitored and looped on its own write-back; it is now skipped with the same warning as sync and sync+restart.

Checked locally on the PR head: go test -race ./pkg/compose -run Watch and golangci-lint on pkg/compose pass. The new tests cover every action against a bind-mounted path (the syncing ones are skipped, restart/rebuild stay monitored) and the initial sync for sync+exec.

Both side effects are intended and documented: the throwaway-target workaround is now skipped too (see the maintainer comment on #14326), and initial_sync now applies to sync+exec like the other sync+x actions, without running the exec hook, as sync+restart does not restart either.

@ndeloof
ndeloof merged commit c4f5462 into docker:main Oct 12, 2026
65 of 66 checks passed
@ndeloof
ndeloof deleted the fix-watch-sync-exec-bind-mount-check branch October 12, 2026 15:02
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