Skip to content

Make payload agent harness configurable - #82663

Open
not-stbenjam wants to merge 1 commit into
openshift:mainfrom
not-stbenjam:agent/payload-agent-harness
Open

Make payload agent harness configurable#82663
not-stbenjam wants to merge 1 commit into
openshift:mainfrom
not-stbenjam:agent/payload-agent-harness

Conversation

@not-stbenjam

@not-stbenjam not-stbenjam commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Add AGENT_HARNESS to the payload-agent step, defaulting to claude-code and accepting codex.
  • Add harness-specific model selection through the existing CLAUDE_MODEL and new CODEX_MODEL parameters.
  • Preserve Claude CLI arguments while translating or dropping Claude-only continuation and turn-limit flags for ephemeral Codex follow-up runs.
  • Parse Codex JSONL agent messages for Slack summaries and retain Codex OTEL JSONL in the established telemetry artifact.
  • Fail fast when Codex is selected without its binary or credentials.

Why

agentic-ci #292 adds the Codex harness, and ai-helpers #657 adds the Codex binary and installs ai-helpers as agent skills in the payload-agent image. This change lets payload-agent jobs select that harness while keeping the current Claude behavior as the default.

Codex credentials are intentionally not mounted here. A job selecting codex must provide CODEX_API_KEY, CODEX_ACCESS_TOKEN, OPENAI_API_KEY, or an existing $CODEX_HOME/auth.json through its execution environment.

Validation

  • bash -n on the payload-agent command
  • shellcheck -S warning on the payload-agent command
  • make registry-metadata
  • make ci-operator-checkconfig
  • Stubbed wrapper tests verified the exact Claude and Codex command shapes
  • Real agentic-ci run --backend local --harness codex smoke test with OTEL enabled: Codex returned payload harness smoke test passed, exit code 0, one API request, and a populated token summary

make validate-step-registry currently fails before validation because the repository target passes the removed --prow-config flag to the latest validator image. The registry and configs successfully loaded through make ci-operator-checkconfig.

Summary by CodeRabbit

  • Adds configurable payload-agent harness selection via AGENT_HARNESS, defaulting to Claude Code and supporting Codex.
  • Introduces harness-specific models, credentials and prerequisite validation, while preserving Claude behavior.
  • Adapts Codex execution, follow-up arguments, JSONL Slack parsing and telemetry artifact handling.
  • Updates OpenShift CI step and workflow documentation to describe the configurable agentic harness.
  • Validation included syntax, lint, registry/configuration, stubbed command-shape and local Codex smoke tests; registry validation remains blocked by an outdated --prow-config flag.

@openshift-ci openshift-ci Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 30, 2026
@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Hi @not-stbenjam. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: not-stbenjam
Once this PR has been reviewed and has the lgtm label, please assign smg247 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The payload agent now supports Claude Code and Codex selection, validates harness-specific prerequisites, invokes the selected model through agentic-ci, adapts recovery and metrics handling, and includes harness/model context in Slack notifications and documentation.

Changes

Payload agent harness support

Layer / File(s) Summary
Harness selection and configuration
ci-operator/step-registry/openshift/claude/payload/agent/openshift-claude-payload-agent-commands.sh, ci-operator/step-registry/openshift/claude/payload/agent/openshift-claude-payload-agent-ref.yaml, ci-operator/step-registry/openshift/claude/payload/openshift-claude-payload-workflow.yaml
AGENT_HARNESS and model settings select Claude Code or Codex, Codex prerequisites are validated, and step descriptions and startup output use harness-neutral wording.
Harness-aware execution and recovery
ci-operator/step-registry/openshift/claude/payload/agent/openshift-claude-payload-agent-commands.sh
agentic-ci receives harness-specific arguments, Codex handles translated options, timeout and retry paths use the selected agent, Claude session metrics remain harness-gated, and JUnit output reflects the selected agent.
Harness-aware Slack reporting
ci-operator/step-registry/openshift/claude/payload/agent/openshift-claude-payload-agent-commands.sh
Slack messages include harness/model context, and summary JSON parsing distinguishes Codex output from other harness output.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: pskrbasu

Sequence Diagram(s)

sequenceDiagram
  participant PayloadAgent
  participant AgenticCI
  participant SelectedHarness
  participant Slack
  PayloadAgent->>AgenticCI: Run payload analysis with selected harness and model
  AgenticCI->>SelectedHarness: Execute analysis command
  SelectedHarness-->>PayloadAgent: Return analysis output and exit status
  PayloadAgent->>SelectedHarness: Request Slack-ready summary
  SelectedHarness-->>PayloadAgent: Return summary JSON
  PayloadAgent->>Slack: Send harness/model contextualized summary
Loading
🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 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 The PR only changes shell/YAML step-registry files; no Ginkgo It/Describe/Context titles were added or modified, and no dynamic test names were introduced.
Test Structure And Quality ✅ Passed No Ginkgo test code was added or modified; the PR only changes shell/YAML step-registry files, so the test-quality check is not applicable.
Microshift Test Compatibility ✅ Passed PR only changes shell/YAML step-registry files; no new Ginkgo tests or MicroShift-unsupported OpenShift APIs were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only changes shell/YAML registry files; no Ginkgo e2e tests or SNO-sensitive assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed PASS — The PR only changes ci-operator step-registry scripts/YAML for a payload-agent job, not deployment manifests, operators, or controllers.
Ote Binary Stdout Contract ✅ Passed Only step-registry shell/YAML files changed; no OTE binary or process-level Go code with stdout writes was added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR only changes shell/YAML step-registry config, so the IPv6/disconnected-network test check is not applicable.
No-Weak-Crypto ✅ Passed No weak-crypto primitives or custom crypto appear in the changed files; secret handling only checks presence/file existence, not secret values.
Container-Privileges ✅ Passed Diff only adds harness env vars/docs and shell logic; no privileged, host* or allowPrivilegeEscalation settings appear in changed manifests.
No-Sensitive-Data-In-Logs ✅ Passed New logs only print harness/model/status; secret reads stay under set +x and errors mention env-var names/paths, not secret values.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: making the payload agent harness configurable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@not-stbenjam: 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-eng-ai-helpers-main-payload-agent openshift-eng/ai-helpers presubmit Registry content changed
periodic-ci-openshift-release-main-payload-agent-analyze N/A periodic Registry content changed

Prior to this PR being merged, you will need to either run and acknowledge or opt to skip these rehearsals.

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.

@not-stbenjam
not-stbenjam marked this pull request as ready for review July 30, 2026 11:17
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 30, 2026
@openshift-ci
openshift-ci Bot requested review from sosiouxme and stbenjam July 30, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant