[Fleet] Make save_knowledge_base async in streaming state machine#252328
[Fleet] Make save_knowledge_base async in streaming state machine#252328
Conversation
…to prevent timeouts Co-authored-by: nchaulet <1336873+nchaulet@users.noreply.github.com>
|
@copilot Could you add a test for that, I think adding a unit test that check parity between the two state machine will be great |
Export regularStatesDefinition and streamingStatesDefinition to make them testable, and add a unit test that verifies common states have matching isAsync flags between both state machines. Co-authored-by: nchaulet <1336873+nchaulet@users.noreply.github.com>
Added a parity test in commit 8068376. The test verifies that common states (create_restart_installation, install_kibana_assets, save_archive_entries_from_assets_map, save_knowledge_base, update_so) have matching isAsync flags between regularStatesDefinition and streamingStatesDefinition. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
/ci |
|
@elasticmachine run docs-build |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
cc @nchaulet @Copilot |
|
Starting backport for target branches: 9.3 |
…astic#252328) (cherry picked from commit 34ea966)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
* commit '7dcc1fe3c205d2de0c3ca3f65804f21de09013c3': (285 commits) Enrich kbn-check-saved-objects-cli README with CI and manual usage docs (elastic#252557) [Discover] Add feature flag to make ESQL the default query mode (elastic#252268) Add maskProps.headerZindexLocation above to inspect component flyout (elastic#252543) [Security Solution][Atack/Alerts] Flyout header: Assignees (elastic#252190) Upgrade EUI to v112.3.0 (elastic#252315) [Fleet] Make save_knowledge_base async in streaming state machine (elastic#252328) Upgrade @smithy/config-resolver 4.3.0 → 4.4.6 (elastic#252457) [Lens as API] Add colorMapping support for XY charts (ES|QL data layers) (elastic#252051) [WorkplaceAI] Add Google Drive data source and connector (elastic#250677) [Scout] Move GlobalSearch FTR tests to Scout (elastic#252201) [EDR Workflows] Fix osquery pack results display when agent clock is skewed (elastic#251417) [Observability Onboarding] Apply integrations limit after dedup in parseIntegrationsTSV (elastic#252486) [Entity Analytics] Update `host.ip` aggregation to remove painless script (elastic#252426) Address `@elastic/eui/require-table-caption` lint violations across `@elastic/obs-presentation-team` files (elastic#251050) Consolidate JSON stringify dependencies (elastic#251890) [index mgmt] Use esql instead of query dsl to get the index count (elastic#252422) Add Usage API Plugin (elastic#252434) Cases All Templates page (elastic#250372) [Agent Builder] Default value for optional params in ESQL tools (elastic#238472) [Fleet] Add upgrade_details.metadata.reason to AgentResponseSchema (elastic#252485) ...
…ne (#252328) (#252561) # Backport This will backport the following commits from `main` to `9.3`: - [[Fleet] Make save_knowledge_base async in streaming state machine (#252328)](#252328) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Copilot","email":"198982749+Copilot@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-02-10T15:19:22Z","message":"[Fleet] Make save_knowledge_base async in streaming state machine (#252328)","sha":"34ea9669a58ae968c3d0ce3f5e5c2bb546de15ba","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","💝community","Team:Fleet","backport:version","v9.4.0","v9.3.1"],"title":"[Fleet] Make save_knowledge_base async in streaming state machine","number":252328,"url":"https://github.com/elastic/kibana/pull/252328","mergeCommit":{"message":"[Fleet] Make save_knowledge_base async in streaming state machine (#252328)","sha":"34ea9669a58ae968c3d0ce3f5e5c2bb546de15ba"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/252328","number":252328,"mergeCommit":{"message":"[Fleet] Make save_knowledge_base async in streaming state machine (#252328)","sha":"34ea9669a58ae968c3d0ce3f5e5c2bb546de15ba"}},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Summary
The
save_knowledge_basestep in the streaming state machine blocks package installation until knowledge base indexing completes, causing timeouts for large packages likesecurity_detection_engine.Changes
Added
isAsync: trueto thesave_knowledge_basestep instreamingStatesDefinition:This matches the existing behavior in
regularStatesDefinitionwhere the flag was already present. Knowledge base indexing now runs asynchronously without blocking state machine progression.Added parity test: To ensure consistency between the two state machine definitions, added a unit test that verifies common states have matching
isAsyncflags betweenregularStatesDefinitionandstreamingStatesDefinition. This prevents future drift between the two implementations.Testing
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.