File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,14 +40,6 @@ export namespace ProviderError {
4040 return / ^ 4 ( 0 0 | 1 3 ) \s * ( s t a t u s c o d e ) ? \s * \( n o b o d y \) / 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 }
Original file line number Diff line number Diff 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" ,
You can’t perform that action at this time.
0 commit comments