Skip to content

jira-agent: refresh token before Phase 3 and increase max-turns across all phases#80447

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
enxebre:enxebre/jira-agent-token-refresh-and-turns
Jun 15, 2026
Merged

jira-agent: refresh token before Phase 3 and increase max-turns across all phases#80447
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
enxebre:enxebre/jira-agent-token-refresh-and-turns

Conversation

@enxebre

@enxebre enxebre commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Refresh the GitHub App fork token before Phase 3 (address review findings), which pushes code. Previously the only refresh happened between Phase 3 and Phase 4, so if Phases 1-2 exceeded the 1-hour token lifetime, Phase 3's push failed with Invalid username or token.
  • Increase --max-turns across all phases to give enough headroom for complex tickets and push retries:
    • Phase 1 (jira-solve): 100 → 300
    • Phase 2 (pre-commit quality review): 75 → 225
    • Phase 3 (address review findings): 75 → 225
    • Phase 4 (PR creation): 15 → 90

Root cause

Observed in periodic-jira-agent run 2065130139884195840:

  1. Token generated at job start (~17:18)
  2. Phases 1-2 ran for ~1h40m
  3. Phase 3 tried to push at 19:01 → fatal: Authentication failed (token expired)
  4. Token refreshed before Phase 4, but Phase 4 only had 15 turns and burned them on pre-push hook retries without creating the PR

Changes

Token refresh before Phase 3

Added a generate_github_token call and credential helper update immediately before Phase 3 starts. The existing refresh before Phase 4 is kept but with an updated comment clarifying it guards against Phase 3 duration.

Max-turns increase

Previous limits were too conservative for complex tickets. Phases would exhaust turns before completing work, especially when pre-push hooks required multiple retry cycles. The new limits (3x for phases 1-3, 6x for phase 4) provide sufficient headroom based on observed runs.

/cc @openshift/hypershift-team

🤖 Generated with Claude Code

Phase 3 (address review findings) pushes code to the fork, but its
GitHub App token was generated at job start and can expire after 1 hour.
When Phases 1-2 run long, Phase 3's push fails with "Invalid username
or token".

Add a fork token refresh before Phase 3 starts (matching the existing
refresh before Phase 4).

Also increase Phase 4 max-turns from 15 to 30. When the push encounters
pre-push hook failures, 15 turns is not enough to diagnose, fix, and
retry before creating the PR.

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

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@enxebre: GitHub didn't allow me to request PR reviews from the following users: openshift/hypershift-team.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

Summary

  • Refresh the GitHub App fork token before Phase 3 (address review findings), which pushes code. Previously the only refresh happened between Phase 3 and Phase 4, so if Phases 1-2 exceeded the 1-hour token lifetime, Phase 3's push failed with Invalid username or token.
  • Increase Phase 4 (PR creation) --max-turns from 15 to 30 to give enough headroom for push retries when pre-push hooks fail.

Root cause

Observed in periodic-jira-agent run 2065130139884195840:

  1. Token generated at job start (~17:18)
  2. Phases 1-2 ran for ~1h40m
  3. Phase 3 tried to push at 19:01 → fatal: Authentication failed (token expired)
  4. Token refreshed before Phase 4, but Phase 4 only had 15 turns and burned them on pre-push hook retries without creating the PR

/cc @openshift/hypershift-team

🤖 Generated with Claude Code

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.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR updates a bash orchestration script that manages GitHub App authentication and AI-assisted pull request creation for the HyperShift Jira agent. The script now refreshes the fork token before Phase 3 to avoid expiry during code-addressing work, clarifies token regeneration timing in Phase 4 documentation, and substantially increases Claude's conversational turns across all phases: Phase 1 to 300, Phase 2 to 225, Phase 3 to 225, and Phase 4 to 90.

Changes

HyperShift Jira Agent Token Refresh and Claude Configuration

Layer / File(s) Summary
GitHub App token refresh and Phase 4 documentation
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh
A token refresh block is inserted before Phase 3 to regenerate the fork installation token and update git's credential helper for subsequent pushes, with error handling when regeneration fails. Phase 4 comments and logging are updated to explicitly document why the Phase 3 refresh is needed and when Phase 4 regeneration occurs.
Claude max-turns configuration across all phases
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh
The --max-turns parameter for Claude invocations is increased in all four phases to allow more dialogue turns: Phase 1 from 100 to 300, Phase 2 from 75 to 225, Phase 3 from 75 to 225, and Phase 4 from 15 to 90.

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

rehearsals-ack


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error New Phase 3 token refresh code (line 547) executes git config --global credential.helper "...password=${GITHUB_TOKEN_FORK}..." without set +x protection, risking token exposure in bash trace lo... Wrap the credential helper configurations (lines 138, 547, 624) with set +x / set -x guards, following the pattern used for Slack webhook URL at lines 166-178.
✅ Passed checks (14 passed)
Check name Status Explanation
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 PR modifies only shell scripts (hypershift-jira-agent-process-commands.sh) with no Ginkgo test files present; check for stable test names is not applicable.
Test Structure And Quality ✅ Passed Check is not applicable—PR modifies only bash CI/CD scripts, not Ginkgo test code. Custom check specifically requires reviewing Ginkgo test structure, setup/cleanup, timeouts, and assertions, which...
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The changes consist only of bash script modifications to the jira-agent CI workflow automation, which is outside the scope of the MicroShift test compatibi...
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR does not add any Ginkgo e2e tests. It only modifies a bash script for the HyperShift jira-agent CI workflow, increasing Claude turn limits and adding token refresh logic. The SNO compatibil...
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies a bash CI/CD orchestration script with no Kubernetes resources, deployment manifests, operator code, or scheduling constraints. Topology-aware scheduling check is not applicable.
Ote Binary Stdout Contract ✅ Passed OTE Binary Stdout Contract check is not applicable to this PR. The PR modifies a bash CI script (hypershift-jira-agent-process-commands.sh), not a Go test binary or OTE extension. The check only ap...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR modifies a bash CI workflow script, not Ginkgo e2e tests. The custom check for IPv6/disconnected network compatibility only applies to new Ginkgo tests, which this PR does not add.
No-Weak-Crypto ✅ Passed Script uses SHA-256 RSA signing (strong crypto) and no weak algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB). Token comparisons check for error values ("null"), not security-critical authentic...
Container-Privileges ✅ Passed PR only modifies a bash shell script file (hypershift-jira-agent-process-commands.sh) with no container or K8s manifests; container-privileges check is not applicable.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes both main changes: token refresh before Phase 3 and increased max-turns across all phases, directly matching the commit content.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 11, 2026
@enxebre

enxebre commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh (1)

743-797: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Only mark the Jira issue processed after PR creation actually succeeds.

From Line 743 onward, the script adds agent-processed, transitions the issue, increments PROCESSED_COUNT, and records SUCCESS even when Lines 703-705 left PR_URL empty because Phase 4 failed. Since the search JQL excludes agent-processed, those failures will not be retried on the next run and the issue can get stuck without a PR. Gate the Jira mutations and success accounting on PR_URL being present, with a separate success path for the intentional “no code changes” case.

🤖 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/jira-agent/process/hypershift-jira-agent-process-commands.sh`
around lines 743 - 797, The script currently always adds the 'agent-processed'
label, transitions the issue, sets assignee, increments PROCESSED_COUNT and
writes "SUCCESS" to STATE_FILE even when PR creation failed (PR_URL is empty);
wrap the entire Jira mutation + success accounting block (the code using
LABEL_RESPONSE / transition_issue / set_assignee, PROCESSED_COUNT increment and
the echo to STATE_FILE) in a guard if [ -n "$PR_URL" ]; then ... fi so those
actions only run when PR_URL is present; add an explicit else branch that
handles the intentional "no code changes" case by writing a distinct state (e.g.
"NO_CHANGES") to STATE_FILE or skipping Jira mutations but still incrementing
PROCESSED_COUNT if appropriate, and ensure you reference the existing symbols
LABEL_RESPONSE, transition_issue, set_assignee, PROCESSED_COUNT, PR_URL and
STATE_FILE when making the change.
🤖 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/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 540-549: The refresh block for the GitHub App token using
generate_github_token (GITHUB_TOKEN_FORK) only logs failures and continues,
which allows Phase 3/4 to run with expired credentials; update the logic in the
token refresh sections (the GITHUB_TOKEN_FORK and GITHUB_TOKEN_UPSTREAM refresh
blocks around generate_github_token) to either retry token generation a few
times with backoff or immediately fail the script when refresh returns
empty/"null" before entering the push/PR phases—i.e., on failure do a bounded
retry of generate_github_token and if still unsuccessful call exit 1 (or
otherwise abort the run) instead of merely echoing an error so Phase 3/4 never
proceed with stale credentials.

---

Outside diff comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 743-797: The script currently always adds the 'agent-processed'
label, transitions the issue, sets assignee, increments PROCESSED_COUNT and
writes "SUCCESS" to STATE_FILE even when PR creation failed (PR_URL is empty);
wrap the entire Jira mutation + success accounting block (the code using
LABEL_RESPONSE / transition_issue / set_assignee, PROCESSED_COUNT increment and
the echo to STATE_FILE) in a guard if [ -n "$PR_URL" ]; then ... fi so those
actions only run when PR_URL is present; add an explicit else branch that
handles the intentional "no code changes" case by writing a distinct state (e.g.
"NO_CHANGES") to STATE_FILE or skipping Jira mutations but still incrementing
PROCESSED_COUNT if appropriate, and ensure you reference the existing symbols
LABEL_RESPONSE, transition_issue, set_assignee, PROCESSED_COUNT, PR_URL and
STATE_FILE when making the change.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 28595b10-a32b-49b6-ad45-cb1c24d7657f

📥 Commits

Reviewing files that changed from the base of the PR and between fbbd18c and 0aadefb.

📒 Files selected for processing (1)
  • ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh

Comment on lines +540 to +549
# Refresh tokens before Phase 3 since it pushes code.
# Phases 1-2 can exceed the 1-hour GitHub App token lifetime.
echo "Refreshing GitHub App tokens before Phase 3..."
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

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't continue into Phase 3/4 with a failed token refresh.

Lines 544-549 and Lines 621-633 only log refresh failures, then fall through into the push/PR phases with the previous credentials still configured. In the same long-running case this change is addressing, that leaves Phase 3 pushing with an expired fork token and Phase 4 calling gh with an expired upstream token. Retry the refresh or fail the current issue before entering the dependent phase.

Also applies to: 616-633

🤖 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/jira-agent/process/hypershift-jira-agent-process-commands.sh`
around lines 540 - 549, The refresh block for the GitHub App token using
generate_github_token (GITHUB_TOKEN_FORK) only logs failures and continues,
which allows Phase 3/4 to run with expired credentials; update the logic in the
token refresh sections (the GITHUB_TOKEN_FORK and GITHUB_TOKEN_UPSTREAM refresh
blocks around generate_github_token) to either retry token generation a few
times with backoff or immediately fail the script when refresh returns
empty/"null" before entering the push/PR phases—i.e., on failure do a bounded
retry of generate_github_token and if still unsuccessful call exit 1 (or
otherwise abort the run) instead of merely echoing an error so Phase 3/4 never
proceed with stale credentials.

@enxebre

enxebre commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@enxebre

enxebre commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@enxebre

enxebre commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@enxebre

enxebre commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

Phase 1 (solve): 100 → 300
Phase 2 (review): 75 → 225
Phase 3 (address review): 75 → 225
Phase 4 (PR creation): 30 → 90

Both rehearsal runs of CNTRLPLANE-3612 hit the 100-turn limit — once
while pushing after a successful implementation, once while debugging
test failures. The agent completed the implementation in both cases but
ran out of turns during the verification/push tail. Tripling gives
enough headroom for complex feature tickets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@enxebre

enxebre commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse periodic-ci-openshift-hypershift-main-periodic-jira-agent

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@enxebre: 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
periodic-ci-openshift-hypershift-main-periodic-jira-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.

♻️ Duplicate comments (1)
ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh (1)

540-549: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Token refresh failure allows Phase 3 to proceed with expired credentials.

This is the same issue flagged in the previous review. If generate_github_token returns empty or "null" at line 544, the script logs an error but continues into Phase 3 without updating the credential helper. Phase 3's push operations (line 568+) will then fail with the expired fork token—exactly the scenario this refresh was meant to prevent.

The same pattern exists at lines 616-633 before Phase 4.

Also applies to: 616-633

🤖 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/jira-agent/process/hypershift-jira-agent-process-commands.sh`
around lines 540 - 549, When token generation fails for either the fork refresh
(GITHUB_TOKEN_FORK) or the subsequent Phase 4 token refresh, the script logs an
error message but continues execution without halting. This allows Phase 3 and
Phase 4 to proceed with expired or missing credentials, causing push operations
to fail. Fix this by adding an exit statement with a non-zero status code (such
as exit 1 or return 1) in the error branch of both token refresh
blocks—specifically after the error is logged for the failed token generation.
This will halt the script immediately when token refresh fails, preventing Phase
3's push operations and Phase 4's operations from attempting to run with invalid
credentials.
🤖 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.

Duplicate comments:
In
`@ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh`:
- Around line 540-549: When token generation fails for either the fork refresh
(GITHUB_TOKEN_FORK) or the subsequent Phase 4 token refresh, the script logs an
error message but continues execution without halting. This allows Phase 3 and
Phase 4 to proceed with expired or missing credentials, causing push operations
to fail. Fix this by adding an exit statement with a non-zero status code (such
as exit 1 or return 1) in the error branch of both token refresh
blocks—specifically after the error is logged for the failed token generation.
This will halt the script immediately when token refresh fails, preventing Phase
3's push operations and Phase 4's operations from attempting to run with invalid
credentials.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 7273110e-67e7-480f-b3fc-32ce8fc7d1dc

📥 Commits

Reviewing files that changed from the base of the PR and between 0aadefb and e365233.

📒 Files selected for processing (1)
  • ci-operator/step-registry/hypershift/jira-agent/process/hypershift-jira-agent-process-commands.sh

@openshift-ci

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@enxebre: 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.

@enxebre

enxebre commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

/pj-rehearse ack

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@enxebre: 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 Jun 15, 2026
@enxebre enxebre changed the title jira-agent: refresh token before Phase 3 and increase Phase 4 max-turns jira-agent: refresh token before Phase 3 and increase max-turns across all phases Jun 15, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2026
@openshift-ci

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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-merge-bot openshift-merge-bot Bot merged commit acdd633 into openshift:main Jun 15, 2026
11 checks passed
kasturinarra pushed a commit to kasturinarra/release that referenced this pull request Jun 15, 2026
…s all phases (openshift#80447)

* jira-agent: refresh token before Phase 3 and increase Phase 4 max-turns

Phase 3 (address review findings) pushes code to the fork, but its
GitHub App token was generated at job start and can expire after 1 hour.
When Phases 1-2 run long, Phase 3's push fails with "Invalid username
or token".

Add a fork token refresh before Phase 3 starts (matching the existing
refresh before Phase 4).

Also increase Phase 4 max-turns from 15 to 30. When the push encounters
pre-push hook failures, 15 turns is not enough to diagnose, fix, and
retry before creating the PR.

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

* ci: increase max-turns 3x for all jira-agent phases

Phase 1 (solve): 100 → 300
Phase 2 (review): 75 → 225
Phase 3 (address review): 75 → 225
Phase 4 (PR creation): 30 → 90

Both rehearsal runs of CNTRLPLANE-3612 hit the 100-turn limit — once
while pushing after a successful implementation, once while debugging
test failures. The agent completed the implementation in both cases but
ran out of turns during the verification/push tail. Tripling gives
enough headroom for complex feature tickets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
kasturinarra pushed a commit to kasturinarra/release that referenced this pull request Jun 19, 2026
…s all phases (openshift#80447)

* jira-agent: refresh token before Phase 3 and increase Phase 4 max-turns

Phase 3 (address review findings) pushes code to the fork, but its
GitHub App token was generated at job start and can expire after 1 hour.
When Phases 1-2 run long, Phase 3's push fails with "Invalid username
or token".

Add a fork token refresh before Phase 3 starts (matching the existing
refresh before Phase 4).

Also increase Phase 4 max-turns from 15 to 30. When the push encounters
pre-push hook failures, 15 turns is not enough to diagnose, fix, and
retry before creating the PR.

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

* ci: increase max-turns 3x for all jira-agent phases

Phase 1 (solve): 100 → 300
Phase 2 (review): 75 → 225
Phase 3 (address review): 75 → 225
Phase 4 (PR creation): 30 → 90

Both rehearsal runs of CNTRLPLANE-3612 hit the 100-turn limit — once
while pushing after a successful implementation, once while debugging
test failures. The agent completed the implementation in both cases but
ran out of turns during the verification/push tail. Tripling gives
enough headroom for complex feature tickets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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. lgtm Indicates that a PR is ready to be merged. rehearsals-ack Signifies that rehearsal jobs have been acknowledged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants