shuke987 opened a new pull request, #66319:
URL: https://github.com/apache/doris/pull/66319

   ## Scope and complexity boundary
   
   This PR intentionally solves **one problem only**: when the Codex account 
selected by the automated `/review` workflow reaches its usage limit, 
temporarily exclude that account and retry the same review with another 
configured account.
   
   The implementation is deliberately limited to one workflow file. The 
priority for this phase is to keep the change small and reviewable, reduce 
rollout risk, and accept low-probability retry failures instead of adding 
coordination machinery.
   
   ### In scope
   
   - Record a usage-limited account in an adjacent `auth.json.x.context` OSS 
object.
   - Skip that account until its retry time; make it eligible again lazily 
after expiration.
   - Preserve the existing configured account list, random selection, and 
unrestricted workflow concurrency.
   - After the context upload succeeds, dispatch one replacement review for the 
same PR and commit.
   - Suppress the original PR failure comment only after the replacement review 
was successfully dispatched.
   
   ### Explicitly out of scope
   
   - Access-token refresh behavior or auth-file write-back changes.
   - Revoked or otherwise invalid accounts.
   - Leases, locks, CAS, account ownership, or serialization across concurrent 
jobs.
   - Round-robin selection, dynamic auth discovery, or usage balancing.
   - Cron/offline recovery and automatic wake-up when every account is limited.
   - Other changes from #66119 or a broader code-review workflow refactor.
   
   Please review this PR against that boundary. Follow-up problems should be 
handled separately so this PR does not grow in complexity.
   
   ## What changed
   
   - Shuffle the existing three auth candidates, then ignore candidates whose 
valid context reports an unexpired `usage_limited` state.
   - Treat missing, expired, or malformed context as eligible; malformed 
context emits a warning.
   - Detect the currently observed Codex CLI usage-limit failure, parse its 
retry time, and use a 30-minute fallback when no usable future time is 
available.
   - Upload the context before calling `workflow_dispatch`, ensuring the 
replacement run can skip the exhausted account.
   - Grant the workflow the minimum additional `actions: write` permission 
required for dispatch.
   
   A `workflow_dispatch` is used instead of posting `/review` because events 
created by `GITHUB_TOKEN` comments do not start another workflow run.
   
   ## Validation
   
   - YAML parsing.
   - `bash -n` for every workflow `run` block.
   - `git diff --check`.
   - Mock coverage for missing, malformed, expired, partially limited, and 
fully limited contexts.
   - Mock coverage for retry-time parsing, unrelated 429/401/refresh/network 
failures, OSS upload failure, one successful replacement dispatch, and dispatch 
input preservation.
   
   ## Accepted limitations
   
   - The observed `You've hit your usage limit` CLI message is not a documented 
stable API contract. If it changes, the workflow intentionally avoids guessing 
and will not quarantine an account.
   - Concurrent runs may make duplicate retry attempts; this phase 
intentionally does not add leases or global coordination.
   - If all configured accounts are limited, the retry chain stops and requires 
a later manual `/review`.
   


-- 
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