Skip to content

The agent that grows with you

fix(desktop): drop stale tool-output image size overrides

BearHuddleston99d9b628b19c
diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback-vision-image.test.tsx b/apps/desktop/src/components/assistant-ui/tool/fallback-vision-image.test.tsx
index cf0806d96d2..f1b4787f40b 100644
--- a/apps/desktop/src/components/assistant-ui/tool/fallback-vision-image.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/tool/fallback-vision-image.test.tsx
@@ -82,6 +82,31 @@ describe('vision_analyze activity image', () => {
expect(await screen.findByRole('dialog')).toBeTruthy()
})
+ it('keeps a cold portrait image contained in its fixed frame instead of overriding its size', async () => {
+ $connection.set({ mode: 'local' } as never)
+ renderVisionRow()
+
+ fireEvent.click(screen.getByRole('button', { expanded: false }))
+
+ const img = await screen.findByRole('img')
+
+ await waitFor(() => expect(img.getAttribute('src')).toBe(DATA_URL))
+ Object.defineProperties(img, { naturalWidth: { value: 400 }, naturalHeight: { value: 800 } })
+ fireEvent.load(img)
+
+ // A cold image has no intrinsic dimensions yet, so its frame keeps the
+ // fallback shape and the image must fit inside it rather than size itself.
+ const frame = img.closest<HTMLElement>('[data-slot="aui_markdown-image"]')!
+
+ expect(parseFloat(frame.style.aspectRatio)).toBeCloseTo(16 / 9)
+ expect(img.classList).toContain('size-full')
+ expect(img.classList).toContain('object-contain')
+
+ for (const override of ['h-auto', 'w-full', 'object-cover']) {
+ expect(img.classList).not.toContain(override)
+ }
+ })
+
it('reads a remote-gateway image through the profile-scoped fs API, never the local reader', async () => {
$connection.set({ mode: 'remote', profile: 'wsl-work' } as never)
renderVisionRow()
diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback.tsx b/apps/desktop/src/components/assistant-ui/tool/fallback.tsx
index d591a97bd76..97155c5a587 100644
--- a/apps/desktop/src/components/assistant-ui/tool/fallback.tsx
+++ b/apps/desktop/src/components/assistant-ui/tool/fallback.tsx
@@ -651,7 +651,7 @@ function ToolEntry({ part }: ToolEntryProps) {
)}
{view.imageUrl && (
<div className="max-w-72 overflow-hidden rounded-[0.25rem] border border-(--ui-stroke-tertiary)">
- <MarkdownImage alt={copy.outputAlt} className="h-auto w-full object-cover" src={view.imageUrl} />
+ <MarkdownImage alt={copy.outputAlt} src={view.imageUrl} />
</div>
)}
{hasSearchHits && view.searchHits && (