shuke987 commented on code in PR #66319:
URL: https://github.com/apache/doris/pull/66319#discussion_r3689976201


##########
.github/workflows/code-review-runner.yml:
##########
@@ -212,15 +212,58 @@ jobs:
           OSS_CODEX_GOAL_FALLBACK_OBJECT: 
oss://doris-community-ci/codex/codex-goal
 
       - name: Configure Codex auth
+        id: auth
         timeout-minutes: 5
         run: |
           install -m 700 -d "$RUNNER_TEMP/codex-home"
           printf 'CODEX_HOME=%s\n' "$RUNNER_TEMP/codex-home" >> "$GITHUB_ENV"
 
-          auth_object="$(printf '%s\n' \
+          auth_object=""
+          earliest_retry_after_epoch=""
+          now_epoch="$(date +%s)"
+          while IFS= read -r candidate; do
+            context_file="$(mktemp "$RUNNER_TEMP/codex-auth-context.XXXXXX")"
+            if ossutil -i "$OSS_AK" -k "$OSS_SK" -e "$OSS_ENDPOINT" \
+              cp -f "${candidate}.context" "$context_file" >/dev/null 2>&1; 
then
+              if ! context="$(jq -er '
+                select(.version == 1
+                  and (.state | type == "string")
+                  and (.retry_after_epoch | type == "number" and floor == .))

Review Comment:
   Fixed in d629cc037e9. The raw epoch is now accepted only if GNU `date` can 
canonicalize it to `%s` before Bash compares it. Scientific or out-of-range 
values warn and are treated as absent. Added mock cases for `1e100` and 
`9223372036854775807`.



##########
.github/workflows/code-review-runner.yml:
##########
@@ -212,15 +212,58 @@ jobs:
           OSS_CODEX_GOAL_FALLBACK_OBJECT: 
oss://doris-community-ci/codex/codex-goal
 
       - name: Configure Codex auth
+        id: auth
         timeout-minutes: 5
         run: |
           install -m 700 -d "$RUNNER_TEMP/codex-home"
           printf 'CODEX_HOME=%s\n' "$RUNNER_TEMP/codex-home" >> "$GITHUB_ENV"
 
-          auth_object="$(printf '%s\n' \
+          auth_object=""
+          earliest_retry_after_epoch=""
+          now_epoch="$(date +%s)"
+          while IFS= read -r candidate; do
+            context_file="$(mktemp "$RUNNER_TEMP/codex-auth-context.XXXXXX")"
+            if ossutil -i "$OSS_AK" -k "$OSS_SK" -e "$OSS_ENDPOINT" \
+              cp -f "${candidate}.context" "$context_file" >/dev/null 2>&1; 
then
+              if ! context="$(jq -er '
+                select(.version == 1
+                  and (.state | type == "string")
+                  and (.retry_after_epoch | type == "number" and floor == .))
+                | [.state, .retry_after_epoch] | @tsv
+              ' "$context_file" 2>/dev/null)"; then
+                echo "::warning::Ignoring malformed Codex auth context for 
${candidate##*/}; the account remains eligible."
+                auth_object="$candidate"
+                break
+              fi
+
+              read -r context_state retry_after_epoch <<<"$context"

Review Comment:
   Fixed in d629cc037e9. The TSV/`read` path has been removed; jq now compares 
`.state == "usage_limited"` exactly. Leading or trailing whitespace therefore 
warns and is treated as absent. Added both whitespace mock cases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to