-
Notifications
You must be signed in to change notification settings - Fork 513
Add generation-based re-execution and rerun annotation support #1862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aantn
wants to merge
7
commits into
master
Choose a base branch
from
claude/kubectl-apply-operator-cr-vkzvj
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dc200bd
Add generation-based re-trigger for HealthCheck operator CR
claude 29546b1
Clear holmesgpt.dev/rerun annotation after processing
claude ddf309c
Merge branch 'master' into claude/kubectl-apply-operator-cr-vkzvj
aantn 063e041
Update operator docs for generation-based re-execution
claude 5803c3f
Merge remote changes and resolve conflict in deployment-verification.md
claude fb882c1
Simplify re-run: clear rerun annotation on create for toggle pattern
claude ee321a6
Fix Helm template inaccuracies in deployment-verification docs
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 The CI/CD polling script in deployment-verification.md checks only status.result without verifying status.phase == Completed, causing it to report false success during a re-run. Because set_healthcheck_pending only patches phase=Pending without clearing the old result field, the stale result=pass from a prior run is visible immediately when a new check starts — the script exits 0 before the new check completes. Fix by updating the polling script to also assert phase=Completed before trusting the result, or by having set_healthcheck_pending explicitly null out the result/message/etc. fields.
Extended reasoning...
What the bug is and how it manifests
set_healthcheck_pending in utils.py only patches phase=Pending and startTime. Kubernetes strategic merge PATCH preserves every field not explicitly set, so the old result, message, rationale, duration, completionTime, and modelUsed remain in the live resource status from the previous run. The CI/CD polling script in deployment-verification.md (lines 120-127) polls status.result directly, with no check that status.phase == Completed before trusting the result.
The specific code path that triggers it
When a re-run fires (either via generation mismatch in on_healthcheck_update Trigger 1, or via the holmesgpt.dev/rerun annotation in Trigger 2), _execute_healthcheck is called which immediately invokes set_healthcheck_pending. That function calls update_healthcheck_status with only phase=Pending and start_time. The status subresource PATCH does not include result, message, or completionTime, so Kubernetes preserves those fields at their previous values. The polling script immediately queries status.result which returns the stale value and exits 0.
Why existing code does not prevent it
Neither set_healthcheck_pending nor _execute_healthcheck explicitly nulls out the stale result fields. The polling script has no guard checking phase — it will immediately see the stale result=pass on the very first poll iteration, which may happen within milliseconds of kubectl apply before the operator has even processed the update event, let alone completed the check.
Impact
The documented CI/CD gating use case is silently broken for repeat deploys. A pipeline will declare "Deploy verified healthy" before the new health check completes, bypassing the entire safety gate. The previous docs used versioned resource names (e.g., checkout-api-deploy-v2-4-1) meaning each deploy started with a fresh resource and no prior result. This PR explicitly changes the guidance to a persistent name with the rerun toggle, making the stale-result window the default for every deploy after the first.
Step-by-step proof
How to fix
Either: (1) Update the polling script to check phase=Completed before trusting result — add a PHASE check alongside the RESULT check so the script only exits when both phase=Completed AND result=pass. Or: (2) have set_healthcheck_pending explicitly null out result, message, rationale, completionTime, duration, modelUsed so there is no stale data window at all.