Skip to content

[9.1] [Obs AI Assistant] knowledge base UI works offline (#229874)#230281

Closed
kibanamachine wants to merge 1 commit intoelastic:9.1from
kibanamachine:backport/9.1/pr-229874
Closed

[9.1] [Obs AI Assistant] knowledge base UI works offline (#229874)#230281
kibanamachine wants to merge 1 commit intoelastic:9.1from
kibanamachine:backport/9.1/pr-229874

Conversation

@kibanamachine
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)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Aug 1, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) August 1, 2025 16:54
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Aug 1, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 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 in-progress, with failures

Failed CI Steps

cc @neptunian

@neptunian
Copy link
Contributor

closed for #230651

@neptunian neptunian closed this Aug 5, 2025
auto-merge was automatically disabled August 5, 2025 17:44

Pull request was closed

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