-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
The "Detect merge conflicts" step in sync-main-to-dev.yml always reports conflict=true, even when dev is a strict ancestor of main and conflicts are mathematically impossible. This causes every sync PR to be mislabeled as merge-conflict and auto-merge is never enabled.
Steps to Reproduce
- Push to
main(triggers sync-main-to-dev workflow) - Workflow runs "Detect merge conflicts" step
git merge --no-commit --no-ff origin/main 2>/dev/nullreturns non-zero- PR is created with
(conflicts)title andmerge-conflictlabel - "Enable auto-merge" step is skipped
Expected Behavior
When dev is behind main with no divergent commits, the conflict check should report conflict=false, the PR should have a clean title, no merge-conflict label, and auto-merge should be enabled.
Actual Behavior
Every run reports false conflicts. Verified across 5 consecutive runs in downstream (vig-os/devcontainer-smoke-test) and 1 run in upstream (vig-os/devcontainer). Evidence from PR #59: GitHub API confirms mergeStateStatus: CLEAN and mergeable: MERGEABLE, branch compare shows dev is 0 ahead / 3 behind main.
Environment
- Upstream:
ubuntu-22.04runner, git 2.53.0 - Downstream:
ghcr.io/vig-os/devcontainercontainer onubuntu-22.04, git 2.39.5 - Bug reproduces in both environments
Additional Context
The exact cause of the git merge non-zero exit is unknown because 2>/dev/null suppresses all error output. The step does not distinguish between actual conflicts (exit 1) and other failures (exit 128+).
Affected workflow runs (downstream): 23402800270, 23382600708, 23382437352, 23381148959, 23339310830. Upstream: 23060324149.
Both .github/workflows/sync-main-to-dev.yml (upstream) and the downstream copy are affected.
Possible Solution
- Remove or replace
2>/dev/null— capture stderr for logging - Distinguish exit codes: 1 = conflict, other = unexpected error
- Add a fast-path:
git merge-base --is-ancestor origin/dev origin/main→ skip conflict check (conflicts impossible when dev is an ancestor) - Consider
git merge-tree --write-tree(git 2.38+) for in-memory merge without working-tree side effects
Changelog Category
Fixed
- TDD compliance (see .cursor/rules/tdd.mdc)