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
Original file line number Diff line number Diff line change
Expand Up @@ -955,11 +955,16 @@ describe('GitLab group Search permission boundary', () => {
try {
expect(JSON.stringify(await read(ids.aliceId, url))).toContain('Atlas code content')
transport.admissionFailurePath = '/api/v4/projects/team%2Fa'
for (const status of [429, 503] as const) {
transport.admissionFailure = new OutboundAdmissionError(1000, status)
for (const [status, message] of [
[429, 'The connection is busy. Try again shortly.'],
[503, 'Connection request admission is temporarily unavailable.'],
] as const) {
transport.admissionFailure = new OutboundAdmissionError(2500, status)
await expect(read(ids.aliceId, url)).rejects.toMatchObject({
name: 'LiveReadError',
message,
retryable: true,
retryAfterSeconds: 3,
})
}
transport.admissionFailure = undefined
Expand Down
1 change: 1 addition & 0 deletions apps/sim/lib/sim-search/live/account-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function isProjectAnswer(error: unknown): boolean {
return (
error.status === 'unavailable' &&
error.diagnosticCode !== 'request_budget_exceeded' &&
error.diagnosticCode !== 'outbound_admission' &&
(error.httpStatus === undefined || error.httpStatus < 500)
)
}
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/sim-search/live/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ function liveReadFailure(error: unknown, provider: string, deadline?: AbortSigna
'unauthorized',
`Reconnect ${name} to read this document. ${error.message}`
)
if (error.status === 'rate_limited')
if (error.status === 'rate_limited' || error.diagnosticCode === 'outbound_admission')
return new LiveReadError(error.message, true, error.retryAfterSeconds)
if (error.status === 'timeout' || error.httpStatus === 408)
return new LiveReadError(`${name} timed out reading this document. Try again.`, true)
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/sim-search/live/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function createNativeClient(input: {
error.status === 429 ? 'rate_limited' : 'unavailable',
error.message,
Math.ceil(error.retryAfterMs / 1000),
error.status,
undefined,
'outbound_admission'
)
throw error
Expand Down
Loading