Skip to content

fix: keep IgnoredUnrecoverableEvents nil when empty to prevent endless DWOC reconciling - #2288

Open
rmallam wants to merge 1 commit into
eclipse-che:mainfrom
rmallam:fix/dwoc-empty-ignored-unrecoverable-events
Open

rmallam wants to merge 1 commit into
eclipse-che:mainfrom
rmallam:fix/dwoc-empty-ignored-unrecoverable-events

Conversation

@rmallam

@rmallam rmallam commented Dec 2, 2026 •

Copy link
Copy Markdown

What does this PR do?

Prevents an endless 1-second reconciliation loop on DevWorkspaceOperatorConfig/devworkspace-config when CheCluster.spec.devEnvironments.ignoredUnrecoverableEvents is set to an empty slice ([]).

Previously, updateIgnoredUnrecoverableEvents assigned a non-nil empty slice ([]string{}) directly to workspaceConfig.IgnoredUnrecoverableEvents. Because that field uses omitempty, Kubernetes strips it on persist, causing cmp.Diff(nil, []string{}) to report a diff on every reconcile — which continuously updates devworkspace-config and starves all downstream CheCluster reconcilers.

This matches the existing guard used right below it in updateWorkspaceServiceAccountConfig for ServiceAccountTokens (Keep it nil to prevent endless reconciling), and adds a unit test covering an empty []string{} slice.

What issues does this PR fix or reference?

Fixes eclipse-che/che#24044

How to test this PR?

  1. Run unit tests:
    go test -v ./pkg/deploy/devworkspace/... -run TestReconcileDevWorkspaceIgnoredUnrecoverableEvents
    go test ./pkg/deploy/devworkspace/...
  2. On a cluster with spec.devEnvironments.ignoredUnrecoverableEvents: [] set in CheCluster, verify che-operator logs no longer spam Object updated {"kind": "v1alpha1.DevWorkspaceOperatorConfig", "name": "devworkspace-config"} every second and downstream reconcilers (such as ConfigMap/che) converge cleanly.

PR Checklist

  • Code compiles and unit tests pass (go test ./pkg/deploy/devworkspace/...)
  • Commit is signed off (git commit -s)

Summary by CodeRabbit

  • Bug Fixes
    • Workspace configuration now treats an explicitly empty list of ignored unrecoverable events the same as an unset list. This keeps reconciled configuration consistent when no events are specified.

…s DWOC reconciling

Signed-off-by: rmallam <rmallam@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 2, 2026 11:36
@openshift-ci

openshift-ci Bot commented Dec 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rmallam

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Dec 2, 2026

Copy link
Copy Markdown

Hi @rmallam. Thanks for your PR.

I'm waiting for a eclipse-che member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The update function now sets IgnoredUnrecoverableEvents to nil when the input slice is empty. A reconciliation test covers an explicitly empty slice in the CheCluster.

Changes: Ignored unrecoverable events

Layer / File(s) Summary
Normalize empty values and verify reconciliation
pkg/deploy/devworkspace/dev_workspace_config.go, pkg/deploy/devworkspace/dev_workspace_config_workspace_test.go
The update function sets the workspace field to nil for empty input. The test checks reconciliation when the CheCluster value is an explicitly empty slice.

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

Change: Bug fix · Severity of issue fixed: High

Merge Risk: Minimal · up to 34daa

The change stops the endless one-second update loop on the DevWorkspaceOperatorConfig when ignoredUnrecoverableEvents is empty, and a unit test covers the case. No code-level merge risk remains. The failing ECA legal-agreement check must be resolved separately.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the primary change: keeping IgnoredUnrecoverableEvents nil when empty to stop endless DevWorkspaceOperatorConfig reconciling. The raw summary shows the code change clears the field to …
Linked Issues check Passed [#24044] Requirement: an explicit empty ignoredUnrecoverableEvents: [] must normalize to nil in DevWorkspaceOperatorConfig, so reconciliation converges. The PR adds a guard in `updateIgnoredUnreco…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes two files only. dev_workspace_config.go gains a 5-line nil guard for empty IgnoredUnrecoverableEvents. dev_workspace_config_workspace_test.go gains o…
Full details: Title check

Explanation

The title names the primary change: keeping IgnoredUnrecoverableEvents nil when empty to stop endless DevWorkspaceOperatorConfig reconciling. The raw summary shows the code change clears the field to nil for empty input and adds a test for an explicitly empty slice. The PR objectives describe the same goal and linked issue. The title is specific and accurate, and the conventional 'fix:' prefix fits a bug fix. The title is 87 characters, slightly long, but this does not affect the assessment.

Full details: Linked Issues check

Explanation

[#24044] Requirement: an explicit empty ignoredUnrecoverableEvents: [] must normalize to nil in DevWorkspaceOperatorConfig, so reconciliation converges. The PR adds a guard in updateIgnoredUnrecoverableEvents (pkg/deploy/devworkspace/dev_workspace_config.go). When len(ignoredUnrecoverableEvents) == 0, the function sets workspaceConfig.IgnoredUnrecoverableEvents = nil and returns. This follows the existing ServiceAccountTokens pattern in the same file. Non-empty slices are still assigned unchanged, so the issue's non-empty behavior is preserved. A unit test case, "Empty events slice keeps field nil", was added to TestReconcileDevWorkspaceIgnoredUnrecoverableEvents (dev_workspace_config_workspace_test.go). It passes []string{} and expects nil. The cluster-level convergence check from the issue is not executed in this review. The code path that causes the diff is covered by the unit test.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes two files only. dev_workspace_config.go gains a 5-line nil guard for empty IgnoredUnrecoverableEvents. dev_workspace_config_workspace_test.go gains one test case for the same function. Both changes implement the objective in #24044. No unrelated changes were found.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 54fdec01-76ac-4425-819a-35dc8de752f9
Commits

Reviewing files that changed from the base of the PR and between 7e94947 and 34daa24.

Files selected for processing: 2

  • pkg/deploy/devworkspace/dev_workspace_config.go
  • pkg/deploy/devworkspace/dev_workspace_config_workspace_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Copilot AI 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.

🟢 Approval recommended

The change is narrowly scoped to preventing reconcile diffs by preserving a nil field when the input list is empty, and it includes a targeted regression unit test covering the reported empty-slice hot-loop scenario.

No open issues 🎉

What changed in this PR

Fixes an idempotency issue that caused a 1-second reconciliation hot-loop on DevWorkspaceOperatorConfig/devworkspace-config when CheCluster.spec.devEnvironments.ignoredUnrecoverableEvents is explicitly set to an empty list.

Changes:

  • Keep WorkspaceConfig.IgnoredUnrecoverableEvents as nil (not a non-nil empty slice) when the input slice is empty to avoid omitempty/diff-driven updates.
  • Add a unit test covering the empty-slice regression scenario.
File Description
pkg/​deploy/​devworkspace/​dev_workspace_config.go Adds a guard in updateIgnoredUnrecoverableEvents to preserve IgnoredUnrecoverableEvents as nil when the configured list is empty, preventing endless reconcile diffs.
pkg/​deploy/​devworkspace/​dev_workspace_config_workspace_test.go Adds a regression test ensuring an explicitly empty ignoredUnrecoverableEvents input results in a nil IgnoredUnrecoverableEvents field in the reconciled config.

Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

@tolusha

tolusha commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

che-operator: Setting ignoredUnrecoverableEvents: [] in CheCluster causes infinite DevWorkspaceOperatorConfig reconcile loop

3 participants