@@ -4,6 +4,9 @@ import * as Schema from "effect/Schema";
44import * as CodexSchema from "./schema.ts" ;
55
66const isGetAccountResponse = Schema . is ( CodexSchema . V2GetAccountResponse ) ;
7+ const isThreadReadResponse = Schema . is ( CodexSchema . V2ThreadReadResponse ) ;
8+ const isThreadResumeResponse = Schema . is ( CodexSchema . V2ThreadResumeResponse ) ;
9+ const isThreadRollbackResponse = Schema . is ( CodexSchema . V2ThreadRollbackResponse ) ;
710
811it ( "accepts Codex 0.150 multi-agent values" , ( ) => {
912 const schemas = [
@@ -75,15 +78,44 @@ it("accepts Codex 0.150 multi-agent values", () => {
7578} ) ;
7679
7780it ( "accepts Codex rate limit errors for thread responses" , ( ) => {
78- const schemas = [
79- CodexSchema . V2ThreadReadResponse__CodexErrorInfo ,
80- CodexSchema . V2ThreadResumeResponse__CodexErrorInfo ,
81- CodexSchema . V2ThreadRollbackResponse__CodexErrorInfo ,
82- ] ;
83-
84- for ( const schema of schemas ) {
85- assert . equal ( Schema . is ( schema ) ( "rateLimitExceeded" ) , true ) ;
86- }
81+ const failedThread = {
82+ cliVersion : "0.150.0" ,
83+ createdAt : 0 ,
84+ cwd : "/tmp/project" ,
85+ ephemeral : false ,
86+ id : "thread-1" ,
87+ modelProvider : "openai" ,
88+ preview : "" ,
89+ sessionId : "session-1" ,
90+ source : "cli" ,
91+ status : { type : "idle" } ,
92+ turns : [
93+ {
94+ error : {
95+ codexErrorInfo : "rateLimitExceeded" ,
96+ message : "Rate limit exceeded" ,
97+ } ,
98+ id : "turn-1" ,
99+ items : [ ] ,
100+ status : "failed" ,
101+ } ,
102+ ] ,
103+ updatedAt : 0 ,
104+ } ;
105+ assert . equal ( isThreadReadResponse ( { thread : failedThread } ) , true ) ;
106+ assert . equal (
107+ isThreadResumeResponse ( {
108+ approvalPolicy : "never" ,
109+ approvalsReviewer : "user" ,
110+ cwd : "/tmp/project" ,
111+ model : "gpt-5.6-sol" ,
112+ modelProvider : "openai" ,
113+ sandbox : { type : "dangerFullAccess" } ,
114+ thread : failedThread ,
115+ } ) ,
116+ true ,
117+ ) ;
118+ assert . equal ( isThreadRollbackResponse ( { thread : failedThread } ) , true ) ;
87119} ) ;
88120
89121it ( "accepts Codex 0.150 account plan values" , ( ) => {
0 commit comments