Skip to content

Trace UI - Update session ID pills to link to the chat session and scroll to the turn corresponding turn#18985

Merged
dbczumar merged 6 commits intomlflow:masterfrom
dbczumar:session_id_linkable
Nov 24, 2025
Merged

Trace UI - Update session ID pills to link to the chat session and scroll to the turn corresponding turn#18985
dbczumar merged 6 commits intomlflow:masterfrom
dbczumar:session_id_linkable

Conversation

@dbczumar
Copy link
Collaborator

@dbczumar dbczumar commented Nov 24, 2025

🛠 DevTools 🛠

Open in GitHub Codespaces

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/18985/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/18985/merge#subdirectory=libs/skinny

For Databricks, use the following command:

%sh curl -LsSf https://raw.githubusercontent.com/mlflow/mlflow/HEAD/dev/install-skinny.sh | sh -s pull/18985/merge

Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Trace UI - Update session ID pills to link to the chat session and scroll to the turn corresponding turn

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
@github-actions github-actions bot added v3.6.1 area/uiux Front-end, user experience, plotting, JavaScript, JavaScript dev server rn/none List under Small Changes in Changelogs. labels Nov 24, 2025
Comment on lines -35 to -37
export const shouldEnableChatSessionsTab = () => {
return false;
};
Copy link
Collaborator Author

@dbczumar dbczumar Nov 24, 2025

Choose a reason for hiding this comment

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

Seems like this was a bug / problem with the Databricks -> MLflow UI sync. As a result of this returning false, the session ID link in the traces table was broken

};

export const shouldEnableChatSessionsTab = () => {
return false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Similar bug in Databricks -> MLflow UI sync

Signed-off-by: dbczumar <corey.zumar@databricks.com>
Comment on lines -158 to -160
export const shouldEnableChatSessionsTab = () => {
return true;
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't believe we need these flags / gates for "should enable chat session" anymore. Looks like they had some unintended consequences - https://github.com/mlflow/mlflow/pull/18985/files#r2554699617.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm guessing it's fine if we remove the flag from databricks as well given it's fully released anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah :)

Comment on lines +53 to +75
<Tooltip
componentId="mlflow.chat-sessions.copy-session-id"
content={
showCopyTooltip ? (
<FormattedMessage defaultMessage="Copied!" description="Tooltip after copying session ID" />
) : (
<FormattedMessage defaultMessage="Copy session ID" description="Tooltip for copy session ID button" />
)
}
open={showCopyTooltip ? true : undefined}
>
<CopyIcon
onClick={handleCopySessionId}
css={{
cursor: 'pointer',
color: theme.colors.textSecondary,
fontSize: 16,
'&:hover': {
color: theme.colors.textPrimary,
},
}}
/>
</Tooltip>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

While we're here, add a copy button for session ID to the chat sessions UI:

Screenshot 2025-11-23 at 9 51 21 PM

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's reuse <CopyActionButton> for this! import from @databricks/web-shared/copy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Awesome - reused!

return <div />;
}
useEffect(() => {
if (selectedTraceIdFromUrl && traces && traces.length > 0 && !isLoadingTraceDatas) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if all of these conditions are needed... @daniellok-db , can you advise?

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think they are needed because if the traces aren't loaded there won't be anything to scroll to. plus we are using the traces array and searching through to find the selected trace so it makes sense to require them to be defined / contentful

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it - thanks! :)

Signed-off-by: dbczumar <corey.zumar@databricks.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

Documentation preview for f0b0c01 is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

}: {
sessionId: string;
experimentId: string;
traceId?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

would this ever be null? this is rendered in the trace table so i suppose a trace would have to exist

Suggested change
traceId?: string;
traceId: string;

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah... i see the typescript types are kind of messed up in the trace table. i guess it's fine to leave it like this then

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks - yeah, I think this can probably be addressed in our upcoming trace table refactor?

Comment on lines +15 to +19
const url = traceId
? `${MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId)}?selectedTraceId=${encodeURIComponent(
traceId,
)}`
: MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

related to above can we use URLSearchParams and get rid of the ternary if traceId doesn't have to be nullable? also nit: maybe define and export a const for selectedTraceId so it can be imported and used in the sessions tab as well.

Suggested change
const url = traceId
? `${MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId)}?selectedTraceId=${encodeURIComponent(
traceId,
)}`
: MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId);
const searchParams = new URLSearchParams({ selectedTraceId: traceId } );
const url = `${MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId)}?${searchParams.toString()}`

Copy link
Collaborator

Choose a reason for hiding this comment

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

just saw that it's nullable to satisfy typescript. i think it's fine to keep the ternary then but let's still use URLSearchParams rather than calling encodeURIComponent. they are effectively the same but URLSearchParams is more canonical

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Totally - done!

content={<FormattedMessage defaultMessage="View chat session" description="Tooltip for the session id tag" />}
>
<Link to={getExperimentChatSessionPageRoute(experimentId, sessionId)} target="_blank" rel="noopener noreferrer">
<Link to={sessionPageUrl}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

was it intentional to remove the open in new tab behavior? i imagine it might be useful to default to new tab if the user is browsing through the trace and wants to view the session later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just personal preference - I found it a bit confusing that the session always opened in a new tab, whereas other links in the MLflow UI don't create new tabs. If the dev wants a new tab, they can command + click

Copy link
Collaborator

@daniellok-db daniellok-db left a comment

Choose a reason for hiding this comment

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

overall LGTM but let's address the comments before merge

@@ -0,0 +1,58 @@
import { render, screen } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { MemoryRouter } from 'react-router-dom';
Copy link
Collaborator

Choose a reason for hiding this comment

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

use TestRouter from here:

export const TestRouter = ({ routes, history, initialEntries }: TestRouterProps) => {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Awesome - done :)

Signed-off-by: dbczumar <corey.zumar@databricks.com>
Copy link
Collaborator Author

@dbczumar dbczumar left a comment

Choose a reason for hiding this comment

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

Thanks for the review, @daniellok-db :). Will merge when tests pass

Comment on lines +53 to +75
<Tooltip
componentId="mlflow.chat-sessions.copy-session-id"
content={
showCopyTooltip ? (
<FormattedMessage defaultMessage="Copied!" description="Tooltip after copying session ID" />
) : (
<FormattedMessage defaultMessage="Copy session ID" description="Tooltip for copy session ID button" />
)
}
open={showCopyTooltip ? true : undefined}
>
<CopyIcon
onClick={handleCopySessionId}
css={{
cursor: 'pointer',
color: theme.colors.textSecondary,
fontSize: 16,
'&:hover': {
color: theme.colors.textPrimary,
},
}}
/>
</Tooltip>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Awesome - reused!

@@ -0,0 +1,58 @@
import { render, screen } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { MemoryRouter } from 'react-router-dom';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Awesome - done :)

}: {
sessionId: string;
experimentId: string;
traceId?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks - yeah, I think this can probably be addressed in our upcoming trace table refactor?

Comment on lines +15 to +19
const url = traceId
? `${MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId)}?selectedTraceId=${encodeURIComponent(
traceId,
)}`
: MlflowUtils.getExperimentChatSessionPageRoute(experimentId, sessionId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Totally - done!

content={<FormattedMessage defaultMessage="View chat session" description="Tooltip for the session id tag" />}
>
<Link to={getExperimentChatSessionPageRoute(experimentId, sessionId)} target="_blank" rel="noopener noreferrer">
<Link to={sessionPageUrl}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just personal preference - I found it a bit confusing that the session always opened in a new tab, whereas other links in the MLflow UI don't create new tabs. If the dev wants a new tab, they can command + click

return <div />;
}
useEffect(() => {
if (selectedTraceIdFromUrl && traces && traces.length > 0 && !isLoadingTraceDatas) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got it - thanks! :)

Signed-off-by: dbczumar <corey.zumar@databricks.com>
@dbczumar dbczumar enabled auto-merge November 24, 2025 15:53
@dbczumar dbczumar disabled auto-merge November 24, 2025 16:53
@dbczumar dbczumar merged commit d602f20 into mlflow:master Nov 24, 2025
49 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/uiux Front-end, user experience, plotting, JavaScript, JavaScript dev server rn/none List under Small Changes in Changelogs. v3.6.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants