← Back to Pull requests

Center collapsed context usage with custom chat backgrounds #334192

Open
unknown opened this pull request with 247 lines diff across 3 files
View on GitHub
unknown unknown commented on Sep 03, 2026 07:20 UTC
Author

Fixes #334114

Summary

When a custom chat background is enabled in the Agents Window, the context-usage widget is rendered on an opaque compact surface. The percentage label collapses to zero width when idle, but the widget keeps its flex gap, shifting the usage ring to the left within the control.

This change:

  • removes the unused context-usage gap while the percentage label is collapsed;

  • restores the existing gap automatically on hover or keyboard focus when the percentage label becomes visible;

  • keeps chat surfaces without a custom background unchanged; and

  • adds geometry regression coverage plus a contract assertion for the focus guard.
  • The fix is scoped to the Agents Window session view with an active chat background. The latest main already centers icon-only picker actions through #334128, so that now-redundant part of the original PR was removed while resolving conflicts.

    Screenshots

    Before

    <img width="618" height="120" alt="Misaligned context usage ring before the fix" src="https://github.com/user-attachments/assets/92a4fde2-94d5-444f-be83-5c12d393fc40" />

    After

    <img width="998" height="356" alt="Centered context usage ring after the fix" src="https://github.com/user-attachments/assets/c5bf1741-140c-497b-91ef-a850174ba32a" />

    Verification

  • npm run transpile-client

  • ./scripts/test.sh --grep "keeps background-image composer controls opaque with centered context usage" - 1 passing

  • ./scripts/test.sh --run vs/sessions/contrib/chat/test/browser/chatView.test --grep "Sessions - Chat View" - 55 passing

  • npm run stylelint -- src/vs/sessions/contrib/chat/browser/media/chatView.css

  • npm run eslint -- src/vs/sessions/contrib/chat/test/browser/chatView.test.ts
  • Manually verified in a narrow Agents Window with a chat background enabled:

  • context-usage ring offset before: 2 px to the left

  • ring centered after the change

  • context percentage still expands normally when the control is hovered or focused
  • Diff: 247 lines (+185 / -62) across 3 files Reviewer: ktsoator Review duration: 52237m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.46) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 247 lines diff across 3 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.330
    Real PR Conversation Timeline
    1 comments
    "Review active on #334192"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.9% (MEDIUM) · Higher = larger blast radius
    45.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.4% · Safe to merge
    25.4%