Skip to content

Periodically clean up orphaned Sandcastle PVCs - #3162

Merged
centosinfra-prod-github-app[bot] merged 1 commit into
packit:mainfrom
nforro:sandcastle
Aug 3, 2026
Merged

Periodically clean up orphaned Sandcastle PVCs#3162
centosinfra-prod-github-app[bot] merged 1 commit into
packit:mainfrom
nforro:sandcastle

Conversation

@nforro

@nforro nforro commented Aug 3, 2026

Copy link
Copy Markdown
Member

No description provided.

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:49 AM UTC · Completed 11:06 AM UTC
Commit: bcc8806 · View workflow run →

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@nforro nforro moved this from New to In review in Packit pull requests Aug 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review

Findings

Low

  • [test adequacy] packit_service/worker/tasks.py — No unit tests are added for cleanup_orphaned_pvcs. The sibling function cleanup_orphaned_pidbox_queues has a corresponding test in tests/unit/test_tasks.py that validates its scanning and TTL-setting logic via mocks. Adding similar mocked test coverage would catch regressions in the naming filter, age check, pod-volume matching, and 404 handling.
  • [missing-authorization] No linked issue or PR description. While the change is well-scoped and follows established patterns, documenting the motivation for the new PVC cleanup task (e.g., frequency of PVC leaks, cluster impact) would benefit future maintainers.
Previous run

Review

Findings

Medium

  • [race condition] packit_service/worker/tasks.py — Race condition between PVC creation and pod scheduling. Sandcastle creates a PVC before launching its pod. If the cleanup task runs between PVC creation and pod scheduling, the cleanup will see a PVC with no associated pod and delete it, causing the subsequently scheduled pod to fail. There is no minimum-age check on PVCs to provide a grace period.
    Remediation: Before deleting, check pvc.metadata.creation_timestamp and skip PVCs that are younger than a safe threshold (e.g., 30–60 minutes).

  • [error-handling-idiom] packit_service/worker/tasks.py — The adjacent cleanup_orphaned_pidbox_queues task wraps its entire body in a try/except with a broad except Exception fallback, ensuring unexpected errors are logged rather than propagated as Celery task failures. The new cleanup_orphaned_pvcs task has no top-level exception guard — only targeted ApiException catches. An unexpected error would propagate unhandled, producing a Celery task failure rather than a logged warning.
    Remediation: Add a top-level try/except Exception around the task body, matching the pattern in cleanup_orphaned_pidbox_queues.

Low

  • [missing-authorization] — This PR has no linked issue and no body text explaining the motivation. Non-trivial changes that add new operational behavior should trace to an authorized issue so that design decisions (e.g., 6-hour interval, naming convention filter, grace_period_seconds=0) are documented.

  • [null handling] packit_service/worker/tasks.py — The nested generator expression accesses pod_obj.spec.volumes but only guards against volumes being None. If pod_obj.spec were None, this would raise AttributeError.

  • [import-placement] packit_service/worker/tasks.py — The new task uses function-local imports. This is the only function in tasks.py with local imports — every other function uses module-level imports exclusively. Deferred imports can be valid for Celery tasks, but should be consistent or documented.


Labels: PR adds a new periodic Celery beat task for internal Kubernetes PVC cleanup


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the kind/internal Task that doesn't affect users directly label Aug 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 11:15 AM UTC · Ended 11:17 AM UTC
Commit: c73c7ab · View workflow run →

Signed-off-by: Nikola Forró <nforro@redhat.com>
Assisted-by: Claude Opus 4.6 via Claude Code
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 11:18 AM UTC · Ended 11:32 AM UTC
Commit: 811afc7 · View workflow run →

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review August 3, 2026 11:32

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Aug 3, 2026
@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:18 AM UTC · Completed 11:32 AM UTC
Commit: 811afc7 · View workflow run →

@nforro nforro added the mergeit Merge via Zuul label Aug 3, 2026
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@centosinfra-prod-github-app
centosinfra-prod-github-app Bot merged commit b828c3d into packit:main Aug 3, 2026
56 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Packit pull requests Aug 3, 2026
@nforro
nforro deleted the sandcastle branch August 3, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/internal Task that doesn't affect users directly mergeit Merge via Zuul ready-for-merge All reviewers approved — ready to merge

Projects

Development

Successfully merging this pull request may close these issues.

3 participants