Skip to content

Commit 50c7c78

Browse files
committed
fix(copilot): match the oversized-image placeholder in the read-size gate
isOversizedReadPlaceholder tested for '[Image too large:', a prefix no code emitted — the image path's only placeholder was '[Image unavailable:'. The new source-cap placeholder is the first real one, so point the gate at it and fix the synthetic string in the test to match what the reader actually returns.
1 parent 1414bea commit 50c7c78

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/sim/lib/copilot/tools/handlers/vfs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('vfs handlers oversize policy', () => {
182182
it('fails oversized image placeholder when image exceeds size limit', async () => {
183183
const vfs = makeVfs()
184184
vfs.readFileContent.mockResolvedValue({
185-
content: '[Image too large: huge.png (10.0MB, limit 5MB)]',
185+
content: '[Image too large to read inline: huge.png (26214401 bytes, limit 26214400)]',
186186
totalLines: 1,
187187
})
188188
getOrMaterializeVFS.mockResolvedValue(vfs)

apps/sim/lib/copilot/tools/handlers/vfs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function serializedResultSize(value: unknown): number {
7979
function isOversizedReadPlaceholder(content: string): boolean {
8080
return (
8181
content.startsWith('[File too large to display inline:') ||
82-
content.startsWith('[Image too large:') ||
82+
content.startsWith('[Image too large to read inline:') ||
8383
content.startsWith('[Compiled artifact too large:')
8484
)
8585
}

0 commit comments

Comments
 (0)