Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: bind the coordinator-merge exemption to the audited PR (#12549)
[._.]/ Adam Eivy71c9adc89b13
diff --git a/server/lib/mergeGateAudit.js b/server/lib/mergeGateAudit.jsindex 342e09bffa..c983788e40 100644--- a/server/lib/mergeGateAudit.js+++ b/server/lib/mergeGateAudit.js@@ -110,16 +110,19 @@ function leaseCoversMerge({ repository, mergedAt, history = [], heldLease = null* @param {string} input.repository* @param {string} input.headSha* @param {string} input.mergedAt- * @param {Array<{headSha?: string, coordinatorMergedAt?: string}>} [input.receipts] handoff receipts recorded on the run+ * @param {string} input.prUrl the audited PR; a head can back several PRs (main and a release branch)+ * @param {Array<{prUrl?: string, headSha?: string, coordinatorMergedAt?: string}>} [input.receipts] handoff receipts recorded on the run* @param {Array<object>} [input.history]* @param {object|null} [input.heldLease]* @param {Array<object>|null} input.checks check runs of the merged head; null when unreadable* @returns {{ exempt: boolean, violations: Array<{code: string, message: string}>, checks: ReturnType<typeof classifyHeadChecks> }}*/-export function assessMergeGate({ repository, headSha, mergedAt, receipts = [], history = [], heldLease = null, checks }) {+export function assessMergeGate({ repository, prUrl, headSha, mergedAt, receipts = [], history = [], heldLease = null, checks }) {const classification = classifyHeadChecks(checks, mergedAt);const head = String(headSha || '').toLowerCase();- if (receipts.some((receipt) => receipt?.coordinatorMergedAt && String(receipt.headSha || '').toLowerCase() === head)) {+ const pr = String(prUrl || '').toLowerCase();+ if (receipts.some((receipt) => receipt?.coordinatorMergedAt && String(receipt.prUrl || '').toLowerCase() === pr+ && String(receipt.headSha || '').toLowerCase() === head)) {return { exempt: true, violations: [], checks: classification };}const violations = [];diff --git a/server/services/mergeGateAudit.js b/server/services/mergeGateAudit.jsindex 1c4b84394f..32c70af4a3 100644--- a/server/services/mergeGateAudit.js+++ b/server/services/mergeGateAudit.js@@ -213,7 +213,7 @@ export async function auditClaimMergeGate({ agentId, task, agentState }) {if (checks === null) { unresolved = true; continue; }const heldLease = await readHeldLease({ ...agentState, id: agentId }, repository);const verdict = assessMergeGate({- repository, headSha, mergedAt: pr.mergedAt, checks, heldLease,+ repository, prUrl: pr.url, headSha, mergedAt: pr.mergedAt, checks, heldLease,receipts: readList(metadata.mergeHandoffReceipts),history: [...readList(metadata.mergeAdmissionHistory), ...(metadata.lastMergeAdmission ? [metadata.lastMergeAdmission] : [])],});diff --git a/server/services/mergeGateAudit.test.js b/server/services/mergeGateAudit.test.jsindex a3b524678f..7a654be9ba 100644--- a/server/services/mergeGateAudit.test.js+++ b/server/services/mergeGateAudit.test.js@@ -169,6 +169,12 @@ describe('post-merge gate audit', () => {expect(f.agent.metadata.mergeGateViolations[0].codes).toEqual(['no-admission-lease']);});+ it('does not let a coordinator receipt for one PR exempt another PR sharing its head', async () => {+ f.agent.metadata.mergeHandoffReceipts = [{ receiptId: 'receipt-1', prUrl: 'https://github.com/example/repo/pull/8', headSha: HEAD,+ acceptedAt: '2026-10-20T02:10:00Z', coordinatorMergedAt: MERGED_AT }];+ expect(await run()).toMatchObject({ violations: 1 });+ });+it('flags a merge made on an expired lease and counts failing commit statuses and ignores post-merge runs', async () => {f.agent.metadata.mergeAdmissionHistory = [lease({ acquiredAt: '2026-10-20T02:05:00Z', releasedAt: '2026-10-20T02:17:00Z' })];f.checks = [