Skip to content

Agent session progress clean up#279703

Merged
osortega merged 6 commits intomainfrom
osortega/agent-session-progress-cleanup
Dec 3, 2025
Merged

Agent session progress clean up#279703
osortega merged 6 commits intomainfrom
osortega/agent-session-progress-cleanup

Conversation

@osortega
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 27, 2025 01:24
@osortega osortega self-assigned this Nov 27, 2025
@osortega osortega enabled auto-merge (squash) November 27, 2025 01:25
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 27, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the agent session progress cleanup logic in the chat sessions service. The main change replaces the extractFileNameFromLink method with a more comprehensive cleanUpProgress method that handles both file link cleanup and removal of markdown formatting (backticks). The refactoring also improves type safety by preserving the IMarkdownString type through the processing pipeline instead of converting to string immediately.

Key changes:

  • Replaced extractFileNameFromLink with cleanUpProgress that handles both file link cleanup and backtick removal
  • Updated getSessionDescription to preserve IMarkdownString | string | undefined types until final cleanup
  • Consolidated cleanup logic to run once at the end instead of multiple times during processing

mjbvz
mjbvz previously requested changes Nov 27, 2025
Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Let's see if it's possible to avoid having custom parsing logic

@vs-code-engineering
Copy link

vs-code-engineering bot commented Dec 3, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/base/browser/markdownRenderer.ts

@osortega osortega requested a review from mjbvz December 3, 2025 17:28
renderer.link = ({ text, href }: marked.Tokens.Link): string => {
if (href && href.startsWith('file://')) {
const fileName = href.split('/').pop() || href;
return text.trim() || fileName;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should use basename to get the file name

let renderer = plainTextRenderer.value;
if (options?.includeCodeBlocksFences) {
renderer = plainTextWithCodeBlocksRenderer.value;
} else if (options?.preserveFileLinks) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using the API it would be surprising you can't set both includeCodeBlocksFences and preserveFileLinks can be set. Can we make it so both can be enabled?

/** Controls if the ``` of code blocks should be preserved in the output or not */
readonly includeCodeBlocksFences?: boolean;
/** Controls if file:// links should be preserved as filenames in the output */
readonly preserveFileLinks?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of something so specific, could this be a linkFormatter that takes the text and href and returns the text to display? That way the caller can handle all the file uri / chat specific logic

@osortega osortega disabled auto-merge December 3, 2025 22:01
@osortega osortega dismissed mjbvz’s stale review December 3, 2025 23:17

Dismissing to be able to make it for next insiders

@osortega osortega merged commit c8adb26 into main Dec 3, 2025
28 checks passed
@osortega osortega deleted the osortega/agent-session-progress-cleanup branch December 3, 2025 23:17
? toolInvocation.confirmationMessages.title
: toolInvocation.confirmationMessages.title.value);
description = message ?? localize('chat.sessions.description.waitingForConfirmation', "Waiting for confirmation: {0}", description);
description = message ?? localize('chat.sessions.description.waitingForConfirmation', "Waiting for confirmation: {0}", typeof description === 'string' ? description : description.value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this use renderAsPlainText too? Or even better, preserve it as a markdown string if it starts as one?

if (options?.includeCodeBlocksFences) {
renderer.code = codeBlockFences;
}
if (options?.useLinkFormatter) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

useLinkFormatter still feels like an odd name to me. Could we try doing one of these (best to worst):

  1. Make whoever is generating the string generate a valid link in the first place
  2. Make the new link logic the default behavior so we don't need an option. That seems reasonable if there's no text
  3. Give the option a more clear name such as useHrefForLinks

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants