Skip to content

Rearchitect background todo agent#320276

Draft
vritant24 wants to merge 14 commits into
mainfrom
vritant24-bgTodoRearch
Draft

Rearchitect background todo agent#320276
vritant24 wants to merge 14 commits into
mainfrom
vritant24-bgTodoRearch

Conversation

@vritant24
Copy link
Copy Markdown
Member

@vritant24 vritant24 commented Jun 7, 2026

  • Less complex implementation
  • simple exclusion of a set of Tools, others have their arguments trimmed to a limit of characters
  • every successive run of the BG Todo Agent runs after a longer wait. This means longer sessions have less frequent runs of the todo agent.
  • Once a turn ends in the conversation, the bg todo agent runs, and for a continuation, clears the existing todos.
  • previous turn tool calls are not carried, only the previous todos and their states are.

Copilot AI review requested due to automatic review settings June 7, 2026 04:45
@vritant24 vritant24 self-assigned this Jun 7, 2026
Copy link
Copy Markdown
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 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 new BackgroundTodoAgentProcessor that queues per-turn work and performs a final pass at turn end.
  • Introduced BackgroundTodoAgentSessionHistoryStore to 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
  • userRequest is typed as string | undefined and 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

Comment thread extensions/copilot/src/extension/intents/node/agentIntent.ts Outdated
Copy link
Copy Markdown
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.

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
  • userRequest is typed as optional but is rendered unconditionally. If it is ever unset, the prompt will literally contain undefined, 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

Comment thread extensions/copilot/src/extension/intents/node/agentIntent.ts
vritant24 and others added 7 commits June 6, 2026 22:53
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>
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.

2 participants