Skip to content

Merge dev → main: conflict-detection event-string fix#1218

Merged
zbigniewsobiecki merged 2 commits intomainfrom
dev
Apr 27, 2026
Merged

Merge dev → main: conflict-detection event-string fix#1218
zbigniewsobiecki merged 2 commits intomainfrom
dev

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

Promotes one fix to main. Conflict detection has been silently disabled in production for every project that "enabled" it via the dashboard since the gating string was introduced; this restores it.

Contained PRs

  • fix(triggers): correct pr-conflict-detected gating event so resolve-conflicts actually fires #1217 fix(triggers) — correct pr-conflict-detected gating event so resolve-conflicts actually fires. The handler at src/triggers/github/pr-conflict-detected.ts:43 was passing 'scm:conflict-resolution' to checkTriggerEnabled, but every other surface (the agent YAML, the trigger-types registry the dashboard / CLI write through, and the handler's own emitted triggerEvent) uses 'scm:pr-conflict-detected'. The lookup always missed the operator's enabled DB row, fell back to the agent definition's defaultEnabled: false, and silently returned null on every pull_request synchronize webhook. Confirmed via cascade webhooklogs on 2026-04-27 — six synchronize events on ucho PRs feat(gadgets): improve Tmux capture and EditFile display #81 and feat(gadgets): require PR for implementation agent and refactor file editing #85 in an 11-minute window each returned decisionReason: "No trigger matched for event" despite the trigger being enabled in the DB.

    Includes a new static-analysis guard test (tests/unit/triggers/trigger-event-consistency.test.ts) that scans every handler under src/triggers/, asserts each gating event string is also emitted as triggerEvent, and fails loudly with a precise file:line + remediation message on any future drift. Audit confirmed this was the only mismatch in the codebase across 20 checkTriggerEnabled call sites.

Test plan

  • dev CI green on 0a5dea91
  • main CI green post-merge
  • Smoke-test on a real conflict: introduce a merge conflict on a CASCADE-implementer-authored PR; confirm webhook decision flips from "No trigger matched for event" to "Job queued: resolve-conflicts agent for work item N".

🤖 Generated with Claude Code

zbigniewsobiecki and others added 2 commits April 27, 2026 10:37
…onflicts actually fires

The gating call passed `'scm:conflict-resolution'` to `checkTriggerEnabled`, but
every other surface (the agent YAML, the trigger-types registry the dashboard /
CLI write through, and the handler's own emitted `triggerEvent` on AgentInput)
uses `'scm:pr-conflict-detected'`. So `isTriggerEnabled('resolve-conflicts',
'scm:conflict-resolution')` always missed the operator's enabled DB row, fell
back to the agent definition's `defaultEnabled: false`, and silently returned
null on every `pull_request synchronize` webhook.

Confirmed via `cascade webhooklogs` on 2026-04-27: 6+ synchronize events for
ucho on PRs #81 and #85 in an 11-minute window each returned `decisionReason:
"No trigger matched for event"` despite `cascade projects trigger-list ucho`
showing `resolve-conflicts | scm:pr-conflict-detected | enabled=yes`. The
trigger handler's `matches()` returned true; only the gating string was wrong.

Conflict detection has been silently broken in production for every project
that "enabled" it via the dashboard, since the same commit that standardized
the emitted `triggerEvent` to `'scm:pr-conflict-detected'` everywhere else
left this one gating call out of the rename.

Fix: one-line string change. The existing handler test was codifying the bug
(it asserted `checkTriggerEnabled` was called with `'scm:conflict-resolution'`)
and is updated to pin the correct value.

Audit: cross-checked all 20 `checkTriggerEnabled` / `checkTriggerEnabledWithParams`
call sites in `src/triggers/` against each handler's emitted `triggerEvent`.
This was the only mismatch.

Guard: added `tests/unit/triggers/trigger-event-consistency.test.ts` — a
static-analysis test that scans every trigger handler file under
`src/triggers/`, extracts the gating event string from each
`checkTriggerEnabled(...)` call and the emitted `triggerEvent: '...'`
property, and asserts every gating event appears in the file's emitted set.
The test fails loudly with a precise file:line reference on any future drift,
listing the actual events found and pointing the contributor at either fixing
the mismatch or adding an explicit `EXEMPT_FILES` entry with a reason.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tion-event-string-mismatch

fix(triggers): correct pr-conflict-detected gating event so resolve-conflicts actually fires
@zbigniewsobiecki zbigniewsobiecki merged commit 1053d61 into main Apr 27, 2026
15 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant