Skip to content

OCPBUGS-84873: Fix to agent integration test finding agent-tui files#10530

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
bfournie:fix-agent-integration-missing-tui
May 3, 2026
Merged

OCPBUGS-84873: Fix to agent integration test finding agent-tui files#10530
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
bfournie:fix-agent-integration-missing-tui

Conversation

@bfournie
Copy link
Copy Markdown
Contributor

@bfournie bfournie commented May 1, 2026

Fixed two scanner bugs in checkFileFromInitrdImg:

  • Use actual bytes read instead of buffer size
  • Seek past gzip header after each archive to prevent gzip.Reader buffering from skipping nearby archives

This caused the agent integration test to fail when the appended agent-tui cpio archive landed close to the previous archive.

Summary by CodeRabbit

  • Bug Fixes
    • More reliable detection of compressed/archived content by using the actual number of bytes read for scanning and offset calculations.
    • Avoids inadvertently skipping nearby archives by adjusting seek offsets when entries don’t match.
    • Improved handling of read/seek errors and EOF so scans terminate or return errors correctly instead of continuing silently.
    • Standardized the “not found” error used across related helpers.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@bfournie: This pull request references Jira Issue OCPBUGS-84873, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.23.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Fixed two scanner bugs in checkFileFromInitrdImg:

  • Use actual bytes read instead of buffer size
  • Seek past gzip header after each archive to prevent gzip.Reader buffering from skipping nearby archives

This caused the agent integration test to fail when the appended agent-tui cpio archive landed close to the previous archive.

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0a306847-f2dd-406c-927a-c3d059128223

📥 Commits

Reviewing files that changed from the base of the PR and between 63468a3 and 289800d.

📒 Files selected for processing (1)
  • internal/tshelpers/custom_commands.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/tshelpers/custom_commands.go

Walkthrough

checkFileFromInitrdImg now uses the actual bytes read (n) for gzip-header bounds and seek math, returns on non-EOF read and on seek errors, treats EOF via errors.Is(err, io.EOF), advances scan by 3 bytes on gzip/cpio failures, and replaces final “not found” errors with the aliased goerrors.NotFound (applied across related helpers).

Changes

Cohort / File(s) Summary
Byte-aware gzip scanning, error handling & NotFound alias
internal/tshelpers/custom_commands.go
checkFileFromInitrdImg now uses the actual read count (n) for gzip-magic bounds (n-2) and seek-delta (foundAt-n), returns on non-EOF read errors and on seek errors, treats EOF with errors.Is(err, io.EOF), advances scanning by 3 bytes (newPos+3) when gzip candidates fail or contain no matching cpio entry, and replaces final “not found” results with the aliased goerrors.NotFound (alias swap applied across related helper logic).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references a bug (OCPBUGS-84873) and describes the specific fix: addressing a failure in agent integration tests when finding agent-tui files.
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 modifies internal/tshelpers/custom_commands.go, a helper file with no Ginkgo test definitions, so test name stability check is not applicable.
Test Structure And Quality ✅ Passed The PR modifies a helper utility package providing custom test script commands, not a Ginkgo test file. The custom check targets test code quality patterns (It blocks, BeforeEach/AfterEach, assertions, timeouts), which are not applicable to this utility code.
Microshift Test Compatibility ✅ Passed PR modifies helper functions in internal/tshelpers/custom_commands.go to fix cpio archive scanning bugs, not adding new Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR modifies only internal/tshelpers/custom_commands.go helper utility file with bug fixes to scanner logic. No new Ginkgo e2e tests are added, so the multi-node cluster assumptions check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds test infrastructure helper functions for binary file scanning; no topology-aware scheduling constraints, pod affinity rules, or deployment manifest changes detected.
Ote Binary Stdout Contract ✅ Passed Modified code contains testscript command handlers executed within individual test cases, not at process level, avoiding OTE binary JSON stdout corruption.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add Ginkgo e2e tests; it only modifies internal testscript helper utilities for bug fixes in archive scanning logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

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

@bfournie
Copy link
Copy Markdown
Contributor Author

bfournie commented May 1, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@bfournie: This pull request references Jira Issue OCPBUGS-84873, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@bfournie: This pull request references Jira Issue OCPBUGS-84873, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Fixed two scanner bugs in checkFileFromInitrdImg:

  • Use actual bytes read instead of buffer size
  • Seek past gzip header after each archive to prevent gzip.Reader buffering from skipping nearby archives

This caused the agent integration test to fail when the appended agent-tui cpio archive landed close to the previous archive.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
  • Improved scanning accuracy when detecting compressed content in initialization files by correctly tracking bytes read and adjusting search positioning.

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 openshift-eng/jira-lifecycle-plugin repository.

@bfournie
Copy link
Copy Markdown
Contributor Author

bfournie commented May 1, 2026

/test ?

@openshift-ci openshift-ci Bot requested review from rwsu and tthvo May 1, 2026 17:05
@bfournie
Copy link
Copy Markdown
Contributor Author

bfournie commented May 1, 2026

/test integration-tests

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/tshelpers/custom_commands.go`:
- Around line 602-610: The code currently masks Seek/I/O failures by breaking
out of loops (e.g., after initRdImg.Seek calls near the lookForCpioFiles flow)
which leads to misleading NotFound returns; change those break paths to return
the actual error (propagate the err) so seek/IO errors are diagnosable —
specifically, in the blocks where newPos, err := initRdImg.Seek(...) and the
subsequent seek inside the error branch after lookForCpioFiles(...) are handled,
replace the break statements with returns of err (or wrap/contextualize the
error) so the caller receives the real failure instead of continuing and
eventually returning NotFound; do the same for the other similar seek error path
later in the function.
- Around line 591-593: The loop that scans buff for the gzip magic (checking
buff[idx+0], buff[idx+1], buff[idx+2] using gzipID1, gzipID2, gzipDeflate) can
miss a magic sequence split across reads; modify the read loop to preserve a
2-byte overlap between iterations by copying the last two bytes of the previous
buffer to the start of buff before reading new data, adjust n to account for
those carried bytes, and then run the existing scan (for idx := 0; idx < n-2;
idx++) so boundary-spanning sequences like 0x1f 0x8b 0x08 are detected.
- Around line 585-588: The loop reading from initRdImg using
initRdImg.Read(buff) incorrectly breaks on io.EOF before processing a possible
final partial buffer and ignores non-EOF errors; change the loop around
initRdImg.Read(buff) (the call and its surrounding loop) to first handle the
bytes read (use n to process/write the valid data), then check err: if err ==
io.EOF break after processing, else if err != nil return the error. Ensure you
reference and update the read loop that uses initRdImg.Read(buff) so final
partial reads are handled and real errors are propagated.
🪄 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: Enterprise

Run ID: 58f0f640-e3ce-4a2e-91f7-109da43ae67a

📥 Commits

Reviewing files that changed from the base of the PR and between 73b340a and ce8308e.

📒 Files selected for processing (1)
  • internal/tshelpers/custom_commands.go

Comment thread internal/tshelpers/custom_commands.go
Comment thread internal/tshelpers/custom_commands.go
Comment thread internal/tshelpers/custom_commands.go Outdated
@bfournie
Copy link
Copy Markdown
Contributor Author

bfournie commented May 1, 2026

/cc @zaneb @andfasano

@openshift-ci openshift-ci Bot requested review from andfasano and zaneb May 1, 2026 17:07
@bfournie bfournie force-pushed the fix-agent-integration-missing-tui branch 2 times, most recently from 598af99 to 63468a3 Compare May 1, 2026 17:46
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/tshelpers/custom_commands.go`:
- Around line 586-587: The build breaks because the name errors is currently
bound to github.com/go-openapi/errors, but the code calls errors.Is() from the
standard library; change the import to bring in the stdlib errors under a
distinct alias (e.g. stderrors) and update the Is() calls (the checks around the
error handling in custom_commands.go that currently call errors.Is(err, io.EOF))
to use that alias (stderrors.Is). Make the same replacement for both occurrences
(the two checks that use errors.Is) so imports and calls are consistent.
🪄 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: Enterprise

Run ID: 320f92d7-4c70-41f8-b094-acf48470f580

📥 Commits

Reviewing files that changed from the base of the PR and between 598af99 and 63468a3.

📒 Files selected for processing (1)
  • internal/tshelpers/custom_commands.go

Comment thread internal/tshelpers/custom_commands.go
Fixed two scanner bugs in checkFileFromInitrdImg:
- Use actual bytes read instead of buffer size
- Seek past gzip header after each archive to prevent gzip.Reader
  buffering from skipping nearby archives

This caused the agent integration test to fail when the appended
agent-tui cpio archive landed close to the previous archive.
@bfournie bfournie force-pushed the fix-agent-integration-missing-tui branch from 63468a3 to 289800d Compare May 1, 2026 17:58
@bfournie
Copy link
Copy Markdown
Contributor Author

bfournie commented May 1, 2026

/test integration-tests

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 1, 2026

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

@zaneb
Copy link
Copy Markdown
Member

zaneb commented May 3, 2026

/lgtm
/approve
/validated by @bfournie

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 3, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zaneb

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 May 3, 2026
@zaneb
Copy link
Copy Markdown
Member

zaneb commented May 3, 2026

/verified by @bfournie

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@zaneb: This PR has been marked as verified by @bfournie.

Details

In response to this:

/verified by @bfournie

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot openshift-merge-bot Bot merged commit 1ac5c43 into openshift:main May 3, 2026
16 checks passed
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@bfournie: Jira Issue Verification Checks: Jira Issue OCPBUGS-84873
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-84873 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Fixed two scanner bugs in checkFileFromInitrdImg:

  • Use actual bytes read instead of buffer size
  • Seek past gzip header after each archive to prevent gzip.Reader buffering from skipping nearby archives

This caused the agent integration test to fail when the appended agent-tui cpio archive landed close to the previous archive.

Summary by CodeRabbit

  • Bug Fixes
  • More reliable detection of compressed/archived content by using the actual number of bytes read for scanning and offset calculations.
  • Avoids inadvertently skipping nearby archives by adjusting seek offsets when entries don’t match.
  • Improved handling of read/seek errors and EOF so scans terminate or return errors correctly instead of continuing silently.
  • Standardized the “not found” error used across related helpers.

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 openshift-eng/jira-lifecycle-plugin repository.

@bfournie bfournie deleted the fix-agent-integration-missing-tui branch May 4, 2026 11:41
@openshift-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in release 5.0.0-0.nightly-2026-05-04-090050

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. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants