Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Observability AI Assistant] duplicate conversations #208044

Conversation

arturoliduena
Copy link
Contributor

@arturoliduena arturoliduena commented Jan 23, 2025

Closes #209382

Summary:

Duplicate Conversation

  • Readonly → Public conversations can only be modified by the owner.
  • Duplicated conversations are owned by the user who duplicates them.
  • Duplicated conversations are private by default public: false.
Screen.Recording.2025-02-12.at.15.19.11.mov

UPDATE:

Screen.Recording.2025-02-18.at.12.32.38.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

@arturoliduena arturoliduena added release_note:feature Makes this part of the condensed release notes Team:Obs AI Assistant Observability AI Assistant backport:version Backport to applied version labels v8.18.0 labels Jan 23, 2025
@arturoliduena arturoliduena requested a review from a team as a code owner January 23, 2025 12:49
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant)

@arturoliduena arturoliduena force-pushed the obs-ai-assistant-180710-alerting-public-conversations branch from 8d79ec4 to 5aae81a Compare January 29, 2025 13:30
@arturoliduena arturoliduena requested a review from a team as a code owner January 30, 2025 10:25
Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

@arturoliduena Is this PR ready for review?

@arturoliduena arturoliduena marked this pull request as draft January 30, 2025 16:14
@arturoliduena
Copy link
Contributor Author

@arturoliduena Is this PR ready for review?

@sorenlouv I’ve marked this PR as draft because it was initially ready for review, but we’ve changed the approach. It’s now a WIP.

@arturoliduena arturoliduena force-pushed the obs-ai-assistant-180710-alerting-public-conversations branch 2 times, most recently from d522071 to 3ab94b5 Compare February 3, 2025 09:48
@arturoliduena arturoliduena changed the base branch from main to conversations-management-obs-ai-assistant February 4, 2025 10:06
@arturoliduena arturoliduena marked this pull request as ready for review February 4, 2025 10:10
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Feb 9, 2025
Copy link
Contributor

github-actions bot commented Feb 9, 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!)

Copy link
Contributor

@viduni94 viduni94 left a comment

Choose a reason for hiding this comment

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

Hey @arturoliduena
I added some comments about the UI and some functionality.

Do we want to allow users to fork private conversations too?
Or should we only have this option for shared conversations?
(I can see the option is available for both private and shared conversations)

@viduni94
Copy link
Contributor

@arturoliduena
Could you update the screen recording in the PR description with the latest changes?
Thank you

@arturoliduena
Copy link
Contributor Author

I added some comments about the UI and some functionality.

Do we want to allow users to fork private conversations too?
Or should we only have this option for shared conversations?
(I can see the option is available for both private and shared conversations)

Thank you @viduni94, I added that users can only fork shared conversations

@arturoliduena
Copy link
Contributor Author

I see a few differences here from the Figma Design

The text seem larger here than Figma
The icon is not loading
Needs some spacing between the banner and the input
The banner color seems darker than Figma

I've added those fixes.
I am troubleshooting what happens with the plugs icon:
Screenshot 2025-02-10 at 14 26 21

@arturoliduena
Copy link
Contributor Author

@viduni94 @isaclfreire
The plugs icon is not available in Kibana yet.
The upgrade PR is still under review here. Once it’s merged, we should be able to use it.

In the meantime, I’ve temporarily replaced the plugs icon with the branch icon to avoid being blocked.
Screenshot 2025-02-11 at 14 05 35

@isaclfreire
Copy link

isaclfreire commented Feb 11, 2025

Hello, here's my comments:

  1. Users should be able to type a message in the input field to “continue the conversation” = automatically create a fork of the conversation - visibility of new conversation should be private by default - instead of hitting a dead end, and getting an error.

  2. Users could be able to fork private conversations as well, but I would rather call it “Duplicate” instead. I’m not quite sure we really need to cross-link the new conversation to its original in this case, as they were initiated by the same person. Wdyt, @teknogeek0?

  3. Please remove the “Fork this conversation” button from the callout message as it’s redundant, since the input field should be interactive and do the job.

  4. I would also refrain from using the branch icon when we are speaking about the alert connector, as it can be misleading. Please, let’s use the bell icon instead for the time being.

Thanks everyone for the awesome work 👍

@arturoliduena arturoliduena added v9.0.0 and removed v8.18.0 backport:version Backport to applied version labels labels Feb 13, 2025
@@ -75,10 +84,6 @@ export function useConversation({
const initialMessages = useOnce(initialMessagesFromProps);
const initialTitle = useOnce(initialTitleFromProps);

if (initialMessages.length && initialConversationId) {
throw new Error('Cannot set initialMessages if initialConversationId is set');
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, I'm not sure whether we should remove this 🤔
Any thoughts @dgieselaar @sorenlouv ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@arturoliduena
I know you might have removed this to fix https://github.com/elastic/kibana/pull/208044/files#r1971621797
But I'm not sure what other things might break if we remove this..

Let's wait to hear from Dario or Soren

Copy link
Contributor

@viduni94 viduni94 Feb 27, 2025

Choose a reason for hiding this comment

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

Cz there's a specific test to cover this scenario too - https://github.com/elastic/kibana/pull/208044/files#diff-6ae996f673c49cb1e5b461807ab7f7689995b08ebacf84ba47824bdab46a231eL87
So I'm guessing this validation is important. I'm not 100% sure though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@viduni94, we don’t need to catch this error anymore, as there’s now a valid case for it, duplicating a conversation when the initial messages aren’t empty.

What this check was originally preventing is:

When a user starts a conversation with an initial message and then navigates to another conversation using a conversation ID, the previous conversation’s messages are lost. However, this only happens if the conversation was started from Contextual Insights, since those conversations are not persisted. If the user navigates away, the messages are lost, which is what this validation was trying to prevent.
In reality, though, users cannot navigate to another conversation in this scenario because the conversation list is hidden. I believe we should allow users to navigate freely (for another discussion) if they lose their messages, they can always start a new conversation from Contextual Insights again.
Additionally, when updating the title, a separate validation already handles this, so the title (pencil icon) cannot be edited when the conversation hasn’t been stored yet.

This change fixes the original bug while also removing unnecessary code.

Copy link
Contributor

Choose a reason for hiding this comment

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

To close this thread, as discussed during the dev sync.. instead of removing this check, consider resetting initial messages when navigating to a stored conversation with conversationId.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Instead of removing the check, I’ve added a reset for initialMessages when duplicating the conversation.
We can open a new issue to enable the conversation list in the flyout for conversations opened from Contextual Insights and apply the same changes there.

Copy link
Contributor

@viduni94 viduni94 Mar 4, 2025

Choose a reason for hiding this comment

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

We can open a new issue to enable the conversation list in the flyout

If you enable the conversation list and click on "New conversation" after initialMessages are set from contextual insights, does the initial messages get cleared?
(It might still be there, since the messages in use_chat is not cleared with the solution in this PR)

Unless you do the below when clicked on "New conversation" (to reset initial messages)

service.conversations.openNewConversation({
     messages: [],
});

But this will close and re-open the flyout.

@neptunian
Copy link
Contributor

Hi @arturoliduena I'm trying to test this in the UI. Can you provide directions? I'm trying it locally, stateful, and have alerts but I don't see how to share them. Should I be able to share conversations not created by alerts, too?

I see you added some integration tests but having some functional UI tests would probably be good as well.

@arturoliduena
Copy link
Contributor Author

Hi @arturoliduena I'm trying to test this in the UI. Can you provide directions? I'm trying it locally, stateful, and have alerts but I don't see how to share them. Should I be able to share conversations not created by alerts, too?
I see you added some integration tests but having some functional UI tests would probably be good as well.

@neptunian
With the latest change, conversations created by the rule connector are private by default, meaning only the owner can see them. However, you can duplicate your own conversations and duplicate shared conversations (sharing is part of another issue [Obs AI Assistant] Sharing conversations).

To manually test this:

  • Create an alert in a previous Kibana version (before this change). This will generate a public conversation with no user attached. this is an artificial way to create a public/share conversation until we add the sharing functionality.
  • Run this Kibana version and open the AI Assistant.
  • You should see the previously created public conversation, but since it’s public, you won’t be able to edit or continue it. Instead, you’ll see the share panel with the option to duplicate it.
  • Once duplicated, you can continue interacting with it as a private conversation.
Screen.Recording.2025-02-28.at.11.54.03.mov

@arturoliduena arturoliduena changed the title [Observability AI Assistant] public and duplicate conversations [Observability AI Assistant] duplicate conversations Mar 3, 2025
@arturoliduena arturoliduena force-pushed the obs-ai-assistant-180710-alerting-public-conversations branch from 8b79614 to f143b17 Compare March 4, 2025 19:02
@arturoliduena arturoliduena enabled auto-merge (squash) March 4, 2025 19:47
@elasticmachine
Copy link
Contributor

elasticmachine commented Mar 4, 2025

💚 Build Succeeded

  • Buildkite Build
  • Commit: 9f751df
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-208044-9f751df2e1de

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ai-assistant 76 78 +2
observabilityAIAssistant 382 385 +3
total +5

Async chunks

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

id before after diff
observabilityAIAssistantApp 252.1KB 255.1KB +3.1KB
searchAssistant 146.7KB 149.7KB +3.0KB
total +6.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observabilityAIAssistant 38.0KB 38.0KB +17.0B
Unknown metric groups

API count

id before after diff
@kbn/ai-assistant 76 78 +2
observabilityAIAssistant 384 387 +3
total +5

History

@arturoliduena arturoliduena merged commit b331fa1 into elastic:main Mar 4, 2025
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 4, 2025
Closes elastic#209382

### Summary:

#### Duplicate Conversation
- **Readonly** → Public conversations can only be modified by the owner.
- Duplicated conversations are **owned** by the user who duplicates
them.
- Duplicated conversations are **private** by default `public: false`.

https://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c

UPDATE:

https://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit b331fa1)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 5, 2025
…213167)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Observability AI Assistant] duplicate conversations
(#208044)](#208044)

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

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

<!--BACKPORT [{"author":{"name":"Arturo
Lidueña","email":"arturo.liduena@elastic.co"},"sourceCommit":{"committedDate":"2025-03-04T22:15:37Z","message":"[Observability
AI Assistant] duplicate conversations (#208044)\n\nCloses #209382\n\n###
Summary:\n\n#### Duplicate Conversation \n- **Readonly** → Public
conversations can only be modified by the owner.\n- Duplicated
conversations are **owned** by the user who duplicates\nthem.\n-
Duplicated conversations are **private** by default `public: false`. \n
\n\nhttps://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c\n\nUPDATE:\n\n\nhttps://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"b331fa1c53f817c0e9c372ab4e5939551550ab9c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","Team:Obs
AI
Assistant","ci:project-deploy-observability","backport:version","v9.1.0","v8.19.0"],"title":"[Observability
AI Assistant] duplicate
conversations","number":208044,"url":"https://github.com/elastic/kibana/pull/208044","mergeCommit":{"message":"[Observability
AI Assistant] duplicate conversations (#208044)\n\nCloses #209382\n\n###
Summary:\n\n#### Duplicate Conversation \n- **Readonly** → Public
conversations can only be modified by the owner.\n- Duplicated
conversations are **owned** by the user who duplicates\nthem.\n-
Duplicated conversations are **private** by default `public: false`. \n
\n\nhttps://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c\n\nUPDATE:\n\n\nhttps://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"b331fa1c53f817c0e9c372ab4e5939551550ab9c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208044","number":208044,"mergeCommit":{"message":"[Observability
AI Assistant] duplicate conversations (#208044)\n\nCloses #209382\n\n###
Summary:\n\n#### Duplicate Conversation \n- **Readonly** → Public
conversations can only be modified by the owner.\n- Duplicated
conversations are **owned** by the user who duplicates\nthem.\n-
Duplicated conversations are **private** by default `public: false`. \n
\n\nhttps://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c\n\nUPDATE:\n\n\nhttps://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] Any text
added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] If a plugin
configuration key changed, check if it needs to be\nallowlisted in the
cloud and added to the
[docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\nchanges have been approved by the breaking-change committee.
The\n`release_note:breaking` label should be applied in these
situations.\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"b331fa1c53f817c0e9c372ab4e5939551550ab9c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Arturo Lidueña <arturo.liduena@elastic.co>
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 ci:project-deploy-observability Create an Observability project release_note:feature Makes this part of the condensed release notes Team:Obs AI Assistant Observability AI Assistant v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Obs AI Assistant] Duplicate conversations
9 participants