mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 02:34:32 +00:00
fix(agents): avoid classifying reasoning-required errors as context overflow (#24593)
* Agents: exclude reasoning-required errors from overflow detection * Tests: cover reasoning-required overflow classification guard * Tests: format reasoning-required endpoint errors
This commit is contained in:
@@ -208,6 +208,17 @@ describe("isContextOverflowError", () => {
|
||||
expect(isContextOverflowError("We're debugging context overflow issues")).toBe(false);
|
||||
expect(isContextOverflowError("Something is causing context overflow messages")).toBe(false);
|
||||
});
|
||||
|
||||
it("excludes reasoning-required invalid-request errors", () => {
|
||||
const samples = [
|
||||
"400 Reasoning is mandatory for this endpoint and cannot be disabled.",
|
||||
'{"type":"error","error":{"type":"invalid_request_error","message":"Reasoning is mandatory for this endpoint and cannot be disabled."}}',
|
||||
"This model requires reasoning to be enabled",
|
||||
];
|
||||
for (const sample of samples) {
|
||||
expect(isContextOverflowError(sample)).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("error classifiers", () => {
|
||||
@@ -286,6 +297,17 @@ describe("isLikelyContextOverflowError", () => {
|
||||
expect(isLikelyContextOverflowError(sample)).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it("excludes reasoning-required invalid-request errors", () => {
|
||||
const samples = [
|
||||
"400 Reasoning is mandatory for this endpoint and cannot be disabled.",
|
||||
'{"type":"error","error":{"type":"invalid_request_error","message":"Reasoning is mandatory for this endpoint and cannot be disabled."}}',
|
||||
"This endpoint requires reasoning",
|
||||
];
|
||||
for (const sample of samples) {
|
||||
expect(isLikelyContextOverflowError(sample)).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("isTransientHttpError", () => {
|
||||
|
||||
Reference in New Issue
Block a user