Skip to content

Comments

[ResponseOps][Cases] Skip the execution of the CAI tasks when the feature is disabled#227860

Merged
cnasikas merged 10 commits intoelastic:mainfrom
cnasikas:not_register_cai_when_disabled
Jul 15, 2025
Merged

[ResponseOps][Cases] Skip the execution of the CAI tasks when the feature is disabled#227860
cnasikas merged 10 commits intoelastic:mainfrom
cnasikas:not_register_cai_when_disabled

Conversation

@cnasikas
Copy link
Member

@cnasikas cnasikas commented Jul 14, 2025

Summary

This PR skips the execution of the CAI tasks if the feature is disabled.

@cnasikas cnasikas self-assigned this Jul 14, 2025
@cnasikas cnasikas added the Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// label Jul 14, 2025
@cnasikas cnasikas requested a review from a team as a code owner July 14, 2025 15:35
@cnasikas cnasikas added the Feature:Cases Cases feature label Jul 14, 2025
@cnasikas cnasikas requested a review from a team as a code owner July 14, 2025 15:35
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cases (Feature:Cases)

@cnasikas cnasikas added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.1.0 v8.19.0 v9.2.0 labels Jul 14, 2025
@cnasikas cnasikas changed the title [ResponseOps][Cases] Skip registering the CAI tasks when the feature is disabled [ResponseOps][Cases] Skip the execution of the CAI tasks when the feature is disabled Jul 14, 2025
}

public async run() {
if (!this.analyticsConfig.index.enabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I might need some more context here to understand why we're scheduling a task that will actually never really run, just return early.

Copy link
Member Author

@cnasikas cnasikas Jul 14, 2025

Choose a reason for hiding this comment

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

Imagine the user enables the feature. The tasks are scheduled to run. Then the feature is disabled. The task manager, running on a different node than the kibana node, will still run the tasks because they are already scheduled or they got rescheduled due to an error. It can happen. We found it while testing on serverless.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha. That means we probably have this issue in most tasks in Kibana that depend on an external flag. Nice catch. I still think it also makes sense, not to schedule the task, on top of this check.

Copy link
Member Author

@cnasikas cnasikas Jul 14, 2025

Choose a reason for hiding this comment

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

We already skip scheduling if the feature is disabled here

if (this.caseConfig.analytics.index?.enabled) {

@cnasikas
Copy link
Member Author

@elasticmachine merge upstream

: []),
'--xpack.ruleRegistry.write.enabled=true',
'--xpack.ruleRegistry.write.cache.enabled=false',
'--xpack.cases.analytics.index.enabled=true',
Copy link
Contributor

@azasypkin azasypkin Jul 15, 2025

Choose a reason for hiding this comment

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

question: wouldn't this be true by default (since these aren't deployment agnostic or serverless tests and "traditional" part of the config should apply here)? It doesn't hurt though (just in case you need to make other changes, otherwise it'd not be worth running CI again just for that)

Copy link
Member Author

Choose a reason for hiding this comment

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

That's true! I put the config for the tests before adding your suggestion about offeringBasedSchema. Would you like me to remove it?

Copy link
Contributor

Choose a reason for hiding this comment

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

We agreed on Slack to keep it as is since it's not worth waiting for another CI run just for this optional improvement.

@azasypkin
Copy link
Contributor

buildkite/docs-build-pr was failing, I've re-run it, let's see if it helps.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @cnasikas

@cnasikas cnasikas merged commit be184bb into elastic:main Jul 15, 2025
12 of 13 checks passed
@cnasikas cnasikas deleted the not_register_cai_when_disabled branch July 15, 2025 10:13
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16290500014

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 15, 2025
…ture is disabled (elastic#227860)

## Summary

This PR skips the execution of the CAI tasks if the feature is disabled.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit be184bb)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [ResponseOps] Cases analytics integration tests (#225231)
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 227860

Questions ?

Please refer to the Backport tool documentation

azasypkin added a commit that referenced this pull request Jul 15, 2025
…ture is disabled (#227860) (#227968)

## Summary

Cherry-picking #227860 for the
emergency release.

Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jul 15, 2025
…he feature is disabled (#227860) (#227970)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[ResponseOps][Cases] Skip the execution of the CAI tasks when the
feature is disabled
(#227860)](#227860)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"christos.nasikas@elastic.co"},"sourceCommit":{"committedDate":"2025-07-15T10:13:51Z","message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860)\n\n## Summary\n\nThis PR skips the execution of the CAI tasks
if the feature is disabled.\n\n---------\n\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>","sha":"be184bb8d86ed2ec932d84c063f7536edc85dc7d","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","Feature:Cases","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is
disabled","number":227860,"url":"https://github.com/elastic/kibana/pull/227860","mergeCommit":{"message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860)\n\n## Summary\n\nThis PR skips the execution of the CAI tasks
if the feature is disabled.\n\n---------\n\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>","sha":"be184bb8d86ed2ec932d84c063f7536edc85dc7d"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227860","number":227860,"mergeCommit":{"message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860)\n\n## Summary\n\nThis PR skips the execution of the CAI tasks
if the feature is disabled.\n\n---------\n\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>","sha":"be184bb8d86ed2ec932d84c063f7536edc85dc7d"}}]}]
BACKPORT-->

Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@cnasikas
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

cnasikas added a commit that referenced this pull request Jul 18, 2025
…the feature is disabled (#227860) (#228510)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[ResponseOps][Cases] Skip the execution of the CAI tasks when the
feature is disabled
(#227860)](#227860)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"christos.nasikas@elastic.co"},"sourceCommit":{"committedDate":"2025-07-15T10:13:51Z","message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860)\n\n## Summary\n\nThis PR skips the execution of the CAI tasks
if the feature is disabled.\n\n---------\n\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>","sha":"be184bb8d86ed2ec932d84c063f7536edc85dc7d","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","Feature:Cases","backport:version","v9.1.0","v8.19.0","v9.2.0"],"title":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is
disabled","number":227860,"url":"https://github.com/elastic/kibana/pull/227860","mergeCommit":{"message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860)\n\n## Summary\n\nThis PR skips the execution of the CAI tasks
if the feature is disabled.\n\n---------\n\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>","sha":"be184bb8d86ed2ec932d84c063f7536edc85dc7d"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/227970","number":227970,"state":"MERGED","mergeCommit":{"sha":"ad97bf24b022c2aec8dc19431537fe8e3fcd1ca2","message":"[9.1]
[ResponseOps][Cases] Skip the execution of the CAI tasks when the
feature is disabled (#227860) (#227970)\n\n# Backport\n\nThis will
backport the following commits from `main` to `9.1`:\n-
[[ResponseOps][Cases] Skip the execution of the CAI tasks when
the\nfeature is
disabled\n(#227860)](https://github.com/elastic/kibana/pull/227860)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Christos Nasikas <christos.nasikas@elastic.co>\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227860","number":227860,"mergeCommit":{"message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860)\n\n## Summary\n\nThis PR skips the execution of the CAI tasks
if the feature is disabled.\n\n---------\n\nCo-authored-by: Elastic
Machine
<elasticmachine@users.noreply.github.com>","sha":"be184bb8d86ed2ec932d84c063f7536edc85dc7d"}},{"url":"https://github.com/elastic/kibana/pull/227968","number":227968,"branch":"deploy-fix@1752473612","state":"MERGED","mergeCommit":{"sha":"5f662c1a33358d066b7c7e56af3924ebd3c279d8","message":"[ResponseOps][Cases]
Skip the execution of the CAI tasks when the feature is disabled
(#227860) (#227968)\n\n## Summary\n\nCherry-picking
#227860 for the\nemergency
release.\n\nCo-authored-by: Christos Nasikas
<christos.nasikas@elastic.co>\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>"}}]}] BACKPORT-->

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
…ture is disabled (elastic#227860)

## Summary

This PR skips the execution of the CAI tasks if the feature is disabled.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…ture is disabled (elastic#227860)

## Summary

This PR skips the execution of the CAI tasks if the feature is disabled.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.19.0 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants