Skip to content

agentHost: avoid Agent Merge git refresh loop - #333120

Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
benibenj/agents/log-analysis-error-fix-prioritization-a2448b7e
Aug 28, 2026
Merged

agentHost: avoid Agent Merge git refresh loop#333120
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
benibenj/agents/log-analysis-error-fix-prioritization-a2448b7e

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Summary

  • stop Agent Merge from scheduling another evaluation for Git state refreshes emitted by its current evaluation
  • prevent repeated subscribed-changeset recomputation and Git diff timeouts on idle monitored sessions
  • add a regression test for the self-triggering refresh cycle

Root cause

attachSessionGitHubPullRequest refreshes Git state during every Agent Merge evaluation. The controller handled that refresh notification as external work and immediately scheduled another evaluation, producing a stable loop at the Git refresh throttle interval.

Testing

  • npm run compile
  • npm run eslint -- src\vs\platform\agentHost\node\agentMergeController.ts src\vs\platform\agentHost\test\node\agentMergeController.test.ts
  • .\scripts\test.bat --run src\vs\platform\agentHost\test\node\agentMergeController.test.ts (13 passing)

npm run hygiene was also attempted, but the task failed before source checks because its Windows URL path handling resolved the repository as C:\C:\Code\.... Targeted ESLint and git diff --check pass.

Ignore Git state refresh notifications emitted while the same Agent Merge evaluation is active so an idle monitored session does not continuously reevaluate and recompute its changesets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​vs/​platform/​agentHost/​node/​agentMergeController.ts — This drops every Git-state refresh for the session while an evaluation is in flight, not just the…
What changed in this PR

Prevents Agent Merge evaluations from looping on their own Git-state refresh notifications.

Changes:

  • Tracks sessions with active evaluations and suppresses refresh-triggered rescheduling.
  • Adds a regression test for the refresh cycle.
File Description
agentMergeController.ts Guards evaluation scheduling during Git refreshes.
agentMergeController.test.ts Tests self-trigger suppression.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/platform/agentHost/node/agentMergeController.ts
Pass the newly required Git service dependency to the refresh-loop regression test so the PR's synthetic merge compiles against current main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit 404ed7d into main Aug 28, 2026
54 of 55 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/agents/log-analysis-error-fix-prioritization-a2448b7e branch August 28, 2026 09:29
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 28, 2026
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.

3 participants