Skip to content

review-agent: switch hypershift workflow from GitHub App to PAT auth - #83182

Open
bryan-cox wants to merge 4 commits into
openshift:mainfrom
bryan-cox:review-agent-pat-auth
Open

review-agent: switch hypershift workflow from GitHub App to PAT auth#83182
bryan-cox wants to merge 4 commits into
openshift:mainfrom
bryan-cox:review-agent-pat-auth

Conversation

@bryan-cox

@bryan-cox bryan-cox commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Switch the HyperShift review-agent workflow from GitHub App auth to PAT auth via the jira-solve-bot account
  • Replace the JWT-based token exchange in the trigger step with a simple PAT file read, fixing the exit-code-6 failure where the App token generation broke
  • Remove the jira-agent-github-app-auth pre step (App-only) from the workflow
  • Aligns with the installer review-agent workflow pattern established in review-agent: add PAT auth mode and installer onboarding #82202

Test plan

  • Rehearse the address-review-comments presubmit on a HyperShift PR
  • Verify the trigger step posts a comment on the PR and exits successfully
  • Verify the periodic review-agent job runs and addresses review comments

🤖 Generated with Claude Code

Summary by CodeRabbit

The HyperShift review-agent workflow now uses a jira-solve-bot GitHub PAT instead of GitHub App authentication. It removes JWT token generation and the GitHub App authentication step.

The trigger reads the PAT from the credential key configured by REVIEW_AGENT_PAT_KEY. If the PAT exists and is non-empty, the trigger posts the Gangway job result to the pull request. The workflow no longer uses a hardcoded test pull request.

The GitHub App token exchange in the trigger step was failing (exit code
6), causing the presubmit to report failure even though the periodic
review agent job succeeded. Switch to PAT auth via jira-solve-bot,
matching the pattern already used by the installer review-agent workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The HyperShift review-agent now uses a configurable GitHub PAT instead of GitHub App credentials. The workflow uses automatic forking through jira-solve-bot. The trigger posts comments only when the PAT is available.

Changes

HyperShift review-agent PAT flow

Layer / File(s) Summary
PAT configuration and workflow wiring
ci-operator/step-registry/hypershift/review-agent/hypershift-review-agent-workflow.yaml, ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-ref.yaml
The workflow configures PAT authentication and automatic forking through jira-solve-bot. The trigger reference adds REVIEW_AGENT_PAT_KEY, which defaults to gh-pat.
PAT-based comment posting
ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh
The trigger reads the configured PAT and posts pull-request comments with curl --fail when the token exists and is not empty. Missing or empty tokens produce warnings and skip commenting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: enxebre, sjenning

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: switching HyperShift review-agent authentication from GitHub App to PAT authentication.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The full PR range changes only two YAML files and one shell script; it adds or modifies no Ginkgo test titles or dynamic test names.
Test Structure And Quality ✅ Passed The commit changes only one YAML file and one shell script; it adds or modifies no Ginkgo tests, so the listed test-quality requirements do not apply.
Microshift Test Compatibility ✅ Passed The patch changes only YAML and a shell trigger; it adds no Ginkgo tests and references no MicroShift-unavailable APIs or features.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR changes only workflow YAML and a shell trigger; it adds no Ginkgo e2e tests or multi-node test assumptions, so the SNO check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The commit changes only a CI workflow and trigger shell script; no deployment manifest, operator/controller code, or topology-sensitive scheduling constraint is added or modified.
Ote Binary Stdout Contract ✅ Passed The PR changes only review-agent YAML and a Bash trigger; no OTE binary, main/suite setup, or process-level Go stdout writes are changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR changes only review-agent YAML and shell files; it adds no Ginkgo e2e tests, so this IPv6/disconnected test check is not applicable.
No-Weak-Crypto ✅ Passed The PR adds no MD5, SHA1, DES, RC4, Blowfish, ECB, or custom crypto; it removes JWT signing and only checks whether the PAT is non-empty.
Container-Privileges ✅ Passed The complete PR diff and final review-agent manifests contain no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, or root execution settings.
No-Sensitive-Data-In-Logs ✅ Passed PAT and Gangway token contents are read and sent while tracing is disabled; logs expose only credential paths, job IDs, and job URLs.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from enxebre and sjenning August 10, 2026 14:59
@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2026
Remove before merge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh (1)

92-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document the tracing-disabled scope.

Add a comment immediately before set +x. State that tracing is disabled while the script reads and sends the PAT.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh`
around lines 92 - 93, Add a concise comment immediately before set +x in the
tracing setup, documenting that command tracing is disabled while the script
reads and sends the PAT; leave the existing _was_tracing handling unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh`:
- Around line 90-107: Update the PAT handling around PAT_FILE to read its
contents with shell tracing disabled, then only execute the comment-posting curl
flow when the resulting GITHUB_TOKEN_PAT is non-empty. Treat an empty PAT file
as unavailable while preserving the existing COMMENT_BODY selection and curl
request for valid credentials.
- Around line 6-12: Update the PR_NUMBER initialization in the trigger script to
use the PULL_NUMBER environment variable instead of the hardcoded value, and
restore the required-value validation that emits an error and exits when
PULL_NUMBER is unset. Remove the temporary commented-out implementation so each
presubmit targets its own pull request.

---

Nitpick comments:
In
`@ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh`:
- Around line 92-93: Add a concise comment immediately before set +x in the
tracing setup, documenting that command tracing is disabled while the script
reads and sends the PAT; leave the existing _was_tracing handling unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 7580870f-78af-430b-8923-54533bf7abe8

📥 Commits

Reviewing files that changed from the base of the PR and between 001f9c2 and 040e06a.

📒 Files selected for processing (3)
  • ci-operator/step-registry/hypershift/review-agent/hypershift-review-agent-workflow.yaml
  • ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh
  • ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-ref.yaml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bryan-cox
bryan-cox force-pushed the review-agent-pat-auth branch from 0c015f5 to e870b89 Compare August 10, 2026 15:34
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@bryan-cox

Copy link
Copy Markdown
Member Author

/pj-rehearse pull-ci-openshift-hypershift-main-address-review-comments

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@bryan-cox: the pj-rehearse plugin accommodates running rehearsal tests for the changes in this PR. Expand 'Interacting with pj-rehearse' for usage details. The following rehearsable tests have been affected by this change:

Test name Repo Type Reason
pull-ci-openshift-hypershift-main-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-5.1-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-5.0-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-4.23-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-4.22-address-review-comments openshift/hypershift presubmit Registry content changed
periodic-ci-openshift-hypershift-main-periodic-review-agent N/A periodic Registry content changed
Interacting with pj-rehearse

Comment: /pj-rehearse to run up to 5 rehearsals
Comment: /pj-rehearse skip to opt-out of rehearsals
Comment: /pj-rehearse {test-name}, with each test separated by a space, to run one or more specific rehearsals
Comment: /pj-rehearse more to run up to 10 rehearsals
Comment: /pj-rehearse max to run up to 25 rehearsals
Comment: /pj-rehearse auto-ack to run up to 5 rehearsals, and add the rehearsals-ack label on success
Comment: /pj-rehearse list to get an up-to-date list of affected jobs
Comment: /pj-rehearse abort to abort all active rehearsals
Comment: /pj-rehearse network-access-allowed to allow rehearsals of tests that have the restrict_network_access field set to false. This must be executed by an openshift org member who is not the PR author

Once you are satisfied with the results of the rehearsals, comment: /pj-rehearse ack to unblock merge. When the rehearsals-ack label is present on your PR, merge will no longer be blocked by rehearsals.
If you would like the rehearsals-ack label removed, comment: /pj-rehearse reject to re-block merging.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh (1)

91-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Explain why tracing is disabled.

At Line 91, add a comment before set +x stating that tracing is disabled before reading and using GITHUB_TOKEN_PAT. The scope correctly remains disabled through the authenticated request at Line 102.

Proposed comment
   [[ $- == *x* ]] && _was_tracing=true || _was_tracing=false
+  # Disable tracing before reading and using the PAT.
   set +x

As per coding guidelines, step-registry command scripts must keep the tracing-disabled scope minimal and add clear comments when disabling tracing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh`
at line 91, Add a concise comment immediately before `set +x` explaining that
tracing is disabled before reading and using `GITHUB_TOKEN_PAT`; keep tracing
disabled through the authenticated request and do not change the existing scope.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh`:
- Line 91: Add a concise comment immediately before `set +x` explaining that
tracing is disabled before reading and using `GITHUB_TOKEN_PAT`; keep tracing
disabled through the authenticated request and do not change the existing scope.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 19323fcf-3f07-4c96-9633-305cd4e6760a

📥 Commits

Reviewing files that changed from the base of the PR and between e870b89 and 48a1fd5.

📒 Files selected for processing (2)
  • ci-operator/step-registry/hypershift/review-agent/hypershift-review-agent-workflow.yaml
  • ci-operator/step-registry/hypershift/review-agent/trigger/hypershift-review-agent-trigger-commands.sh
💤 Files with no reviewable changes (1)
  • ci-operator/step-registry/hypershift/review-agent/hypershift-review-agent-workflow.yaml

@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@bryan-cox

Copy link
Copy Markdown
Member Author

/pj-rehearse ack

Verification

Rehearsed the trigger step with PAT auth — it works end to end:

  1. Trigger step passed: rehearsal log — reads PAT from gh-pat, triggers periodic via Gangway, posts comment on PR
  2. Comment posted via PAT: PR #9102 comment — posted by jira-solve-bot (PAT user) instead of hypershift-jira-solve-ci[bot] (old App auth)
  3. Previous failure for comparison: old trigger log — failed with exit code 6 because GitHub App token exchange returned empty

Dropping the hardcoded test PR now.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@openshift-merge-bot openshift-merge-bot Bot added the rehearsals-ack Signifies that rehearsal jobs have been acknowledged label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. rehearsals-ack Signifies that rehearsal jobs have been acknowledged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant