Rearchitect background todo agent#320276
Draft
vritant24 wants to merge 14 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR re-architects the Copilot extension’s background todo agent by removing the previous delta-tracker/state-machine implementation and replacing it with a queued, per-turn processor plus a dedicated turn-history store and updated prompt format.
Changes:
- Replaced the legacy
BackgroundTodoProcessor/delta tracker with a newBackgroundTodoAgentProcessorthat queues per-turn work and performs a final pass at turn end. - Introduced
BackgroundTodoAgentSessionHistoryStoreto accumulate and classify tool-call rounds and drive backoff readiness. - Updated todo prompt + intent wiring, and added a
clearCurrentTodoContext(...)API to reset the todo widget at the start of a turn.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/prompts/node/agent/backgroundTodoProcessor.ts | Deleted legacy background todo processor state machine, policy, prompt history rendering, and execution logic. |
| extensions/copilot/src/extension/prompts/node/agent/backgroundTodoDelta.ts | Deleted legacy delta tracker used to compute “new activity since last pass.” |
| extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/processor.ts | Added new queued background todo processor with progressive backoff and per-turn lifecycle (track rounds + endTurn final pass). |
| extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/historyStore.ts | Added per-turn tool-round tracking, filtering/classification, and “unprocessed substantive round” counting. |
| extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/backgroundTodoAgentPrompt.tsx | Updated prompt format and rendering to use the new history store and include previous-turn todos + a final-review note. |
| extensions/copilot/src/extension/prompt/node/todoListContextProvider.ts | Added clearCurrentTodoContext(...) to reset the todo list via the manage_todo_list tool. |
| extensions/copilot/src/extension/intents/node/agentIntent.ts | Wired the new processor into the main agent flow (track per render + run endTurn final pass). |
Copilot's findings
Comments suppressed due to low confidence (2)
extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/backgroundTodoAgentPrompt.tsx:197
- This comment says each chunk wraps the round in
<turn>tags, but the implementation now only emits a<round>block. This mismatch makes it harder to understand pruning/tag-balance expectations.
extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/backgroundTodoAgentPrompt.tsx:143 userRequestis typed asstring | undefinedand is rendered directly. If it’s ever undefined (e.g. unexpected call ordering), the prompt will literally include “undefined”, which can degrade tool-call behavior.
- Files reviewed: 7/7 changed files
- Comments generated: 6
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (3)
extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/backgroundTodoAgentPrompt.tsx:197
- This comment says each chunk wraps its round in
<turn>tags to keep tags balanced after pruning, but the implementation no longer emits<turn>wrappers (it only renders<round>). The comment is now misleading and should be updated to match the actual rendering strategy.
extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/backgroundTodoAgentPrompt.tsx:18 - The system message says the
<tool-calls>list includes a file-path/category target and optional intent note, but the renderer actually outputs "Tool Call Name:" + "Arguments:" lines (no extracted target/note). This mismatch can confuse the model and reduce tool-call parsing reliability.
extensions/copilot/src/extension/prompts/node/agent/backgroundTodoAgent/backgroundTodoAgentPrompt.tsx:143 userRequestis typed as optional but is rendered unconditionally. If it is ever unset, the prompt will literally containundefined, which is noise for the model and could affect behavior. Either make the prop required or guard the render.
- Files reviewed: 15/15 changed files
- Comments generated: 5
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Uh oh!
There was an error while loading. Please reload this page.