agentHost: render completed reasoning fallback - #332054
agentHost: render completed reasoning fallback#332054Silence (silence48) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds live fallback rendering for completed Copilot CLI reasoning when streaming deltas are unavailable.
Changes:
- Renders completed reasoning from reasoning events and message history fields.
- Ignores empty reasoning deltas and preserves subagent routing.
- Adds focused regression tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
copilotAgentSession.ts |
Implements completed-reasoning fallback behavior. |
copilotAgentSession.test.ts |
Covers fallback, deduplication, ordering, and routing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
57d0a74 to
d9d317b
Compare
|
@microsoft-github-policy-service agree I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts:1685
- The SDK's documented turn order is
assistant.reasoning_delta→assistant.reasoning→assistant.message, but the completed handler removes the reasoning ID from this map before the message arrives. The subsequent message therefore sees no streamed state and emitsreasoningTextagain, duplicating both streamed and completion-only reasoning in the normal event order. Keep prior rendered/completed reasoning state through the message boundary (and correlate it with the message fallback), then add a regression using the documented order.
const streamedSinceLastMessage = turn.pendingReasoningDeltaIds.get(reasoningScope);
turn.pendingReasoningDeltaIds.delete(reasoningScope);
turn.pendingMessageReasoningFallbacks.delete(reasoningScope);
if (!content || streamedSinceLastMessage?.size) {
Mohammad javad Dianat (dianatofficial)
left a comment
There was a problem hiding this comment.
Approved. The fix is minimal and correct.
Summary
assistant.reasoning_deltacreated a live reasoning partassistant.message.reasoningTextas the final fallback, matching restored-session behaviorFixes #332053
Why
The live Agent Host adapter already renders
assistant.reasoning_delta, but itsassistant.reasoninghandler only logs the completed text. Theassistant.messagehandler likewise treatsreasoningTextas history-only even though the restored-session mapper renders it. Providers or SDK paths that emit only the completed form therefore persist a readable summary that never appears live.The existing
reasoningPartIdsmap already tracks the current parent/subagent reasoning scope and is cleared at tool-call boundaries. This change uses that state as a fail-safe fallback gate instead of adding a parallel lifecycle tracker.Tests
Added focused regression coverage for:
assistant.message.reasoningTextfallback ordering before markdowngit diff --checkpasses. The full repository test suite is left to CI because this branch was prepared from a dependency-free sparse checkout.Related: #312559, #328146, #329873, #330279.
AI-assisted implementation and description.