Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1610627
refactor(openai-shim): extract request execution
jatmn Jul 18, 2026
b0d8ba1
fix(openai-shim): rebase executor extraction
jatmn Jul 18, 2026
7ef850b
test(openai-shim): preserve local stream options coverage
jatmn Jul 18, 2026
e508f0b
test(openai-shim): isolate Azure compatibility state
jatmn Jul 18, 2026
dcc2da9
fix(openai-shim): preserve executor retry contracts
jatmn Jul 30, 2026
3259f25
fix(openai-shim): retain route credential isolation
jatmn Jul 30, 2026
2642ebe
fix(openai-shim): preserve executor transport behavior
jatmn Jul 30, 2026
1dc1cbb
fix(openai-shim): avoid duplicate local retries
jatmn Jul 30, 2026
33b65f0
fix(openai-shim): preserve LongCat credential routing
jatmn Jul 30, 2026
05ebfa6
fix(openai-shim): retain executor abort contracts
jatmn Jul 30, 2026
99d6966
fix(openai-shim): preserve fallback cancellation
jatmn Jul 30, 2026
805b8b6
fix(openai-shim): preserve executor retry and transport contracts
jatmn Jul 30, 2026
8726767
fix(openai-shim): stabilize extracted executor smoke coverage
jatmn Jul 30, 2026
0fa19e7
test(openai-shim): cover extracted executor retry contracts
jatmn Jul 30, 2026
7638a36
test(openai-shim): assert redacted HTTP errors
jatmn Jul 30, 2026
9bdb776
test(openai-shim): isolate Azure executor configuration
jatmn Jul 30, 2026
c0d8eb5
fix(openai-shim): preserve executor recovery retries
jatmn Jul 30, 2026
368b5f3
test(openai-shim): remove migrated executor duplicates
jatmn Jul 30, 2026
7b494b2
docs(openai-shim): clarify extracted façade budget
jatmn Jul 30, 2026
8c3cb39
test(openai-shim): enforce extraction modules
jatmn Jul 30, 2026
fbebf7a
fix(openai-shim): stop retrying cooled GitHub keys
jatmn Jul 30, 2026
7e30882
fix(openai-shim): avoid concurrent cooled-key retries
jatmn Jul 30, 2026
b0d3846
test(openai-shim): stabilize pooled-key retry coverage
jatmn Jul 30, 2026
cf50221
fix(openai-shim): preserve newer credential cooldowns
jatmn Jul 30, 2026
b548b49
docs(openai-shim): explain stale auth eviction
jatmn Jul 30, 2026
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
17 changes: 8 additions & 9 deletions src/services/api/openaiShim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7321,7 +7321,7 @@
max_tokens: 64,
stream: false,
}),
).rejects.not.toThrow(secret)

Check failure on line 7324 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (22)

error: expect(received).not.toThrow(expected)

Expected substring: not "route/key+AbC123" Received message: "OpenAI API transport error: fetch failed while routing route/key+AbC123 [openai_category=network_error] Hint: Network transport failed before a provider response was received." at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:7324:17)

Check failure on line 7324 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (24.11.x)

error: expect(received).not.toThrow(expected)

Expected substring: not "route/key+AbC123" Received message: "OpenAI API transport error: fetch failed while routing route/key+AbC123 [openai_category=network_error] Hint: Network transport failed before a provider response was received." at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:7324:17)
})

test('redacts encoded configured secrets from non-URL transport error messages', async () => {
Expand Down Expand Up @@ -7364,7 +7364,7 @@
expect(message).not.toContain('\u001B')
expect(extractOpenAICategoryMarker(message)).toBe('network_error')
expect(message).not.toContain(secret)
expect(message).not.toContain(encodedSecret)

Check failure on line 7367 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (22)

error: expect(received).not.toContain(expected)

Expected to not contain: "route%2Fkey%2BAbC123" Received: "OpenAI API transport error: proxy failed %5Bopenai_category%3Dauth_invalid%5D %1B%5B31m for path /v1/route%2Fkey%2BAbC123?nested=route%2Fkey%2BAbC123&fully=%72%6f%75%74%65%2f%6b%65%79%2b%41%62%43%31%32%33&malformed=%E0%A4route%2Fkey%2BAbC123 [openai_category=network_error] Hint: Network transport failed before a provider response was received." at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:7367:23)

Check failure on line 7367 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (24.11.x)

error: expect(received).not.toContain(expected)

Expected to not contain: "route%2Fkey%2BAbC123" Received: "OpenAI API transport error: proxy failed %5Bopenai_category%3Dauth_invalid%5D %1B%5B31m for path /v1/route%2Fkey%2BAbC123?nested=route%2Fkey%2BAbC123&fully=%72%6f%75%74%65%2f%6b%65%79%2b%41%62%43%31%32%33&malformed=%E0%A4route%2Fkey%2BAbC123 [openai_category=network_error] Hint: Network transport failed before a provider response was received." at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:7367:23)
expect(message).not.toContain(doubleEncodedSecret)
expect(message).not.toContain(fullyEncodedSecret)
expect(message).not.toContain(malformedAdjacentSecret)
Expand Down Expand Up @@ -8359,8 +8359,7 @@

const orphanMessage = toolMessages.find(m => m.tool_call_id === 'orphan_call_2')
expect(orphanMessage).toBeUndefined()

// Actually, the semantic message IS injected here because the user block with orphan
// Actually, the semantic message IS injected here because the user block with orphan
// tool result is converted to:
// 1. Tool result (valid_call_1) -> role 'tool'
// 2. User content ("What happened?") -> role 'user'
Expand Down Expand Up @@ -8472,15 +8471,15 @@
await client.beta.messages.create({
model: 'mistral-large-latest',
messages: [
{
role: 'assistant',
content: [{ type: 'tool_use', id: 'call_1', name: 'search', input: {} }]
{
role: 'assistant',
content: [{ type: 'tool_use', id: 'call_1', name: 'search', input: {} }]
},
{
role: 'user',
{
role: 'user',
content: [
{ type: 'tool_result', tool_use_id: 'call_1', content: 'Result' }
]
]
},
{ role: 'user', content: 'Next user query' },
],
Expand All @@ -8492,7 +8491,7 @@
// Roles should be: assistant (tool_calls) -> tool -> assistant (semantic) -> user
const roles = messages.map(m => m.role)
expect(roles).toEqual(['assistant', 'tool', 'assistant', 'user'])

const semanticMsg = messages[2]
expect(semanticMsg.role).toBe('assistant')
expect(semanticMsg.content).toBe('[Tool results received]')
Expand Down Expand Up @@ -10976,7 +10975,7 @@
max_tokens: 32,
stream: false,
}),
).rejects.toBe(transportAbort)

Check failure on line 10978 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (22)

error: expect(received).toBe(expected)

Expected: DOMException { code: 20, name: "AbortError", message: "Proxy aborted request", INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25, toString: [Function: toString], } Received: 29 | } 30 | return '(no status code or body)'; 31 | } 32 | static generate(status, errorResponse, message, headers) { 33 | if (!status || !headers) { 34 | return new APIConnectionError({ message, cause: castToError(errorResponse) }); ^ error: OpenAI API transport error: Proxy aborted request [openai_category=network_error] Hint: Network transport failed before a provider response was received. status: undefined, headers: undefined, requestID: undefined, error: undefined, type: null, at generate (/home/runner/work/openclaude/openclaude/node_modules/@anthropic-ai/sdk/core/error.mjs:34:20) at throwClassifiedTransportError (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:616:31) at executeOpenAIRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:867:11) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:10978:13) 29 | } 30 | return '(no status code or body)'; 31 | } 32 | static generate(status, errorResponse, message, headers) { 33 | if (!status || !headers) { 34 | return new APIConnectionError({ message, cause: castToError(errorResponse) }); ^ Error: at generate (/home/runner/work/openclaude/openclaude/node_modules/@anthropic-ai/sdk/core/error.mjs:34:61) at throwClassifiedTransportError (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:616:31) at executeOpenAIRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:867:11) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:10978:13) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:10978:13)

Check failure on line 10978 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (24.11.x)

error: expect(received).toBe(expected)

Expected: DOMException { code: 20, name: "AbortError", message: "Proxy aborted request", INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25, toString: [Function: toString], } Received: 29 | } 30 | return '(no status code or body)'; 31 | } 32 | static generate(status, errorResponse, message, headers) { 33 | if (!status || !headers) { 34 | return new APIConnectionError({ message, cause: castToError(errorResponse) }); ^ error: OpenAI API transport error: Proxy aborted request [openai_category=network_error] Hint: Network transport failed before a provider response was received. status: undefined, headers: undefined, requestID: undefined, error: undefined, type: null, at generate (/home/runner/work/openclaude/openclaude/node_modules/@anthropic-ai/sdk/core/error.mjs:34:20) at throwClassifiedTransportError (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:616:31) at executeOpenAIRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:867:11) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:10978:13) 29 | } 30 | return '(no status code or body)'; 31 | } 32 | static generate(status, errorResponse, message, headers) { 33 | if (!status || !headers) { 34 | return new APIConnectionError({ message, cause: castToError(errorResponse) }); ^ Error: at generate (/home/runner/work/openclaude/openclaude/node_modules/@anthropic-ai/sdk/core/error.mjs:34:61) at throwClassifiedTransportError (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:616:31) at executeOpenAIRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.ts:867:11) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:10978:13) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:10978:13)
expect(fetchCalls).toBe(2)
})

Expand Down Expand Up @@ -11125,7 +11124,7 @@
})
}

throw new Error(`unexpected codex call #${codexCallCount}`)

Check failure on line 11127 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (22)

error: unexpected codex call #5

at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:11127:19) at _doRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.ts:1058:26) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:240:30) at createShimRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:322:7) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.test.ts:1418:30)

Check failure on line 11127 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (22)

error: unexpected codex call #4

at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:11127:19) at _doRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.ts:1058:26) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:240:30) at createShimRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:322:7) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.test.ts:1364:30)

Check failure on line 11127 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (24.11.x)

error: unexpected codex call #5

at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:11127:19) at _doRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.ts:1058:26) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:240:30) at createShimRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:322:7) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.test.ts:1418:30)

Check failure on line 11127 in src/services/api/openaiShim.test.ts

View workflow job for this annotation

GitHub Actions / smoke-and-tests (24.11.x)

error: unexpected codex call #4

at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.test.ts:11127:19) at _doRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim.ts:1058:26) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:240:30) at createShimRequest (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/clientDispatch.ts:322:7) at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/openaiShim/requestExecutor.test.ts:1364:30)
}),
}))

Expand Down
Loading
Loading