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

   ## What this PR changes
   
   This PR makes the Codex `auth.json` write-back in the automated review 
workflow conditional and conflict-aware.
   
   - Record the SHA-256 of the selected and validated OSS auth file before 
Codex starts.
   - After the review finishes, upload `auth.json` only when Codex actually 
changed the local file.
   - Re-download the current OSS object immediately before write-back and 
upload only when it still matches the originally downloaded version.
   - Retry OSS reads and writes up to three times with a short delay. If a 
refreshed credential cannot be verified or persisted, fail this non-required 
workflow instead of silently losing the update.
   - Run the sync whenever auth setup succeeded, even if the review later 
failed for an unrelated reason, because Codex may already have refreshed the 
credential.
   
   The resulting decision is:
   
   | Local auth after Codex | Current OSS auth | Result |
   | --- | --- | --- |
   | Unchanged from the downloaded version | Not read | Skip write-back |
   | Changed | Still the downloaded version | Upload the refreshed auth |
   | Changed | Changed by another job or operator | Skip the stale write-back |
   | Changed | OSS cannot be read or written after retries | Fail the workflow |
   
   ## Why
   
   The previous step uploaded `auth.json` unconditionally. An in-flight job 
could therefore overwrite a credential that an operator had just reseeded, or 
overwrite another newer OSS copy even when Codex had not refreshed anything in 
that job.
   
   This change protects the normal operational reseed path without requiring 
jobs to drain first. It also keeps the implementation local to the existing 
workflow and does not introduce a lease or reduce review concurrency.
   
   ## Scope and accepted limitations
   
   This PR intentionally addresses only safe persistence of a Codex-refreshed 
`auth.json`.
   
   It does not change:
   
   - account selection, randomization, or usage-limit cooldown handling;
   - revoked-account handling;
   - the fact that multiple jobs may select the same account;
   - the shared-auth model into an officially supported serialized model;
   - token refresh behavior inside Codex.
   
   The OSS comparison and final upload are not an atomic compare-and-swap. A 
small race remains if the same OSS object changes between the final read and 
upload. Eliminating that race would require conditional object writes, 
versioning, or locking and is deliberately left out to keep this PR small. The 
workflow continues to accept rare concurrent-refresh failures rather than 
limiting review concurrency.
   
   ## Validation
   
   - Parsed the workflow as YAML.
   - Ran `bash -n` on the updated shell step.
   - Exercised the unchanged, refreshed, and remote-conflict decision paths 
with mocked OSS operations.
   - Exercised retry success on the third attempt and failure after three 
attempts.
   - Ran `git diff --check`.
   
   


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