Skip to content

Conversation

@NriotHrreion
Copy link
Contributor

@NriotHrreion NriotHrreion commented Dec 11, 2025

fix #282498

Cause

#282498 (comment)

Change

I added an option storeToHistory to the interface IChatAcceptInputOptions, and set it to true in SendToNewChatAction.run(). In this way, even if the message to be sent to new chat session is automatically inputted by the system, it will be stored into the history as expected.

Copilot AI review requested due to automatic review settings December 11, 2025 05:55
@NriotHrreion NriotHrreion changed the title fix: Chat input history stack position is not reset after starting a new chat fix: Latest input is not stored to the history when sending message to a new chat Dec 11, 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 fixes an issue where the chat input history stack position was not being reset after starting a new chat session using the "Send to New Chat" action (Ctrl+Shift+Enter). The root cause was that when the input text was programmatically re-submitted to a cleared chat session, it wasn't being stored in the history, which prevented the history cursor from resetting to the end position.

Key Changes

  • Added forceStoreToHistory option to IChatAcceptInputOptions interface to allow forcing input storage in history
  • Modified the history storage logic to honor this new option even for programmatic queries
  • Updated SendToNewChatAction to use this option when re-submitting input to a new chat session

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/contrib/chat/browser/chat.ts Added optional forceStoreToHistory property to IChatAcceptInputOptions interface
src/vs/workbench/contrib/chat/browser/chatWidget.ts Updated _acceptInput to check forceStoreToHistory option when determining whether to store input in history
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts Modified SendToNewChatAction to pass forceStoreToHistory: true when re-submitting input to new chat

The fix is well-targeted and follows the existing pattern. The ChatHistoryNavigator.append() method (lines 240-247 in chatWidgetHistoryService.ts) resets _currentIndex to the end of history, which solves the reported issue. The changes are minimal and don't affect other parts of the codebase.

Copy link
Member

@connor4312 connor4312 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 diagnosis and the PR! Couple quick tweaks docs + suggested property naming

@connor4312 connor4312 enabled auto-merge (squash) December 12, 2025 17:35
connor4312
connor4312 previously approved these changes Dec 12, 2025
Copy link
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

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

thanks!

@vs-code-engineering vs-code-engineering bot added this to the December / January 2026 milestone Dec 12, 2025
@connor4312
Copy link
Member

Looks like a formatting failure:


[hygiene                  ] src/vs/workbench/contrib/chat/browser/chatWidget.ts(2337,1): Bad whitespace indentation
[hygiene                  ] File not formatted. Run the 'Format Document' command to fix it: src/vs/workbench/contrib/chat/browser/chatWidget.ts

mjbvz
mjbvz previously approved these changes Dec 12, 2025
auto-merge was automatically disabled December 12, 2025 23:20

Head branch was pushed to by a user without write access

@NriotHrreion NriotHrreion dismissed stale reviews from mjbvz and connor4312 via 0c63294 December 12, 2025 23:20
@connor4312
Copy link
Member

Hm, looks like one still remains

[hygiene                  ] src/vs/workbench/contrib/chat/browser/chatWidget.ts(2338,1): Bad whitespace indentation
[hygiene                  ] File not formatted. Run the 'Format Document' command to fix it: src/vs/workbench/contrib/chat/browser/chatWidget.ts

if you open the file in vscode you should be able to ctrl+shift+p > Format Document to apply formatting

@NriotHrreion
Copy link
Contributor Author

It should be ok now

@connor4312 connor4312 enabled auto-merge December 13, 2025 17:37
Copy link
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

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

thanks!

@connor4312 connor4312 merged commit 0cebd59 into microsoft:main Dec 13, 2025
17 checks passed
@NriotHrreion NriotHrreion deleted the fix-282498 branch December 14, 2025 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat input history stack position is not reset after starting a new chat

4 participants