From 1c0ccb477a11656fe42e8f3a0e3b0d0d23dc5d1c Mon Sep 17 00:00:00 2001 From: cat Date: Mon, 6 Jul 2026 19:09:26 +0800 Subject: [PATCH] fix: add missing Codex CLI headers for OAuth account test The testOpenAIAccountConnection function was sending requests to chatgpt.com/backend-api/codex/responses without the required Codex CLI identification headers, causing 401 Unauthorized for OAuth/PAT accounts. The gateway Forward path and the compact test path both set these headers: - Originator: codex_cli_rs - User-Agent: codex_cli_rs/ - OpenAI-Beta: responses=experimental This patch adds the same headers to the normal (non-compact) OAuth test path. API key accounts and other platforms are unaffected since the headers are inside the isOAuth branch. --- backend/internal/service/account_test_service.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/internal/service/account_test_service.go b/backend/internal/service/account_test_service.go index 80a862b971..a67a699e9f 100644 --- a/backend/internal/service/account_test_service.go +++ b/backend/internal/service/account_test_service.go @@ -600,6 +600,9 @@ func (s *AccountTestService) testOpenAIAccountConnection(c *gin.Context, account if isOAuth { req.Host = "chatgpt.com" req.Header.Set("accept", "text/event-stream") + req.Header.Set("OpenAI-Beta", "responses=experimental") + req.Header.Set("Originator", "codex_cli_rs") + req.Header.Set("User-Agent", codexCLIUserAgent) setOpenAIChatGPTAccountHeaders(req.Header, credentialAccount) }