Skip to content

chat: wrap batch image previews with stable row heights - #342116

Merged
Justin Chen (justschen) merged 4 commits into
mainfrom
justinq/image-watermark-settings
Oct 18, 2026
Merged

Justin Chen (justschen) merged 4 commits into
mainfrom
justinq/image-watermark-settings

Conversation

@justschen

@justschen Justin Chen (justschen) commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Replace the scrolling thumbnail strip for batched image-generation results in chat with a wrapping, aspect-aware grid. The final feature diff contains only the batch renderer, its CSS, renderer tests, and generated-image fixtures.

  • Keep the selected main image above responsive rows of at most five thumbnails. There is no internal thumbnail scrollbar; the normal chat transcript can still scroll.
  • Reserve row height for the available width before results arrive. Portrait images become narrower instead of increasing row height, stretching, cropping, or adding padded bars inside their tiles. Unused width remains at row ends.
  • Cap row height at 144 CSS pixels and reserve room for 3:2 landscape output. Unusually wide images shrink proportionally within that reservation instead of overflowing.
  • Preserve pending/error/cancelled slots, selection, tool details, approval controls, and status announcements. Add up/down row navigation alongside left/right and Home/End navigation, preserving focus when resizing moves thumbnails.
  • Scope this change to batched image generation. Single-image results, ordinary attachments, and the separate image-preview editor are unchanged.
  • Add mixed-aspect, narrow, in-progress, and step-by-step loading Component Explorer fixtures. Complete Next Image advances the synthetic batch one result at a time.

Runtime dependency

No new runtime version, Agent Host setting, or SDK option is required for this layout change; it uses the existing batch-result contract.

The watermark setting has been removed from this PR and moved into #342229 alongside the image-model dropdown. This grid PR is independent of that PR's pending runtime release/version-bump requirements.

The branch retains the previously validated main baseline 661e013024d, including its image-rendering performance fixes. The approved four grid files are byte-identical to the previous rebased implementation; the split preserves published history without a force push.

Validation

Commands ran from the grid worktree after removing watermark wiring and restoring the validated main baseline:

  • npm run build-fast -- --client-only — passed.

  • npm run typecheck-client — passed.

  • git diff --cached --check — passed before the final commit.

  • Final four-file hygiene — passed:

    npm run precommit -- \
      src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatImageGenerationBatchPart.ts \
      src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatImageGenerationBatchPart.css \
      src/vs/workbench/contrib/chat/test/browser/widget/chatListRenderer.test.ts \
      src/vs/workbench/test/browser/componentFixtures/chat/chatGeneratedImages.fixture.ts
  • TypeScript and CSS lint — both passed:

    npm run eslint -- \
      src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatImageGenerationBatchPart.ts \
      src/vs/workbench/contrib/chat/test/browser/widget/chatListRenderer.test.ts \
      src/vs/workbench/test/browser/componentFixtures/chat/chatGeneratedImages.fixture.ts
    npm run stylelint -- \
      src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatImageGenerationBatchPart.css
  • Baseline Agent Host and full chat-renderer suites — 3,048 passing, two existing pending:

    env -u COPILOT_HOME -u COPILOT_RUNTIME_PROVIDER_LIB ./scripts/test.sh \
      --run vs/platform/agentHost/test/common/copilotCliConfig.test \
      --run vs/platform/agentHost/test/node/copilotAgentSession.test \
      --run vs/platform/agentHost/test/node/copilotSessionLauncher.test \
      --run vs/platform/agentHost/test/node/copilotAgent.test \
      --run vs/platform/agentHost/test/common/agentHostConfigurationSync.test \
      --run vs/workbench/contrib/chat/test/browser/widget/chatListRenderer.test
  • Existing grid regression fails without the implementation and passes with it. Coverage includes less than one CSS pixel of row-height drift during sequential image completion at 360, 760, and 1,000-pixel container widths, natural tile aspect ratios, no internal overflow, wrapping, and keyboard focus.

  • Scripted Component Explorer validation of the unchanged grid completed ten mixed-size images with zero row-height drift and no overflow. After the split, the preview was reloaded and again showed two rows of five thumbnails with no overflow or error overlay.

Automated checks use synthetic images and make no live image-generation requests.

Manual testing

  1. Generate multiple images in one chat batch, mixing square, portrait, and landscape outputs.
  2. Verify one selected main preview above wrapping rows with no more than five thumbnails each.
  3. Let results arrive individually. Row heights should remain steady; portrait tiles should be narrower, with spare space outside the tiles rather than padded bars inside them.
  4. Resize the chat and use Left/Right/Up/Down/Home/End to navigate. Selection, focus, and associated tool details should remain correct.
  5. Check pending, failed, and cancelled results, and confirm that single-image results and the separate image-preview editor have not changed.
  6. For a no-network mock, open the generated-image BatchGridLoading fixture in Component Explorer and use Complete Next Image; also inspect BatchGrid and BatchGridNarrow.

Add a default-off user setting and mirror it to Copilot Agent Host sessions on create, resume, and acknowledged live updates without changing image-generation consent.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 17:01

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.

🔵 Needs a closer look

Companion-runtime availability and end-to-end image-generation acceptance remain unvalidated.

0 open findings

What changed in this PR

Adds an opt-in image watermark preference to Copilot’s Agent Host sessions, independent of image-generation consent.

Changes:

  • Registers a default-off, application-scoped setting with best-effort labeling guidance.
  • Passes the preference during create/resume and synchronizes live changes through acknowledged updates.
  • Adds coverage for defaults, launch reconciliation, and failed-update recovery.

No actionable findings remain.

File Description
src/​vs/​workbench/​contrib/​chat/​browser/​chat.shared.contribution.ts Registers and mirrors the setting.
src/​vs/​platform/​agentHost/​test/​node/​copilotSessionLauncher.test.ts Covers create/resume preference combinations.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests live updates, launch changes, and recovery.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Updates launch-option expectations.
src/​vs/​platform/​agentHost/​test/​common/​copilotCliConfig.test.ts Verifies schema defaults.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionWrapper.ts Records launch-time watermark state.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotSessionLauncher.ts Supplies watermark options to the SDK.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Synchronizes watermark changes with runtime acknowledgment.
src/​vs/​platform/​agentHost/​common/​copilotCliConfig.ts Defines the preference and description.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 09d2db6c Current: 0308eb80

Changed (3)

chat/generatedImages/chatGeneratedImages/SeparateBatches/Light
Before After
before after
chat/generatedImages/chatGeneratedImages/SeparateBatchesInProgress/Light
Before After
before after
chat/generatedImages/chatGeneratedImages/CompletedAfterFailure/Light
Before After
before after

Added (4)

chat/generatedImages/chatGeneratedImages/BatchGrid/Light

current

chat/generatedImages/chatGeneratedImages/BatchGridNarrow/Light

current

chat/generatedImages/chatGeneratedImages/BatchGridInProgress/Light

current

chat/generatedImages/chatGeneratedImages/BatchGridLoading/Light

current

Keep the selected main image above responsive thumbnail rows with at most five items. Reserve row height while mixed-size images arrive, preserve each tile's natural proportions, and leave unused width outside the tiles rather than cropping or adding bars.

Preserve selection and focus, add vertical keyboard navigation, and cover progressive loading with renderer tests and Component Explorer fixtures.

Co-authored-by: Copilot <[email protected]>
@justschen Justin Chen (justschen) changed the title chat: expose opt-in image watermark setting chat: add image watermark setting and wrapping batch previews Oct 16, 2026
Keep this branch focused on the batched image preview grid. Move the independent watermark preference and its create, resume, and live-update coverage to #342229.

Co-authored-by: Copilot <[email protected]>
Keep the already-validated VS Code main baseline and its image rendering performance fixes while preserving the published PR history. The final feature diff contains only the four batch-grid files; watermark settings now live in #342229.

Co-authored-by: Copilot <[email protected]>
Justin Chen (justschen) added a commit that referenced this pull request Oct 18, 2026
Move the independent watermark setting from #342116 into the image settings PR. Keep the model dropdown and legacy profile migration intact, and register the watermark next to them with its existing default-off semantics.

Preserve create, resume, and acknowledged live-update wiring and regression coverage. Add a configuration regression for the relocated setting.

Co-authored-by: Copilot <[email protected]>
@justschen Justin Chen (justschen) changed the title chat: add image watermark setting and wrapping batch previews chat: wrap batch image previews with stable row heights Oct 18, 2026
@justschen
Justin Chen (justschen) marked this pull request as ready for review October 18, 2026 03:23
@justschen
Justin Chen (justschen) enabled auto-merge (squash) October 18, 2026 03:23
@justschen
Justin Chen (justschen) merged commit df835a7 into main Oct 18, 2026
49 checks passed
@justschen
Justin Chen (justschen) deleted the justinq/image-watermark-settings branch October 18, 2026 04:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 18, 2026
Justin Chen (justschen) added a commit that referenced this pull request Oct 21, 2026
…ed image paths (#342229)

* chat: pick the image generation model from a dropdown

The Copilot runtime now serves GPT Image 2.5 Flare instead of GPT Image
2.5 Sunburst (github/copilot-agent-runtime#27192), at unchanged rates.
Replace the chat.copilot.imageGeneration.enabled boolean with a
chat.copilot.imageGeneration.model dropdown offering Off and GPT Image
2.5 Flare. Each model's option lists its rates in its markdown
description, so the Settings dropdown and settings.json completions
show the cost of the model being chosen.

The runtime serves one image model and its SDK session options take no
model, so the dropdown still mirrors the boolean imageGeneration root
key, and older and remote Agent Hosts need no change. Only a listed
model turns the key on. Off, retired models such as
gpt-image-2.5-sunburst, and any other value turn it off, because the
mirror checks only the setting's type and an unknown string must not
enable whatever model the runtime serves. The host key's description
no longer names a model: it is published to AHP clients and cannot
know which model the runtime serves.

The legacy boolean migrates to the dropdown (true to Flare, false to
Off) unless the new setting is already set, and is always removed.
Defaults are unchanged: Flare in Insiders, Off elsewhere.

Co-authored-by: Copilot <[email protected]>

* chat: migrate the legacy image setting while another profile is active

With a non-default profile active, VS Code reads and writes a setting in
the default profile's settings only if the registry knows the setting is
application-scoped. Unregistering chat.copilot.imageGeneration.enabled
hid its value there, so the migration never ran: the user's choice was
ignored, and the new setting fell back to its default, which is GPT
Image 2.5 Flare in Insiders even for users who had turned image
generation off.

Keep the legacy boolean registered as a deprecated application setting.
The Settings editor hides it unless it is configured, and the migration
can now read it from, and remove it in, the default profile's settings.
A test with a non-default profile checks the actual settings files.

Co-authored-by: Copilot <[email protected]>

* chat: include watermark preference with image model settings

Move the independent watermark setting from #342116 into the image settings PR. Keep the model dropdown and legacy profile migration intact, and register the watermark next to them with its existing default-off semantics.

Preserve create, resume, and acknowledged live-update wiring and regression coverage. Add a configuration regression for the relocated setting.

Co-authored-by: Copilot <[email protected]>

* agentHost: give the agent the path of each generated image

The runtime's image_generation tool tells the agent only an image_id, so
an agent asked to put the image in the workspace searched the session
folder, found no file, and extracted the image from events.jsonl. The
Copilot CLI saves generated images in the session folder, but only for
its "Open image" link, so its agents aren't told the path either.

CopilotAgentSession's post-tool-use hook now saves each generated image
where the CLI does, <session folder>/images/image-<hash>.png, and adds a
"path:" line after its "image_id:" line in the tool result. The runtime
passes SDK callback hooks the full tool result, including the image
bytes, and applies modifiedResult before the model sees it, so the file
exists when the agent gets its path. Only images whose bytes match their
image_id are saved; names match the CLI's (pinned to its test vector), so
a session opened in both reuses one file; a different file at the path
is left alone; and a deleted session folder is never recreated.

toSdkHooks now returns VS Code's own post-tool-use output instead of
dropping it, combined with plugin hooks' output, and plugin hooks see the
result VS Code changed, as the runtime orders successive hooks.

A provider integration test has the synthetic model call the real
runtime's image tool and checks the saved file and the path the model
receives; without this change the model gets only the image_id.

Co-authored-by: Copilot <[email protected]>

* agentHost: describe why the session config requires both image options

The pinned Copilot SDK now declares the watermark option, so the old note
about it missing from the SDK type projection was stale. The local interface
only makes both options required for the finalize step.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
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