fix: default label sync to non-destructive merge mode (wave-1 Bug #1) - #40
Merged
Conversation
## Why `synchronizeIssueLabels` (`src/labels.js:69-78`) unconditionally deleted any repo label not in the target list. It runs on every `repository.created`, every `/sync-all-repos`, every `/configure-repo`, and every `reconcile-repo` task. **A user creating a `priority/p0` label saw it silently destroyed the next time the bot synced** — across the org, on every webhook tick, with no opt-out. This was wave-1 Bug #1 (the QA bug-hunter's #1 critical) and the highest- priority finding in `docs/agent-fleet/bugs.md`. ## What `synchronizeIssueLabels` now takes a `mode` option: - **`'merge'`** (default) — only create / update labels listed in `targetLabels`. Labels not in the target list are left untouched. Non-destructive. - **`'replace'`** — current destructive behaviour, preserved as opt-in. `config.yml` gains an `issue_labels_sync_mode: merge | replace` setting (default `merge`); `src/repository.js` reads it and threads it through. `src/schema.js` validates the new field. ## Source Wave-1 QA bug-hunter (Bug #1, `docs/agent-fleet/bugs.md`). ## Test plan - [x] 808 tests pass (was 806; added "does NOT remove in default merge mode" regression test for Bug #1; added "rejects invalid mode value"; converted the two existing replace-mode assertions to opt-in via `{mode: 'replace'}`) - [x] eslint clean ## Risk & rollout - Risk: **medium-low**. Behaviour change for existing operators: deletions stop happening unless they explicitly set `issue_labels_sync_mode: replace`. Almost everyone wants the new default. Anyone relying on the old destructive sweep will see a CHANGELOG entry and a `replace` opt-in. - Rollout: self-update on merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Fixes Bug #1 from
docs/agent-fleet/bugs.md— the wave-1 QA bug-hunter's #1 critical finding.synchronizeIssueLabelswas destroying user-created labels on every webhook tick. Now defaults tomode: 'merge'(non-destructive); old behaviour preserved as opt-inmode: 'replace'viaissue_labels_sync_modeconfig.🤖 Generated with Claude Code