Conversation
…assistant container variant conditions
… for aborted assistant errors
There was a problem hiding this comment.
Pull request overview
This PR updates the webview’s session/thread rendering and provider-limit polling/visibility logic, while also adding targeted performance improvements (virtualization rebuilds, sanitization caching) and enhancing Anthropic provider-limit status aggregation.
Changes:
- Scope message rendering and sticky-preview behavior to the active session thread (including special handling for child/subagent sessions) and refine assistant final-answer highlighting behavior.
- Adjust provider-limit defaults/threshold behavior (default threshold → 100%) and refine polling behavior based on whether the active session thread is “working”.
- Add caching/partial-rebuild optimizations in the webview (virtualization metrics reuse, HTML sanitization cache) and merge Anthropic limit windows across sources.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webview/perf/session-effects.perf.test.ts | Updates perf-guard deps for renamed active-session predicate. |
| src/webview/lib/state.ts | Adds messageInfoVersion, refines message-index callbacks, adjusts session marker writes, permission inheritance lookup, and per-session preference persistence. |
| src/webview/lib/state-helpers.test.ts | Adds tests for permission-mode inheritance and updates provider-limit default threshold assertion. |
| src/webview/lib/message-index.ts | Introduces split callbacks (onInvalidate vs onPartChange) and legacy API compatibility. |
| src/webview/lib/message-index.test.ts | Adds coverage for split-callback behavior and retains legacy single-callback test. |
| src/webview/lib/format.ts | Treats 100% threshold as “show any available limit”. |
| src/webview/lib/format.test.ts | Adds test for 100% threshold behavior. |
| src/webview/index.css | Moves/adjusts overflow-anchor: none to reduce scroll anchoring issues. |
| src/webview/hooks/session/session-effects.ts | Renames hasActiveSessions → isActiveSessionWorking and updates polling interval selection. |
| src/webview/hooks/session-effects.test.ts | Updates tests for renamed dependency and working-session polling behavior. |
| src/webview/hooks/runtime/open-code-runtime-instance.ts | Computes “active session working” across the active session’s tree (root + descendants). |
| src/webview/components/MessageList.tsx | Adds thread-scoped message filtering, introduces messageInfoVersion usage, and optimizes virtualization metrics recomputation. |
| src/webview/components/MessageList.test.ts | Adds tests for session scoping and aborted assistant final-answer formatting behavior. |
| src/webview/components/message/AssistantMessageContent.tsx | Adjusts final-answer container variant logic when structured parts/subagent content is present. |
| src/webview/components/Message.test.ts | Adds regression tests for container variant and final-answer rendering in mixed tool/text cases. |
| src/webview/components/message-list/virtualization.ts | Adds partial rebuild support using cached metrics + dirty index hints. |
| src/webview/components/message-list/sticky-preview.ts | Skips child-session prompts in sticky preview/top map logic. |
| src/webview/components/message-list/MessageRows.tsx | Prevents highlighting final answers for aborted assistant turns. |
| src/webview/components/MarkdownRenderer.tsx | Adds a bounded cache for sanitized HTML output and resets it in test helper. |
| src/webview/components/MarkdownRenderer.test.ts | Updates test to assert sanitization reuse across remounts. |
| src/shared/provider-limit-config.ts | Changes default provider-limit threshold percent from 40 → 100. |
| src/extension/provider-limits/adapters/anthropic.ts | Merges statusline/local-proxy/OAuth statuses and windows; adds helper merge logic. |
| src/extension/provider-limits/adapters/anthropic.test.ts | Adds test for merged statusline + OAuth windows behavior. |
| package.json | Bumps version and updates config default/description for provider-limit threshold. |
| docs/usage.md | Updates provider-limit threshold docs to match new semantics/default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
371
to
+465
| @@ -428,6 +451,18 @@ export function MessageList() { | |||
|
|
|||
| const measuredHeights = new Map<string, number>(); | |||
| let lastTrackHeight = 0; | |||
| let cachedVirtualMetrics: VirtualMetrics | null = null; | |||
| let cachedVirtualMetricsItemIds: string[] | null = null; | |||
| let dirtyVirtualMetricsFromIndex = Number.POSITIVE_INFINITY; | |||
|
|
|||
| function markVirtualMetricsDirty(messageId: string) { | |||
| if (dirtyVirtualMetricsFromIndex === 0) return; | |||
| const index = messageIndexById().get(messageId); | |||
| if (typeof index !== 'number') return; | |||
| if (index < dirtyVirtualMetricsFromIndex) { | |||
| dirtyVirtualMetricsFromIndex = index; | |||
| } | |||
| } | |||
Comment on lines
22
to
35
| for (let i = firstVisibleMessageIndex; i >= 0; i--) { | ||
| const entry = messages[i]; | ||
| if (!entry) continue; | ||
| if (entry.info.role !== 'user') continue; | ||
| const session = entry.info.sessionID; | ||
| const isChildSessionPrompt = messages.some( | ||
| (candidate) => | ||
| candidate.info.sessionID === session && | ||
| candidate.info.role === 'assistant' && | ||
| 'mode' in candidate.info && | ||
| candidate.info.mode === 'subagent' | ||
| ); | ||
| if (isChildSessionPrompt) continue; | ||
| const text = getUserMessagePreviewText(entry.parts); |
Comment on lines
54
to
+68
| for (let index = messages.length - 1; index >= 0; index -= 1) { | ||
| const entry = messages[index]; | ||
| result.set(entry.info.id, nextVisibleUserMessageTop); | ||
| if (entry.info.role !== 'user') continue; | ||
|
|
||
| const session = entry.info.sessionID; | ||
| const isChildSessionPrompt = messages.some( | ||
| (candidate) => | ||
| candidate.info.sessionID === session && | ||
| candidate.info.role === 'assistant' && | ||
| 'mode' in candidate.info && | ||
| candidate.info.mode === 'subagent' | ||
| ); | ||
| if (isChildSessionPrompt) continue; | ||
|
|
Comment on lines
+206
to
+216
| if (primary.status !== 'available') return secondary; | ||
| if (secondary.status !== 'available') return primary; | ||
|
|
||
| const windows = mergeAnthropicWindows(primary.windows, secondary.windows); | ||
| const note = [primary.note, secondary.note].filter(Boolean).join(' + ') || undefined; | ||
| return { | ||
| ...primary, | ||
| checkedAt: Math.max(primary.checkedAt, secondary.checkedAt), | ||
| windows, | ||
| ...(note ? { note } : {}), | ||
| }; |
| sanitizeHtmlCache.set(html, result); | ||
| if (sanitizeHtmlCache.size > SANITIZE_CACHE_LIMIT) { | ||
| const oldest = sanitizeHtmlCache.keys().next().value; | ||
| if (oldest) sanitizeHtmlCache.delete(oldest); |
Comment on lines
+189
to
+203
| function shouldHideThreadMessage( | ||
| entry: { info: Message; parts: Part[] }, | ||
| activeSessionId: string | null | ||
| ) { | ||
| if (!activeSessionId) return false; | ||
|
|
||
| const activeTreeIds = new Set(getSessionTreeIds(activeSessionId)); | ||
| if (!activeTreeIds.has(entry.info.sessionID)) return true; | ||
|
|
||
| if (entry.info.role !== 'user') return false; | ||
| if (entry.info.sessionID === activeSessionId) return false; | ||
|
|
||
| const session = state.sessions.find((item) => item.id === entry.info.sessionID); | ||
| return !!session?.parentID; | ||
| } |
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.
No description provided.