Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

The MisconfigAppHotelResMitigation.eval() method was manually polling pod status with a custom loop instead of using the existing wait_for_ready helper from kubectl.py.

Changes

  • Replaced 29-line manual polling loop with call to kubectl.wait_for_ready(namespace, sleep=5, max_wait=60)
  • Removed unused from time import sleep import
  • Exception handling catches timeout and sets success = False appropriately

Before/After

# Before: Manual polling with nested loops checking container states
for _ in range(12):
    pod_list = self.kubectl.list_pods(self.namespace)
    for pod in pod_list.items:
        for container_status in pod.status.container_statuses:
            if container_status.state.waiting:
                # ... check error states
            elif not container_status.ready:
                # ... set all_normal = False
    sleep(5)

# After: Reuse existing helper
try:
    self.kubectl.wait_for_ready(self.namespace, sleep=5, max_wait=60)
    self.results["success"] = True
except Exception as e:
    print(f"Pods are not all ready: {e}")
    self.results["success"] = False

Behavior remains identical: 60s timeout with 5s polling interval.

Original prompt

This section details on the original issue you should resolve

<issue_title>Refactor pod readiness polling to reuse wait_for_pod_ready</issue_title>
<issue_description>In orchestrator/problems/misconfig_app/misconfig_app_hotel_res.py the code now manually polls pod/container status (e.g., the new for _ in range(12): loop). Per the PR discussion, there’s already a helper wait_for_pod_ready in kubectl.py. We should use that instead.

See discussion: #39 (comment)</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: gaganso <27358592+gaganso@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor pod readiness polling to reuse wait_for_pod_ready Refactor pod readiness polling to use wait_for_ready helper Jan 14, 2026
Copilot AI requested a review from gaganso January 14, 2026 19:19
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.

Refactor pod readiness polling to reuse wait_for_pod_ready

2 participants