agentHost: release edit timing correlations when turns end - #335585
agentHost: release edit timing correlations when turns end#335585Aaron Munger (amunger) wants to merge 3 commits into
Conversation
Release completed-turn SDK and interaction IDs instead of retaining them for the lifetime of a Copilot session. Keep steering and late-event routing safe through turn-owned correlation sets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Stale SDK turn IDs must be invalidated on host-turn teardown before approval.
Review tier: Lite
Findings: None
What changed in this PR
This pull request moves SDK turn and interaction correlations onto active CopilotTurn instances and releases them when host turns end.
Changes:
- Adds per-turn correlation storage and cleanup.
- Updates steering and late-event routing.
- Adds regression coverage for lifecycle cleanup and delayed events.
A moderate issue remains: teardown paths can leave a stale SDK turn ID that is copied during later steering promotion, misrouting a delayed model-call event.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts |
Tests cleanup, steering, and delayed-event behavior. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Implements per-turn correlation storage, cleanup, steering transfer, and routing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep steering from inheriting an SDK turn ID left behind by an earlier completed, failed, aborted, discarded, or replaced host turn. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed the review's stale SDK-turn concern in 478aaf6. The active SDK-turn ID now belongs to All five regression cases failed before this fix and pass afterward. The three targeted unit suites now pass 716 tests; the two subagent scenarios that failed in macOS CI also pass locally with runtime 1.0.84-4. The macOS failure's root cause remains unconfirmed; no subagent lifecycle changes, timeout increases, or weakened assertions were made to mask it. [comment authored by copilot] |
Screenshot ChangesBase: Changed (11)2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details. |
What and why
Stop long-lived Copilot sessions from retaining the SDK turn and interaction IDs of every completed host turn. This follows up on the performance review comment on #331983.
Previously, these string-to-string correlations remained in session-level maps after their host turn ended. They now belong to the active
CopilotTurnand are cleared on disposal, covering completion, cancellation, failure, discard, replacement, and session teardown without scanning historical entries.Routing behavior
A delayed model-call event for a completed turn is now dropped by the provider rather than forwarded with the old turn ID for downstream rejection. An unknown interaction ID never falls back to a reused SDK turn ID. Steering transfers the active SDK-turn association to the promoted turn, and SDK
assistant.turn_endalone does not expire correlations while the host turn is still active.Regression coverage checks retained-key counts over repeated turns, terminal paths, steering telemetry, and late-event routing. This addresses unnecessary ID retention; it does not claim a measured user-visible performance improvement.