Skip to content

Conversation

@neptunian
Copy link
Contributor

Backport

This will backport the following commits from main to 9.1:

Questions ?

Please refer to the Backport tool documentation

## Summary

When using kibana without an network connection, as is potentially the
case in airgapped environments, most requests in observability ai
assistant management UI will not fire. This results in the inability to
use the knowledge base UI, though the api endpoints still work. By
default, [TanStack Query (used by useQuery) disables all network
requests when the browser reports offline
status](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode).
This isn't necessary for kb endpoints that operate entirely against the
local Elasticsearch cluster and do not require internet access.

This change updates all useQuery calls in the Observability AI Assistant
Management to use `networkMode: 'always'`. This ensures that queries are
executed even when the browser is offline (`navigator.onLine ===
false`).

Not all air-gapped environments would be affected. In many real-world
deployments machines still have network interfaces configured, and
`navigator.onLine` remains true. In those cases, the UI works as
expected.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine

This brings management in line with other kibana endpoints which do not
use `react-query` and do not have the issue, including
`observability_ai_assistant/kb/status`

### Test
- Run es and kibana offline
- Visit knowledge tab in settings and interact with the app
- the network tab should have requests (they will fail unless you have
elser running locally, but that is ok), eg New Entry should make the
request to save when trying to save.

(cherry picked from commit 0b1864a)

# Conflicts:
#	x-pack/platform/plugins/private/observability_ai_assistant_management/public/hooks/use_get_product_doc.ts
@neptunian neptunian added the backport This PR is a backport of another PR label Aug 5, 2025
@neptunian neptunian enabled auto-merge (squash) August 5, 2025 17:43
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Aug 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #19 / AssetDocumentTab should select json tab when clicked

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observabilityAiAssistantManagement 98.5KB 98.7KB +168.0B

@neptunian neptunian merged commit 45ee81b into elastic:9.1 Aug 5, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR ci:project-deploy-observability Create an Observability project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants