Updates
Rolling release / release (push) Successful in 6m52s

This commit is contained in:
2026-09-12 10:43:01 -04:00
parent f26204505e
commit b8c60e4326
14 changed files with 701 additions and 89 deletions
+49 -1
View File
@@ -20,6 +20,7 @@ const policy = require('../agent/policy.js');
const toolBudget = require('../agent/tool-budget.js');
const paths = require('../lib/paths.js');
const device = require('../lib/device.js');
const tools = require('../agent/tools.js');
function testCatalog() {
assert.strictEqual(catalog.resolveModelConstant('qwen3.5-4b'), 'QWEN3_5_4B_MULTIMODAL_Q4_K_M');
@@ -261,4 +262,51 @@ testTruncateAndPerm();
testPaths();
testQvacWorkerDeps();
testDevicePrefersGpu();
console.log('ok');
testWebFetchTimeout()
.then(() => {
console.log('ok');
})
.catch((err) => {
console.error(err);
process.exitCode = 1;
});
async function testWebFetchTimeout() {
const orig = globalThis.fetch;
globalThis.fetch = () => new Promise(() => {});
const started = Date.now();
try {
const hung = await tools.webFetch('https://example.com/ip', 40);
assert.ok(hung.error);
assert.ok(/timed out/i.test(hung.error));
assert.strictEqual(hung.url, 'https://example.com/ip');
assert.ok(Date.now() - started < 2000);
} finally {
globalThis.fetch = orig;
}
globalThis.fetch = async (url) => ({
status: 200,
url: String(url),
text: async () => '203.0.113.8',
});
try {
const ok = await tools.webFetch('https://ifconfig.me/ip', 200);
assert.strictEqual(ok.status, 200);
assert.strictEqual(ok.url, 'https://ifconfig.me/ip');
assert.strictEqual(ok.text, '203.0.113.8');
assert.ok(!ok.error);
} finally {
globalThis.fetch = orig;
}
globalThis.fetch = async () => ({ status: 503, url: 'https://example.com', text: async () => 'down' });
try {
const failed = await tools.webFetch('https://example.com/status', 200);
assert.ok(failed.error);
assert.strictEqual(failed.status, 503);
assert.strictEqual(failed.url, 'https://example.com');
} finally {
globalThis.fetch = orig;
}
}