Skip to content

Fix applicability check: avoid NFS negative lookup cache on clone path - #571

Merged
lbarcziova merged 2 commits into
packit:mainfrom
lbarcziova:fix-applicability-nfs-cache
Jun 8, 2026
Merged

Fix applicability check: avoid NFS negative lookup cache on clone path#571
lbarcziova merged 2 commits into
packit:mainfrom
lbarcziova:fix-applicability-nfs-cache

Conversation

@lbarcziova

Copy link
Copy Markdown
Member

clone_and_prep_sources() was checking local_clone.is_dir() before the remote clone_repository MCP call. On the shared NFS PVC (netapp-nfs, ReadWriteMany), this stat() created a negative lookup cache entry for the clone subdirectory. When MCP gateway subsequently created the directory on the server, the triage agent's NFS client still had the stale ENOENT cached, causing FileNotFoundError on the rhpkg/centpkg prep subprocess — misreported as "not installed" even though both binaries are present in the container.

This broke every single applicability check: prep always "failed", the fallback extraction also hit the stale cache (spec file not found), and the check was silently skipped. CVEs with already-applied fixes (like RHEL-181797) were sent to the backport agent unnecessarily.

The fix matches fork_and_prepare_dist_git (used by backport/rebase agents) which works correctly: clean up via the parent directory, never stat the clone path before the remote clone creates it.

Assisted-by: Claude Opus 4.6

clone_and_prep_sources() was checking local_clone.is_dir() before the
remote clone_repository MCP call. On the shared NFS PVC (netapp-nfs,
ReadWriteMany), this stat() created a negative lookup cache entry for
the clone subdirectory. When MCP gateway subsequently created the
directory on the server, the triage agent's NFS client still had the
stale ENOENT cached, causing FileNotFoundError on the rhpkg/centpkg
prep subprocess — misreported as "not installed" even though both
binaries are present in the container.

This broke every single applicability check: prep always "failed",
the fallback extraction also hit the stale cache (spec file not found),
and the check was silently skipped. CVEs with already-applied fixes
(like RHEL-181797) were sent to the backport agent unnecessarily.

The fix matches fork_and_prepare_dist_git (used by backport/rebase
agents) which works correctly: clean up via the parent directory,
never stat the clone path before the remote clone creates it.

Assisted-by: Claude Opus 4.6

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request modifies the directory cleanup logic in ymir/agents/tasks.py to remove the entire working_dir instead of just the local_clone subdirectory. Feedback highlights a critical path traversal vulnerability, as the jira_issue parameter is used to construct the directory path for deletion without prior validation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread ymir/agents/tasks.py
Same path traversal guard as fork_and_prepare_dist_git: reject empty,
absolute, or ".." containing jira_issue values before they reach
shutil.rmtree().

Assisted-by: Claude Opus 4.6

@opohorel opohorel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@lbarcziova
lbarcziova merged commit 8b18134 into packit:main Jun 8, 2026
9 checks passed
@lbarcziova
lbarcziova deleted the fix-applicability-nfs-cache branch June 16, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants