Skip to content

feat: add pull request progress comments - #177

Open
Alanperry1 wants to merge 1 commit into
openai:mainfrom
Alanperry1:feat/progress-comments-for-prs
Open

feat: add pull request progress comments#177
Alanperry1 wants to merge 1 commit into
openai:mainfrom
Alanperry1:feat/progress-comments-for-prs

Conversation

@Alanperry1

Copy link
Copy Markdown

Summary\n\nAdds an opt-in progress-comment: true input 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 requires pull-requests: write permission. It only updates marker-bearing comments authored by github-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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +51 to +54
const existing = comments.find(
(comment) =>
comment.user?.login === "github-actions[bot]" &&
comment.body?.includes(MARKER)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants