feat: add pull request progress comments - #177
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42e8d0a33a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| const [owner, repo] = repository.split("/", 2); | ||
| const client = octokit ?? new Octokit({ auth: token }); |
There was a problem hiding this comment.
Honor GITHUB_API_URL for progress comments
On GitHub Enterprise Server, this client defaults to https://api.github.com instead of the server URL provided through GITHUB_API_URL. The repository's existing permissions client explicitly forwards that environment variable for the same reason, but an opted-in progress step will instead send the enterprise token to GitHub.com and fail before Codex runs. Construct this client with the configured baseUrl as well.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const [owner, repo] = repository.split("/", 2); | ||
| const client = octokit ?? new Octokit({ auth: token }); |
There was a problem hiding this comment.
Reuse the retry-enabled Octokit client
When GitHub returns a transient 5xx response or closes a connection during comment listing, creation, or update, this plain Octokit client does not apply the retry plugin already used by checkActorPermissions.ts. A transient failure in the start step prevents Codex from running, while one in the final step turns an otherwise successful Codex execution into a failed action. Use the repository's retry-enabled Octokit construction for these API calls.
Useful? React with 👍 / 👎.
| const existing = comments.find( | ||
| (comment) => | ||
| comment.user?.login === "github-actions[bot]" && | ||
| comment.body?.includes(MARKER) |
There was a problem hiding this comment.
Prevent stale runs from overwriting current progress
When two action runs overlap for the same pull request—for example, a second commit arrives while the first Codex run is active—both runs select the same bot-authored marker comment. The older run can therefore write completed or failed after the newer run has written running, making the sticky comment falsely report that no work remains. Scope ownership to a run identifier or make final updates conditional on the comment still belonging to that run.
Useful? React with 👍 / 👎.
Summary\n\nAdds an opt-in
progress-comment: trueinput that creates a sticky comment on pull requests before Codex begins and updates it when execution completes or fails. This brings a visible progress signal to long-running PR workflows without changing the default behavior.\n\nThe feature is a no-op on non-PR events and requirespull-requests: writepermission. It only updates marker-bearing comments authored bygithub-actions[bot].\n\nAddresses the progress-visibility request in #68.\n\n## Example\n\nyaml\npermissions:\n pull-requests: write\n\n- uses: openai/codex-action@v1\n with:\n progress-comment: true\n prompt: Review this pull request.\n\n\n## Validation\n\n-corepack pnpm run check\n-corepack pnpm run build\n-node --test --test-name-pattern='opt-in pull request progress comments' test/actionHardening.test.mjs\n-git diff --check