Skip to content

Commit 5acfdd1

Browse files
authored
chore: kill old copilot 403 message that was used for old plugin migration (anomalyco#16904)
1 parent 556703f commit 5acfdd1

2 files changed

Lines changed: 0 additions & 41 deletions

File tree

packages/opencode/src/provider/error.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ export namespace ProviderError {
4040
return /^4(00|13)\s*(status code)?\s*\(no body\)/i.test(message)
4141
}
4242

43-
function error(providerID: string, error: APICallError) {
44-
if (providerID.includes("github-copilot") && error.statusCode === 403) {
45-
return "Please reauthenticate with the copilot provider to ensure your credentials work properly with OpenCode."
46-
}
47-
48-
return error.message
49-
}
50-
5143
function message(providerID: string, e: APICallError) {
5244
return iife(() => {
5345
const msg = e.message
@@ -60,10 +52,6 @@ export namespace ProviderError {
6052
return "Unknown error"
6153
}
6254

63-
const transformed = error(providerID, e)
64-
if (transformed !== msg) {
65-
return transformed
66-
}
6755
if (!e.responseBody || (e.statusCode && msg !== STATUS_CODES[e.statusCode])) {
6856
return msg
6957
}

packages/opencode/test/session/message-v2.test.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -842,35 +842,6 @@ describe("session.message-v2.fromError", () => {
842842
})
843843
})
844844

845-
test("maps github-copilot 403 to reauth guidance", () => {
846-
const error = new APICallError({
847-
message: "forbidden",
848-
url: "https://api.githubcopilot.com/v1/chat/completions",
849-
requestBodyValues: {},
850-
statusCode: 403,
851-
responseHeaders: { "content-type": "application/json" },
852-
responseBody: '{"error":"forbidden"}',
853-
isRetryable: false,
854-
})
855-
856-
const result = MessageV2.fromError(error, { providerID: "github-copilot" })
857-
858-
expect(result).toStrictEqual({
859-
name: "APIError",
860-
data: {
861-
message:
862-
"Please reauthenticate with the copilot provider to ensure your credentials work properly with OpenCode.",
863-
statusCode: 403,
864-
isRetryable: false,
865-
responseHeaders: { "content-type": "application/json" },
866-
responseBody: '{"error":"forbidden"}',
867-
metadata: {
868-
url: "https://api.githubcopilot.com/v1/chat/completions",
869-
},
870-
},
871-
})
872-
})
873-
874845
test("detects context overflow from APICallError provider messages", () => {
875846
const cases = [
876847
"prompt is too long: 213462 tokens > 200000 maximum",

0 commit comments

Comments
 (0)