Skip to content

Commit 5ee0c12

Browse files
committed
fix(opencode): use generic reauthentication guidance
1 parent 075b02a commit 5ee0c12

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/opencode/src/plugin/openai/codex.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ async function refreshAccessToken(refreshToken: string, issuer = ISSUER): Promis
151151
code === "refresh_token_invalidated"
152152
) {
153153
throw new ProviderError.AuthenticationError(
154-
"Your ChatGPT login could not be refreshed. Run `opencode auth login` to sign in again.",
154+
"Your ChatGPT login could not be refreshed. Please sign in again.",
155155
)
156156
}
157157
throw new Error(`Token refresh failed: ${response.status}`)
@@ -526,10 +526,10 @@ export async function CodexAuthPlugin(input: PluginInput, options: CodexAuthPlug
526526
...init,
527527
headers,
528528
}
529-
const request = () =>
530-
websocketFetch && parsed.pathname.endsWith("/responses")
531-
? websocketFetch(url, requestInit)
532-
: fetch(url, OpenAIWebSocketPool.withoutInternalHeaders(requestInit))
529+
const request = () => {
530+
if (websocketFetch && parsed.pathname.endsWith("/responses")) return websocketFetch(url, requestInit)
531+
return fetch(url, OpenAIWebSocketPool.withoutInternalHeaders(requestInit))
532+
}
533533
const response = await request()
534534
if (response.status !== 401) return response
535535
await response.body?.cancel()

packages/opencode/test/plugin/codex.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ describe("plugin.codex", () => {
317317
const error = await loaded.fetch!("https://api.openai.com/v1/responses").catch((error: unknown) => error)
318318

319319
expect(error).toBeInstanceOf(ProviderError.AuthenticationError)
320-
expect(error.message).toContain("opencode auth login")
320+
expect(error.message).toBe("Your ChatGPT login could not be refreshed. Please sign in again.")
321321
})
322322
})
323323

0 commit comments

Comments
 (0)