fix(cursor): tear down oversized daemon model responses

- destroy the response stream when /v1/models exceeds the body limit

- prevent the oversized-response fallback test from hanging during server shutdown
This commit is contained in:
Tam Nhu Tran
2026-04-03 01:09:46 -04:00
parent 2d5bda7f76
commit e3074ae60e
+2
View File
@@ -205,8 +205,10 @@ export async function fetchModelsFromDaemon(port: number): Promise<CursorModel[]
data += chunk;
if (data.length > MAX_BODY_SIZE) {
debugLog('Cursor daemon /v1/models body exceeded 1MB; falling back to defaults');
res.destroy();
req.destroy();
safeResolve(DEFAULT_CURSOR_MODELS);
return;
}
});