diff --git a/src/main/__tests__/integration-event-bridge.test.ts b/src/main/__tests__/integration-event-bridge.test.ts index fcf93981..854f2239 100644 --- a/src/main/__tests__/integration-event-bridge.test.ts +++ b/src/main/__tests__/integration-event-bridge.test.ts @@ -960,6 +960,29 @@ test('integration events ignore index, discovery, tmp, dotfile, and local writeb assert.deepEqual(harness.listAgentsCalls, []) }) +test('integration events notify nested non-numeric Slack message records', async () => { + const harness = makeHarness() + + await withMockedNow('2026-06-04T21:20:00.000Z', async () => { + await harness.bridge.reconcile('project-1', [ + integration({ + provider: 'slack', + integrationId: 'slack-1', + mountPaths: ['/slack/channels/C123ABC'], + scope: { + notifyAgents: ['alice'] + } + }) + ]) + + await harness.emit(changeEvent('/slack/channels/C123ABC/messages/1780607825_485189/files/attachment.json', 'slack')) + await waitForSent(harness, 1) + }) + + assert.deepEqual(harness.sent.map((message) => message.input.to), ['alice']) + assert.equal(harness.sent[0].input.data?.path, '/slack/channels/C123ABC/messages/1780607825_485189/files/attachment.json') +}) + test('integration events ignore agent-originated Relayfile writes', async () => { const harness = makeHarness() diff --git a/src/main/integration-event-bridge.ts b/src/main/integration-event-bridge.ts index 892c3958..59cd771b 100644 --- a/src/main/integration-event-bridge.ts +++ b/src/main/integration-event-bridge.ts @@ -1271,11 +1271,12 @@ function shouldNotifyRelayfilePath(pathValue: string): boolean { function isLikelyLocalWritebackCommandPath(path: string): boolean { const segments = pathSegments(path) const leaf = segments.at(-1) || '' + const parent = segments.at(-2) const stem = leaf.replace(/\.json$/u, '') const provider = segments[0] if (provider !== 'slack' && provider !== 'chat') return false if (!leaf.endsWith('.json') || leaf === 'meta.json') return false - if (!segments.some((segment) => segment === 'messages' || segment === 'replies')) return false + if (parent !== 'messages' && parent !== 'replies') return false return !/^\d+(?:[._-]\d+)*$/u.test(stem) }