fix: handle image size errors safely (#2871) (thanks @Suksham-sharma)
This commit is contained in:
parent
20c0d1f2c5
commit
0b1c8db0ca
3 changed files with 16 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ Status: unreleased.
|
||||||
- **BREAKING:** Gateway auth mode "none" is removed; gateway now requires token/password (Tailscale Serve identity still allowed).
|
- **BREAKING:** Gateway auth mode "none" is removed; gateway now requires token/password (Tailscale Serve identity still allowed).
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
- Agents: prevent retries on oversized image errors and surface size limits. (#2871) Thanks @Suksham-sharma.
|
||||||
- Agents: inherit provider baseUrl/api for inline models. (#2740) Thanks @lploc94.
|
- Agents: inherit provider baseUrl/api for inline models. (#2740) Thanks @lploc94.
|
||||||
- Memory Search: keep auto provider model defaults and only include remote when configured. (#2576) Thanks @papago2355.
|
- Memory Search: keep auto provider model defaults and only include remote when configured. (#2576) Thanks @papago2355.
|
||||||
- macOS: auto-scroll to bottom when sending a new message while scrolled up. (#2471) Thanks @kennyklee.
|
- macOS: auto-scroll to bottom when sending a new message while scrolled up. (#2471) Thanks @kennyklee.
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ describe("classifyFailoverReason", () => {
|
||||||
"messages.84.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels",
|
"messages.84.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels",
|
||||||
),
|
),
|
||||||
).toBeNull();
|
).toBeNull();
|
||||||
|
expect(classifyFailoverReason("image exceeds 5 MB maximum")).toBeNull();
|
||||||
});
|
});
|
||||||
it("classifies OpenAI usage limit errors as rate_limit", () => {
|
it("classifies OpenAI usage limit errors as rate_limit", () => {
|
||||||
expect(classifyFailoverReason("You have hit your ChatGPT usage limit (plus plan)")).toBe(
|
expect(classifyFailoverReason("You have hit your ChatGPT usage limit (plus plan)")).toBe(
|
||||||
|
|
|
||||||
14
src/agents/pi-embedded-helpers.image-size-error.test.ts
Normal file
14
src/agents/pi-embedded-helpers.image-size-error.test.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import { parseImageSizeError } from "./pi-embedded-helpers.js";
|
||||||
|
|
||||||
|
describe("parseImageSizeError", () => {
|
||||||
|
it("parses max MB values from error text", () => {
|
||||||
|
expect(parseImageSizeError("image exceeds 5 MB maximum")?.maxMb).toBe(5);
|
||||||
|
expect(parseImageSizeError("Image exceeds 5.5 MB limit")?.maxMb).toBe(5.5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns null for unrelated errors", () => {
|
||||||
|
expect(parseImageSizeError("context overflow")).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue