@@ -32,7 +32,6 @@ import (
3232
3333const officialCodexBaseURL = "https://chatgpt.com/backend-api/codex"
3434const defaultCodexInstructions = "You are Codex, a coding agent based on GPT-5. You and the user share the same workspace and collaborate to achieve the user's goals. Be pragmatic, concise, and focus on completing the user's task."
35- const thinResponsesOfficialLowRemainingThreshold = 3.0
3635const thinResponsesCapacityCooldownWindow = 3 * time .Minute
3736const thinResponsesRateLimitCooldownWindow = 1 * time .Minute
3837const activeAccountFailoverRetryAttempts = 3
@@ -958,27 +957,9 @@ func (h *ResponsesHandler) skipReasonForThinCandidate(candidate routing.Candidat
958957 if candidate .Account .RoutingCooldownActive (now ) && ! candidate .Account .IsActive {
959958 return "routing_cooldown" , true
960959 }
961- if officialRemainingBelowThreshold (candidate ) {
962- return "official_remaining_below_3pct" , true
963- }
964960 return "" , false
965961}
966962
967- func officialRemainingBelowThreshold (candidate routing.Candidate ) bool {
968- if ! usesOfficialCodexAdapter (candidate .Account ) {
969- return false
970- }
971- primaryRemaining := 100 - candidate .Snapshot .PrimaryUsedPercent
972- secondaryRemaining := 100 - candidate .Snapshot .SecondaryUsedPercent
973- if candidate .Snapshot .PrimaryResetsAt != nil && primaryRemaining < thinResponsesOfficialLowRemainingThreshold {
974- return true
975- }
976- if candidate .Snapshot .SecondaryResetsAt != nil && secondaryRemaining < thinResponsesOfficialLowRemainingThreshold {
977- return true
978- }
979- return false
980- }
981-
982963func shouldCooldownThinCandidate (candidate routing.Candidate , reason string ) bool {
983964 if reason == "routing_cooldown" {
984965 return false
@@ -1034,7 +1015,7 @@ func (h *ResponsesHandler) publishAccountRoutingStateChanged() {
10341015func computeThinCandidateCooldownUntil (snapshot usage.Snapshot , reason string ) * time.Time {
10351016 now := time .Now ().UTC ()
10361017 switch reason {
1037- case "official_remaining_below_3pct" , " usage_limited" , "capacity_failed" :
1018+ case "usage_limited" , "capacity_failed" :
10381019 resetAt := relevantOfficialResetAt (snapshot )
10391020 until := routing .ComputeCooldownUntil (now , routing .CooldownReasonCapacity , resetAt , thinResponsesCapacityCooldownWindow )
10401021 return & until
@@ -1058,17 +1039,7 @@ func latestRelevantResetAt(snapshot usage.Snapshot) *time.Time {
10581039}
10591040
10601041func relevantOfficialResetAt (snapshot usage.Snapshot ) * time.Time {
1061- var candidates []* time.Time
1062- if snapshot .PrimaryResetsAt != nil && 100 - snapshot .PrimaryUsedPercent < thinResponsesOfficialLowRemainingThreshold {
1063- candidates = append (candidates , snapshot .PrimaryResetsAt )
1064- }
1065- if snapshot .SecondaryResetsAt != nil && 100 - snapshot .SecondaryUsedPercent < thinResponsesOfficialLowRemainingThreshold {
1066- candidates = append (candidates , snapshot .SecondaryResetsAt )
1067- }
1068- if len (candidates ) == 0 {
1069- return latestRelevantResetAt (snapshot )
1070- }
1071- return latestResetAtFor (candidates ... )
1042+ return latestRelevantResetAt (snapshot )
10721043}
10731044
10741045func latestResetAtFor (candidates ... * time.Time ) * time.Time {
0 commit comments