jira-agent: add commit restructure phase#77733
jira-agent: add commit restructure phase#77733bryan-cox wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughWorkflow expanded from four to six sequential phases by adding a CodeRabbit CLI-based review phase and a commit-restructure phase before PR creation; included install/auth for CodeRabbit via a mounted API key, updated phase numbering, and extended artifact/token capture and reporting for the new phases. Changes
Sequence Diagram(s)sequenceDiagram
participant Agent as Jira Agent
participant Claude as Claude Code CLI
participant CR as CodeRabbit CLI
participant Repo as Git Repository
participant GH as GitHub
rect rgba(100,200,255,0.5)
Note over Agent,Claude: Phase 1-3: Solve, pre-commit Review, Fix
Agent->>Claude: Run solve & initial review
Claude-->>Agent: Return fixes/artifacts
Agent->>Repo: Apply fixes to branch
end
rect rgba(150,200,100,0.5)
Note over Agent,CR: Phase 4: CodeRabbit Review
Agent->>CR: Install (if needed) & authenticate with API key
CR-->>Agent: Auth result (or skip)
Agent->>CR: Run CodeRabbit review (capture text/tool/errors/tokens)
CR-->>Agent: Return review findings
Agent->>Repo: Apply CodeRabbit fixes (if any)
end
rect rgba(200,150,100,0.5)
Note over Agent,Claude: Phase 5: Restructure Commits
Agent->>Claude: Run restructure-commits command (from .claude/commands)
Claude-->>Agent: Return restructure commands & tokens
Agent->>Repo: Force-push restructured commits
end
rect rgba(100,150,200,0.5)
Note over Agent,GH: Phase 6: Create PR
Agent->>GH: Refresh tokens & create PR
GH-->>Agent: Return PR URL or error
Agent->>Agent: Record artifacts and report
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 9 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (9 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh (1)
38-44: Thecurl | shpattern is CodeRabbit's official installation method and acceptable here, but consider Homebrew for macOS systems if available.CodeRabbit's official documentation explicitly recommends the
curl | shapproach and does not provide checksum verification, PGP signatures, or SHA hashes for the install script. The code already includes appropriate error handling—the installation is non-fatal and the pipeline gracefully continues if it fails. For macOS systems, Homebrew (brew install coderabbit) is available as a cleaner alternative if the CI environment supports it, though this would require platform-specific logic. The current implementation follows official guidance and is suitable for the general CI use case.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh` around lines 38 - 44, The installer block currently pipes the remote installer via curl into sh; update that block to prefer Homebrew on macOS when available by detecting the platform (e.g., uname -s or OSTYPE) and testing for the brew command, then run "brew install coderabbit" if brew exists; otherwise fall back to the existing curl | sh path. Preserve the non-fatal behavior and the existing logging ("Installing CodeRabbit CLI...", success message, and the "Warning: CodeRabbit CLI installation failed, Phase 4 will be skipped" message) so Phase 4 remains optional.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 38-44: The installer block currently pipes the remote installer
via curl into sh; update that block to prefer Homebrew on macOS when available
by detecting the platform (e.g., uname -s or OSTYPE) and testing for the brew
command, then run "brew install coderabbit" if brew exists; otherwise fall back
to the existing curl | sh path. Preserve the non-fatal behavior and the existing
logging ("Installing CodeRabbit CLI...", success message, and the "Warning:
CodeRabbit CLI installation failed, Phase 4 will be skipped" message) so Phase 4
remains optional.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b876c101-e9bc-4539-83c6-8cc1793ac550
📒 Files selected for processing (4)
ci-operator/step-registry/hypershift/jira-agent/README.mdci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.shci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-ref.yamlci-operator/step-registry/hypershift/jira-agent/report/hypershift-jira-agent-report-commands.sh
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh (1)
476-495: Extract a single GitHub token-refresh helper.Lines 481-495 and 646-659 duplicate the same stateful refresh/configuration flow. Pulling this into one function will keep the two paths from drifting and gives you one place to define what should happen before push/PR phases when a refresh fails.
♻️ Suggested shape
+refresh_github_tokens() { + local fork upstream + fork=$(generate_github_token "$INSTALLATION_ID_FORK") + upstream=$(generate_github_token "$INSTALLATION_ID_UPSTREAM") + + [[ -n "$fork" && "$fork" != "null" ]] || return 1 + [[ -n "$upstream" && "$upstream" != "null" ]] || return 1 + + git config --global credential.helper "!f() { echo username=x-access-token; echo password=${fork}; }; f" + export GITHUB_TOKEN="$upstream" +} + ... - GITHUB_TOKEN_FORK=$(generate_github_token "$INSTALLATION_ID_FORK") - if [ -z "$GITHUB_TOKEN_FORK" ] || [ "$GITHUB_TOKEN_FORK" = "null" ]; then - echo "ERROR: Failed to refresh GitHub App token for fork" - else - git config --global credential.helper "!f() { echo username=x-access-token; echo password=${GITHUB_TOKEN_FORK}; }; f" - echo "Fork token refreshed" - fi - - GITHUB_TOKEN_UPSTREAM=$(generate_github_token "$INSTALLATION_ID_UPSTREAM") - if [ -z "$GITHUB_TOKEN_UPSTREAM" ] || [ "$GITHUB_TOKEN_UPSTREAM" = "null" ]; then - echo "ERROR: Failed to refresh GitHub App token for upstream" - else - export GITHUB_TOKEN="$GITHUB_TOKEN_UPSTREAM" - echo "Upstream token refreshed" - fi + if refresh_github_tokens; then + echo "GitHub App tokens refreshed" + else + echo "ERROR: Failed to refresh GitHub App tokens" + fiAlso applies to: 643-660
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh` around lines 476 - 495, Extract the duplicated token refresh/config flow into a single helper function, e.g., refresh_github_token(installation_id, purpose), that calls generate_github_token with the passed installation_id, checks for empty/"null", logs an error on failure, and on success either configures git credential.helper for fork tokens (set via git config --global credential.helper "!f() { echo username=x-access-token; echo password=${TOKEN}; }; f") or exports GITHUB_TOKEN for upstream tokens; replace the two inline blocks that set GITHUB_TOKEN_FORK/GITHUB_TOKEN_UPSTREAM and their git config/export logic with calls to this helper (use the existing symbols generate_github_token, GITHUB_TOKEN_FORK, GITHUB_TOKEN_UPSTREAM, and GITHUB_TOKEN to locate and update the code).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 159-169: The script currently attempts "coderabbit auth login" but
doesn't record its success, so later guards only re-check
CODERABBIT_API_KEY_FILE and the coderabbit binary and still run Phase 4 even if
auth failed; update the auth block to capture the login result into a boolean
flag (e.g., CODERABBIT_AUTHENTICATED=true/false or SKIP_CODERABBIT) when running
coderabbit auth login (use the exit status), and then change the Phase 4
guard/loop (the later check around the CodeRabbit loop) to require
CODERABBIT_AUTHENTICATED to be true in addition to the existing file/command
checks so Phase 4 is skipped when login fails; apply the same flag check to the
other occurrence referenced (the guard around the Phase 4 loop).
- Around line 38-44: Replace the current direct network install (the curl -fsSL
https://cli.coderabbit.ai/install.sh | sh invocation in the CodeRabbit CLI
install block) with a defensible, reproducible approach: contact CodeRabbit for
CI/CD/enterprise install artifacts or checksums, add an internal mirror of the
installer and update the script to download the pinned mirror copy (or a pinned
checksum-verified tarball) instead of piping from upstream, and document the
chosen mitigation in the script's comment so Phase 4 installation is
reproducible and supply-chain risk is reduced.
---
Nitpick comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 476-495: Extract the duplicated token refresh/config flow into a
single helper function, e.g., refresh_github_token(installation_id, purpose),
that calls generate_github_token with the passed installation_id, checks for
empty/"null", logs an error on failure, and on success either configures git
credential.helper for fork tokens (set via git config --global credential.helper
"!f() { echo username=x-access-token; echo password=${TOKEN}; }; f") or exports
GITHUB_TOKEN for upstream tokens; replace the two inline blocks that set
GITHUB_TOKEN_FORK/GITHUB_TOKEN_UPSTREAM and their git config/export logic with
calls to this helper (use the existing symbols generate_github_token,
GITHUB_TOKEN_FORK, GITHUB_TOKEN_UPSTREAM, and GITHUB_TOKEN to locate and update
the code).
🪄 Autofix (Beta)
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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6508af46-0c4f-467f-b0a2-bb1a5fda5b16
📒 Files selected for processing (2)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.shci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-ref.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
- ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-ref.yaml
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh (1)
159-169:⚠️ Potential issue | 🟠 MajorGate Phase 4 on successful CodeRabbit login.
A failed
coderabbit auth loginis only logged here. Line 505 still enters Phase 4 whenever the key file and binary exist, so a bad key or transient login failure burns Claude turns on a phase that cannot succeed.Suggested fix
+# Track whether CodeRabbit is actually ready for Phase 4. +CODERABBIT_READY=false CODERABBIT_API_KEY_FILE="/var/run/coderabbit/coderabbit-api" if [ -f "$CODERABBIT_API_KEY_FILE" ] && command -v coderabbit &>/dev/null; then if coderabbit auth login --api-key "$(cat "$CODERABBIT_API_KEY_FILE")"; then + CODERABBIT_READY=true echo "CodeRabbit CLI authenticated" else echo "Warning: CodeRabbit CLI authentication failed, Phase 4 will be skipped" fi +elif ! command -v coderabbit &>/dev/null; then + echo "Warning: CodeRabbit CLI not installed, Phase 4 will be skipped" else echo "Warning: CodeRabbit API key not found at $CODERABBIT_API_KEY_FILE" fi- if [ -f "$CODERABBIT_API_KEY_FILE" ] && command -v coderabbit &>/dev/null; then + if [ "${CODERABBIT_READY:-false}" = true ]; thenAlso applies to: 505-563
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh` around lines 159 - 169, The script currently only logs a failed CodeRabbit login but later (lines ~505-563) still proceeds into Phase 4 if the API key file and coderabbit binary exist; change this to gate Phase 4 on actual successful authentication by introducing a boolean flag (e.g., CODE_RABBIT_AUTHENTICATED) that is set to true only when coderabbit auth login succeeds, reference CODERABBIT_API_KEY_FILE and the coderabbit auth login invocation to locate the logic, and update the Phase 4 entry condition to check CODE_RABBIT_AUTHENTICATED instead of just testing file/binary existence so transient or bad-key failures will skip Phase 4.
🧹 Nitpick comments (1)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh (1)
518-526: Don't ask forTaskin phases whereTaskis disabled.
${SUBAGENT_PROMPT}explicitly tells Claude to launch parallelTasktool calls, but these new Phase 4/5 invocations only allowBash Read Write Edit Grep Glob. Either addTaskto--allowedToolsor drop the subagent instruction here.Also applies to: 589-598
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh` around lines 518 - 526, The claude subagent invocation includes ${SUBAGENT_PROMPT} which instructs launching parallel Task tool calls but the claude command's --allowedTools list ("Bash Read Write Edit Grep Glob") does not include "Task", causing a mismatch; fix by either adding "Task" to the --allowedTools argument of the claude call(s) that use ${SUBAGENT_PROMPT} (search for the claude invocation lines with CODERABBIT_PROMPT and SUBAGENT_PROMPT) or remove/modify ${SUBAGENT_PROMPT} so it no longer requests Task tool usage; apply the same fix to the other matching claude invocation later in the file that mirrors this block.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 721-730: The PR creation branch currently leaves PR_URL empty for
both missing URL and non-zero PR_EXIT_CODE, so failures are still treated as
success downstream; update the Phase 6 block (where PR_EXIT_CODE and PR_URL are
handled) to set an issue-level failure flag (e.g., ISSUE_FAILED=1) when PR_URL
is empty or PR_EXIT_CODE != 0 and ensure subsequent post-processing checks skip
adding the agent-processed tag and skip recording SUCCESS if ISSUE_FAILED is
set; modify the code paths that add "agent-processed" and write the SUCCESS
status (references: PR_EXIT_CODE, PR_URL, ISSUE_KEY, and the existing
agent-processed/SUCCESS bookkeeping) to consult this new flag so missing/failed
PR creation triggers retries and avoids marking the issue done.
---
Duplicate comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 159-169: The script currently only logs a failed CodeRabbit login
but later (lines ~505-563) still proceeds into Phase 4 if the API key file and
coderabbit binary exist; change this to gate Phase 4 on actual successful
authentication by introducing a boolean flag (e.g., CODE_RABBIT_AUTHENTICATED)
that is set to true only when coderabbit auth login succeeds, reference
CODERABBIT_API_KEY_FILE and the coderabbit auth login invocation to locate the
logic, and update the Phase 4 entry condition to check CODE_RABBIT_AUTHENTICATED
instead of just testing file/binary existence so transient or bad-key failures
will skip Phase 4.
---
Nitpick comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 518-526: The claude subagent invocation includes
${SUBAGENT_PROMPT} which instructs launching parallel Task tool calls but the
claude command's --allowedTools list ("Bash Read Write Edit Grep Glob") does not
include "Task", causing a mismatch; fix by either adding "Task" to the
--allowedTools argument of the claude call(s) that use ${SUBAGENT_PROMPT}
(search for the claude invocation lines with CODERABBIT_PROMPT and
SUBAGENT_PROMPT) or remove/modify ${SUBAGENT_PROMPT} so it no longer requests
Task tool usage; apply the same fix to the other matching claude invocation
later in the file that mirrors this block.
🪄 Autofix (Beta)
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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6487729f-d201-4ee3-b2b2-b04d8f910879
📒 Files selected for processing (2)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.shci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-ref.yaml
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
| 8. If new issues are found, fix them and repeat until CodeRabbit reports no issues. | ||
|
|
||
| IMPORTANT: | ||
| - Fix every issue identified by CodeRabbit — do not skip any. |
There was a problem hiding this comment.
I don't think it should blindly do that. CodeRTabbgit can still ask for unreasonable stuff, the agent should push back on those if needed.
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
05f9ad3 to
d051fac
Compare
d051fac to
16cb4f5
Compare
16cb4f5 to
3003bf3
Compare
Add Phase 4 (Restructure Commits) which reorganizes branch commits into component-based groups (API, Vendor, CLI, HO, CPO, E2E, Docs) using the hypershift restructure-commits command. Renumber PR creation to Phase 5 with a GitHub App token refresh before it. The new phase has full token tracking and appears in the HTML cost report with duration, tokens, cost, text output, tool calls, and errors. Also treat PR creation failure as an issue failure so the issue is retried on the next run instead of being marked as successfully processed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3003bf3 to
03eb093
Compare
|
[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 DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
[REHEARSALNOTIFIER]
Interacting with pj-rehearseComment: Once you are satisfied with the results of the rehearsals, comment: |
|
/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent |
|
@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel. |
|
/close in favor of openshift/hypershift#8373 |
|
@bryan-cox: Closed this PR. DetailsIn response to this:
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. |
Summary
restructure-commitscommandTest plan
make registry-metadatapasses🤖 Generated with Claude Code