Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/main/__tests__/integration-event-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: waitForSent is called inside withMockedNow, breaking its timeout mechanism — if the event is not delivered, the test hangs instead of failing cleanly with a timeout.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/__tests__/integration-event-bridge.test.ts, line 979:

<comment>`waitForSent` is called inside `withMockedNow`, breaking its timeout mechanism — if the event is not delivered, the test hangs instead of failing cleanly with a timeout.</comment>

<file context>
@@ -960,6 +960,29 @@ test('integration events ignore index, discovery, tmp, dotfile, and local writeb
+    ])
+
+    await harness.emit(changeEvent('/slack/channels/C123ABC/messages/1780607825_485189/files/attachment.json', 'slack'))
+    await waitForSent(harness, 1)
+  })
+
</file context>

})

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()

Expand Down
3 changes: 2 additions & 1 deletion src/main/integration-event-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading