fix(desktop): preserve generation timeout reason and raise dropdown ceiling #482
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Codex PR Review | |
| on: | |
| pull_request_target: | |
| types: [opened, reopened, ready_for_review, synchronize] | |
| concurrency: | |
| group: codex-pr-review-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| pr-review: | |
| if: | | |
| github.event.pull_request.draft == false && | |
| !endsWith(github.actor, '[bot]') && | |
| !contains(github.event.pull_request.labels.*.name, 'bot-skip') && | |
| vars.CODEX_BOT_ENABLED == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| outputs: | |
| review_result: ${{ steps.run_codex.outputs.final-message }} | |
| steps: | |
| - name: Check bot review state | |
| id: check_bot | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const marker = "*open-codesign Bot*"; | |
| const allowedLogins = (process.env.BOT_LOGINS || "github-actions[bot]") | |
| .split(",").map((v) => v.trim()).filter(Boolean); | |
| const currentHeadSha = context.payload.pull_request.head.sha; | |
| const reviews = await github.paginate( | |
| github.rest.pulls.listReviews, | |
| { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| per_page: 100 | |
| } | |
| ); | |
| const botReviews = reviews | |
| .filter((r) => { | |
| if (!(r?.body || "").includes(marker)) return false; | |
| const u = r.user; | |
| if (!u || u.type !== "Bot") return false; | |
| return allowedLogins.includes(u.login); | |
| }) | |
| .sort((a, b) => { | |
| const at = new Date(a.submitted_at || a.created_at || 0).getTime(); | |
| const bt = new Date(b.submitted_at || b.created_at || 0).getTime(); | |
| if (bt !== at) return bt - at; | |
| return (b.id || 0) - (a.id || 0); | |
| }); | |
| const latest = botReviews[0]; | |
| const hasReviewForCurrentHead = botReviews.some((r) => r.commit_id === currentHeadSha); | |
| const isFollowUp = Boolean(latest?.commit_id && latest.commit_id !== currentHeadSha); | |
| core.setOutput("current_head_sha", currentHeadSha); | |
| core.setOutput("has_review_for_current_head", hasReviewForCurrentHead ? "true" : "false"); | |
| core.setOutput("latest_bot_review_id", latest ? String(latest.id) : ""); | |
| core.setOutput("latest_bot_review_commit", latest?.commit_id || ""); | |
| core.setOutput("is_follow_up_review", isFollowUp ? "true" : "false"); | |
| env: | |
| BOT_LOGINS: ${{ vars.BOT_LOGINS }} | |
| - name: Checkout repository | |
| if: steps.check_bot.outputs.has_review_for_current_head != 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: refs/pull/${{ github.event.pull_request.number }}/merge | |
| fetch-depth: 0 | |
| - name: Pre-fetch base and head refs | |
| if: steps.check_bot.outputs.has_review_for_current_head != 'true' | |
| run: | | |
| git fetch --no-tags origin \ | |
| ${{ github.event.pull_request.base.ref }} \ | |
| +refs/pull/${{ github.event.pull_request.number }}/head | |
| - name: Run Codex for PR Review | |
| id: run_codex | |
| if: steps.check_bot.outputs.has_review_for_current_head != 'true' | |
| uses: openai/codex-action@v1 | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| CURRENT_HEAD_SHA: ${{ steps.check_bot.outputs.current_head_sha }} | |
| LATEST_BOT_REVIEW_ID: ${{ steps.check_bot.outputs.latest_bot_review_id }} | |
| LATEST_BOT_REVIEW_COMMIT: ${{ steps.check_bot.outputs.latest_bot_review_commit }} | |
| IS_FOLLOW_UP_REVIEW: ${{ steps.check_bot.outputs.is_follow_up_review }} | |
| with: | |
| openai-api-key: ${{ secrets.OPENAI_API_KEY }} | |
| responses-api-endpoint: ${{ secrets.OPENAI_BASE_URL }} | |
| model: ${{ vars.OPENAI_MODEL || 'gpt-5.4' }} | |
| effort: ${{ vars.OPENAI_EFFORT || 'high' }} | |
| sandbox: danger-full-access | |
| safety-strategy: drop-sudo | |
| prompt-file: .github/prompts/codex-pr-review.md | |
| allow-bots: true | |
| allow-users: '*' |