Skip to content

Refactor pod readiness polling to use wait_for_ready helper - #129

Merged
Jackson Clark (HacksonClark) merged 2 commits into
mainfrom
copilot/refactor-pod-readiness-polling
Jan 22, 2026
Merged

Refactor pod readiness polling to use wait_for_ready helper#129
Jackson Clark (HacksonClark) merged 2 commits into
mainfrom
copilot/refactor-pod-readiness-polling

Conversation

CopilotAI commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

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 statesfor_inrange(12):
pod_list=self.kubectl.list_pods(self.namespace)
forpodinpod_list.items:
forcontainer_statusinpod.status.container_statuses:
ifcontainer_status.state.waiting:
# ... check error stateselifnotcontainer_status.ready:
# ... set all_normal = Falsesleep(5)
# After: Reuse existing helpertry:
self.kubectl.wait_for_ready(self.namespace, sleep=5, max_wait=60)
self.results["success"] =TrueexceptExceptionase:
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>
CopilotAI changed the title [WIP] Refactor pod readiness polling to reuse wait_for_pod_readyRefactor pod readiness polling to use wait_for_ready helperJan 14, 2026
@HacksonClark
Jackson Clark (HacksonClark) marked this pull request as ready for review January 21, 2026 22:17

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.

Great work Copilot!

@HacksonClark
Jackson Clark (HacksonClark) merged commit 253c546 into mainJan 22, 2026
1 check passed
@HacksonClark
Jackson Clark (HacksonClark) deleted the copilot/refactor-pod-readiness-polling branch January 22, 2026 03:36
Sign up for freeto 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

3 participants

@HacksonClark@gaganso