Skip to content

Commit 7a2d89a

Browse files
committed
fix(search): retry native read socket timeouts and mark excluded Confluence matches partial
1 parent 0bd3151 commit 7a2d89a

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎apps/sim/lib/sim-search/live/application.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,16 @@ describe('authorized live retrieval', () => {
796796
new McpError(ErrorCode.RequestTimeout, 'TimeoutError'),
797797
{ retryable: true, message: expect.stringContaining('took too long') },
798798
],
799+
[
800+
'a native request socket timeout',
801+
Object.assign(new Error('Request timed out after 10000ms'), { code: 'ETIMEDOUT' }),
802+
{ retryable: true, message: expect.stringContaining('Try again') },
803+
],
804+
[
805+
'a native request dispatcher timeout',
806+
Object.assign(new Error('Headers Timeout Error'), { code: 'UND_ERR_HEADERS_TIMEOUT' }),
807+
{ retryable: true, message: expect.stringContaining('Try again') },
808+
],
799809
])('classifies %s during a read so the caller can act on it', async (_, failure, expected) => {
800810
const search = await searchLiveKnowledge.execute({ principal, input })
801811
mocks.read.mockRejectedValueOnce(failure)

‎apps/sim/lib/sim-search/live/application.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from '@/lib/api/contracts/mothership-assistant-tools'
1919
import { canonicalJson, fingerprint, instantScopePart } from '@/lib/api/cursor-binding'
2020
import { env } from '@/lib/core/config/env'
21+
import { isRetryableNetworkError } from '@/lib/core/errors/retryable-infrastructure'
2122
import { OrchestrationError } from '@/lib/core/orchestration/types'
2223
import {
2324
type ResourceOwner,
@@ -795,6 +796,11 @@ function liveReadFailure(error: unknown, provider: string, deadline?: AbortSigna
795796
`${name} took too long to return this document. Try again, or read a different result.`,
796797
true
797798
)
799+
if (isRetryableNetworkError(error))
800+
return new LiveReadError(
801+
`${name} did not respond while reading this document. Try again shortly.`,
802+
true
803+
)
798804
return error
799805
}
800806

‎apps/sim/lib/sim-search/live/atlassian.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,6 @@ describe('Confluence live documents', () => {
179179
{ id: '123', kind: 'page' },
180180
])
181181
expect(page.message).toContain('cannot be read')
182+
expect(page.partial).toBe(true)
182183
})
183184
})

‎apps/sim/lib/sim-search/live/atlassian.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export async function searchAtlassian(
212212
const excluded = pages.some((result) => result.excluded)
213213
return {
214214
documents,
215-
partial: !input.native?.project && allSites.length > selected.length,
215+
partial: excluded || (!input.native?.project && allSites.length > selected.length),
216216
hasMore: pages.some((result) => Boolean(result.next)),
217217
nextCursor: single ? pages[0]?.next : undefined,
218218
message:

0 commit comments

Comments
 (0)