Implement intelligent chat history cutoff for remote agent job creation #265604
+248
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the TODO comment in
CreateRemoteAgentJobAction
by implementing a smart history cutoff mechanism that determines when to stop including earlier chat history when delegating to remote coding agents.Problem
Previously, all chat requests in a session were included when creating remote agent jobs, which could:
Solution
Implemented an intelligent cutoff system with three strategies:
1. Coding Agent Delegation Detection
When a previous delegation to a coding agent is found, the history starts from that conversation point. Detection works by identifying:
2. Configurable Maximum Limit
Added new setting
chat.maxHistoryEntriesForRemoteAgent
(default: 20, range: 1-100) that limits history when no previous coding agent delegation is detected.3. No Cutoff for Small Histories
When chat history is within the configured limit and no coding agent is found, all entries are preserved.
Example Behavior
Additional Features
The implementation prioritizes relevant recent context while giving users control over history limits, improving both performance and task focus for remote coding agent delegations.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
electronjs.org
node-gyp
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Created from VS Code via the GitHub Pull Request extension.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.