Skip to content

[Search Playground] Fix the issue related to token count#246589

Merged
saikatsarkar056 merged 2 commits intoelastic:mainfrom
saikatsarkar056:token_count_issue
Dec 17, 2025
Merged

[Search Playground] Fix the issue related to token count#246589
saikatsarkar056 merged 2 commits intoelastic:mainfrom
saikatsarkar056:token_count_issue

Conversation

@saikatsarkar056
Copy link
Contributor

@saikatsarkar056 saikatsarkar056 commented Dec 16, 2025

Summary

Fixes token count display showing "NaN / 200,000 tokens sent" in the Search Playground after the AI SDK v5 upgrade.

The issue was on the client-side in parseDataStream (api.ts), where messageAnnotations was being reset to undefined when a text-start chunk was received. In AI SDK v5, annotations (including token counts) are sent before the text-start chunk, so this reset was clearing the already-collected token data. This PR removes that reset to preserve annotations across the stream, ensuring token counts are correctly attached to the final message and displayed in the UI.

Before

Screenshot 2025-12-16 at 10 39 42 AM

After

Screenshot 2025-12-16 at 9 56 13 AM

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
  • Review the backport guidelines and apply applicable backport:* labels.

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.

Release note

Fixes token count display showing "NaN" in Search Playground by preserving message annotations across the AI SDK v5 stream.

@saikatsarkar056 saikatsarkar056 requested a review from a team as a code owner December 16, 2025 15:54
@saikatsarkar056 saikatsarkar056 marked this pull request as draft December 16, 2025 16:32
@saikatsarkar056 saikatsarkar056 self-assigned this Dec 16, 2025
@github-actions
Copy link
Contributor

🔍 Preview links for changed docs

Fix the issue related to token count
@saikatsarkar056 saikatsarkar056 added release_note:fix Team:Search backport:skip This PR does not require backporting v9.3.0 v9.4.0 backport:version Backport to applied version labels and removed backport:skip This PR does not require backporting labels Dec 16, 2025
@saikatsarkar056 saikatsarkar056 marked this pull request as ready for review December 16, 2025 22:35
@saikatsarkar056 saikatsarkar056 changed the title Fix the issue related to token count Dec 16, 2025
@saikatsarkar056 saikatsarkar056 changed the title [Bug][Playground] Fix the issue related to token count Dec 16, 2025
Copy link
Contributor

@TattdCodeMonkey TattdCodeMonkey left a comment

Choose a reason for hiding this comment

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

Nice, tests and code changes LGTM, didn't test locally.

Looks like the conversational chain tests also need to be updated to account for these changes though.

@saikatsarkar056
Copy link
Contributor Author

Nice, tests and code changes LGTM, didn't test locally.

Looks like the conversational chain tests also need to be updated to account for these changes though.

@TattdCodeMonkey Those test failures were caused by a previous commit. With the current changes, the conversational chain tests should pass. I’ll wait for the CI/CD pipeline to turn green.

@saikatsarkar056 saikatsarkar056 enabled auto-merge (squash) December 17, 2025 00:02
@saikatsarkar056 saikatsarkar056 merged commit 6eae531 into elastic:main Dec 17, 2025
17 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.4

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

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #19 / useSyntheticsRules dispatches enableDefaultAlertingSilentlyAction when canSave is true and popover opens

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
searchPlayground 244.1KB 244.1KB -9.0B

History

cc @saikatsarkar056

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
9.4 The branch "9.4" does not exist

Manual backport

To create the backport manually run:

node scripts/backport --pr 246589

Questions ?

Please refer to the Backport tool documentation

@TattdCodeMonkey
Copy link
Contributor

TattdCodeMonkey commented Dec 17, 2025

@saikatsarkar056 we should backport this to all the versions that the ai dep was backported too as well #244675

@saikatsarkar056
Copy link
Contributor Author

@saikatsarkar056 we should backport this to all the versions that the ai dep was backported too as well #244675

I will create the backport PRs.

@saikatsarkar056
Copy link
Contributor 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

@saikatsarkar056
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.1

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

Questions ?

Please refer to the Backport tool documentation

@saikatsarkar056
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.2

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

Questions ?

Please refer to the Backport tool documentation

saikatsarkar056 added a commit to saikatsarkar056/kibana that referenced this pull request Dec 17, 2025
)

## Summary

Fixes token count display showing "NaN / 200,000 tokens sent" in the
Search Playground after the AI SDK v5 upgrade.

The issue was on the client-side in `parseDataStream` (`api.ts`), where
`messageAnnotations` was being reset to `undefined` when a `text-start`
chunk was received. In AI SDK v5, annotations (including token counts)
are sent *before* the `text-start` chunk, so this reset was clearing the
already-collected token data. This PR removes that reset to preserve
annotations across the stream, ensuring token counts are correctly
attached to the final message and displayed in the UI.

### Before
<img width="865" height="502" alt="Screenshot 2025-12-16 at 10 39 42 AM"
src="https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c"
/>

### After
<img width="1008" height="519" alt="Screenshot 2025-12-16 at 9 56 13 AM"
src="https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b"
/>

### 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
- [x] [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
- [x] 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)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### 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.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

## Release note
Fixes token count display showing "NaN" in Search Playground by
preserving message annotations across the AI SDK v5 stream.

(cherry picked from commit 6eae531)
saikatsarkar056 added a commit to saikatsarkar056/kibana that referenced this pull request Dec 17, 2025
)

## Summary

Fixes token count display showing "NaN / 200,000 tokens sent" in the
Search Playground after the AI SDK v5 upgrade.

The issue was on the client-side in `parseDataStream` (`api.ts`), where
`messageAnnotations` was being reset to `undefined` when a `text-start`
chunk was received. In AI SDK v5, annotations (including token counts)
are sent *before* the `text-start` chunk, so this reset was clearing the
already-collected token data. This PR removes that reset to preserve
annotations across the stream, ensuring token counts are correctly
attached to the final message and displayed in the UI.

### Before
<img width="865" height="502" alt="Screenshot 2025-12-16 at 10 39 42 AM"
src="https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c"
/>

### After
<img width="1008" height="519" alt="Screenshot 2025-12-16 at 9 56 13 AM"
src="https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b"
/>

### 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
- [x] [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
- [x] 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)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### 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.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

## Release note
Fixes token count display showing "NaN" in Search Playground by
preserving message annotations across the AI SDK v5 stream.

(cherry picked from commit 6eae531)
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Dec 19, 2025
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @saikatsarkar056

saikatsarkar056 added a commit that referenced this pull request Dec 19, 2025
…) (#246766)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Search Playground] Fix the issue related to token count
(#246589)](#246589)

<!--- Backport version: 10.2.0 -->

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

<!--BACKPORT [{"author":{"name":"Saikat
Sarkar","email":"132922331+saikatsarkar056@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-17T00:27:12Z","message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Search","backport:version","v9.3.0","v9.4.0"],"title":"[Search
Playground] Fix the issue related to token
count","number":246589,"url":"https://github.com/elastic/kibana/pull/246589","mergeCommit":{"message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/246589","number":246589,"mergeCommit":{"message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f"}},{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"url":"https://github.com/elastic/kibana/pull/246764","number":246764,"branch":"8.19","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/246765","number":246765,"branch":"9.1","state":"OPEN"}]}]
BACKPORT-->
saikatsarkar056 added a commit that referenced this pull request Dec 19, 2025
…) (#246765)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Search Playground] Fix the issue related to token count
(#246589)](#246589)

<!--- Backport version: 10.2.0 -->

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

<!--BACKPORT [{"author":{"name":"Saikat
Sarkar","email":"132922331+saikatsarkar056@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-17T00:27:12Z","message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Search","backport:version","v9.3.0","v9.4.0"],"title":"[Search
Playground] Fix the issue related to token
count","number":246589,"url":"https://github.com/elastic/kibana/pull/246589","mergeCommit":{"message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/246589","number":246589,"mergeCommit":{"message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f"}},{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"url":"https://github.com/elastic/kibana/pull/246764","number":246764,"branch":"8.19","state":"OPEN"}]}]
BACKPORT-->
saikatsarkar056 added a commit that referenced this pull request Dec 19, 2025
) (#246764)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Search Playground] Fix the issue related to token count
(#246589)](#246589)

<!--- Backport version: 10.2.0 -->

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

<!--BACKPORT [{"author":{"name":"Saikat
Sarkar","email":"132922331+saikatsarkar056@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-12-17T00:27:12Z","message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Search","backport:version","v9.3.0","v9.4.0"],"title":"[Search
Playground] Fix the issue related to token
count","number":246589,"url":"https://github.com/elastic/kibana/pull/246589","mergeCommit":{"message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/246589","number":246589,"mergeCommit":{"message":"[Search
Playground] Fix the issue related to token count (#246589)\n\n##
Summary\n\nFixes token count display showing \"NaN / 200,000 tokens
sent\" in the\nSearch Playground after the AI SDK v5 upgrade.\n\nThe
issue was on the client-side in `parseDataStream` (`api.ts`),
where\n`messageAnnotations` was being reset to `undefined` when a
`text-start`\nchunk was received. In AI SDK v5, annotations (including
token counts)\nare sent *before* the `text-start` chunk, so this reset
was clearing the\nalready-collected token data. This PR removes that
reset to preserve\nannotations across the stream, ensuring token counts
are correctly\nattached to the final message and displayed in the
UI.\n\n\n### Before\n<img width=\"865\" height=\"502\" alt=\"Screenshot
2025-12-16 at 10 39
42 AM\"\nsrc=\"https://github.com/user-attachments/assets/331d3c7c-1b3e-455e-b8d7-561e2832054c\"\n/>\n\n\n###
After\n<img width=\"1008\" height=\"519\" alt=\"Screenshot 2025-12-16 at
9 56
13 AM\"\nsrc=\"https://github.com/user-attachments/assets/ec507093-e382-4320-b610-cc3d53a74c3b\"\n/>\n\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- [x] [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- [x] 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)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this
PR introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See
some
risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n-
[ ] ...\n\n\n## Release note\nFixes token count display showing \"NaN\"
in Search Playground by\npreserving message annotations across the AI
SDK v5
stream.","sha":"6eae531e0d82503feff37f1abebeb7d5b0e0907f"}},{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
@kibanamachine kibanamachine added v9.1.9 v8.19.9 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment