Skip to content

fix(operator): stop forwarding duplicate spec/uid on healthcheck rerun - #2429

Open
Minh141120 wants to merge 1 commit into
HolmesGPT:masterfrom
Minh141120:fix/healthcheck-rerun-duplicate-kwargs
Open

fix(operator): stop forwarding duplicate spec/uid on healthcheck rerun#2429
Minh141120 wants to merge 1 commit into
HolmesGPT:masterfrom
Minh141120:fix/healthcheck-rerun-duplicate-kwargs

Conversation

@Minh141120

@Minh141120 Minh141120 commented Aug 29, 2026

Copy link
Copy Markdown

holmesgpt.dev/rerun=true never re-executes a HealthCheck.

The update handler forwards to the create handler with spec and uid both as named arguments and inside **kwargs - which kopf also populates — so every attempt raises:

on_healthcheck_create() got multiple values for keyword argument 'spec'

kopf then retries the handler on a 60s backoff indefinitely. Fixing only spec surfaces the same error for uid, so both are filtered. The remaining kwargs are still forwarded, because the create handler reads body from them to attach events to the resource.

Observed on robustadev/holmes-operator:0.40.0; the code path is unchanged on master.

Reproduce

  1. Apply any HealthCheck and let it complete
  2. kubectl annotate healthcheck <name> holmesgpt.dev/rerun=true
  3. The operator logs the TypeError, and kopf.zalando.org/on_healthcheck_update on the resource accumulates "retries" with "success": false

Tests

Two regression tests: one asserting the rerun re-executes the check, one asserting an unchanged annotation stays a no-op. The first fails with TypeError on master and passes with this change; pytest tests/holmes_operator is 26 passed.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed health check reruns triggered by the rerun annotation.
    • Prevented duplicate status updates when the rerun annotation remains unchanged.
    • Rerun checks now correctly record successful results and events.

The rerun handler forwards to the create handler with spec and uid both as
named arguments and inside **kwargs, which kopf also populates. Every rerun
raised TypeError, so holmesgpt.dev/rerun=true never re-executed a check and
kopf retried the handler on a 60s backoff indefinitely.

Filter the two colliding keys before forwarding. The rest of kwargs is kept
because the create handler reads body from it to attach events.

Signed-off-by: Minh141120 <minh.itptit@gmail.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 29, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Minh141120 / name: Minh141120 (167d7fd)

@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for holmes-docs ready!

Name Link
🔨 Latest commit 167d7fd
🔍 Latest deploy log https://app.netlify.com/projects/holmes-docs/deploys/6a9235272dd21d0008c236f5
😎 Deploy Preview https://deploy-preview-2429--holmes-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a2c8b01-f9a3-4777-aa23-09836f007963

📥 Commits

Reviewing files that changed from the base of the PR and between 3d20155 and 167d7fd.

📒 Files selected for processing (2)
  • holmes_operator/handlers/healthcheck.py
  • tests/holmes_operator/test_healthcheck_component.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The healthcheck update handler now removes duplicated spec and uid arguments before rerun execution. Tests cover successful reruns and unchanged rerun annotations.

Changes

Healthcheck rerun handling

Layer / File(s) Summary
Rerun execution and validation
holmes_operator/handlers/healthcheck.py, tests/holmes_operator/test_healthcheck_component.py
The rerun path filters spec and uid before calling on_healthcheck_create. Tests verify a passing rerun and a no-op when the annotation remains true.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 167d7

This change restores health-check reruns by removing duplicate arguments while preserving no-op behavior for unchanged annotations. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: preventing duplicate forwarding of spec and uid during healthcheck reruns.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant