Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

increased timeout for freeskillz

Emre Sokullu253b7b484b3f
diff --git a/package.json b/package.json
index 11c4f4472..917484255 100644
--- a/package.json
+++ b/package.json
@@ -91,7 +91,7 @@
"test:chat-draft-recovery": "node --test test/native-chat-pre-enter-draft.mjs test/chat-draft-dispatch-ownership.mjs && node test/quality/native-chat-presubmit-mv3.mjs",
"test:upload-owner": "node --test test/page-monitor-upload-owner.mjs test/page-monitor-upload-release.mjs",
"test:shard:quick": "npm run test:cms && npm run test:markdown && npm run test:generative-media && npm run test:systemone && npm run test:systemone:fast && node --test test/browser-dialogs.mjs test/capsolver-cloud-broker.mjs test/captcha-providers.mjs test/captcha-weighted-fallback.mjs test/captcha-hcaptcha-providers.mjs test/captcha-native-providers.mjs test/captcha-runtime-policy.mjs test/captcha-callback-bridge.mjs test/captcha-bridge-registration.mjs test/captcha-aws-recovery.mjs test/captcha-documented-contracts.mjs test/huggingface-signup-recovery.mjs test/trace-full-export.mjs test/feedback-traces.mjs && npm run test:firefox-bidi && npm run test:billing-notice && npm run test:compass-quota && npm run test:provider-limits && npm run test:provider-catalog && npm run test:provider-instances:ui && npm run test:openrouter-capabilities && npm run test:anthropic && npm run test:accessibility-tree-benchmark && npm run test:toolbar-guard && npm run test:cloud-bridge-approval && npm run test:discord && npm run test:pdf-read && npm run test:pdf-selection && npm run test:social-contract && npm run test:safesocial && npm run test:build-unpacked && npm run test:attachment-drop && npm run test:workflow-editor && node --test test/profile-sync-stats.mjs && node --test test/memcode-recall.mjs",
- "test:shard:runtime-unit": "node --test test/agent-lifecycle.mjs test/runtime-startup.mjs test/run-ui-scheduled-lifecycle.mjs test/transport-deadlines.mjs test/cdp-worker-restart.mjs test/bot-memory.mjs test/bot-memory-click-guard.mjs test/bot-memory-registries.mjs test/bot-memory-cloud-controller.mjs test/cdp-clear-receipt.mjs test/cdp-field-submit-recovery.mjs test/conversation-persistence.mjs test/context-live-tool-group.mjs test/integration-races.mjs test/watch-completion-checkpoint.mjs test/runtime-model-identity.mjs test/provider-message-privacy.mjs test/runtime-task-authority.mjs test/planner-repair-authority.mjs test/runtime-progress-continuation.mjs test/chat-resume-chain.mjs test/chat-resume-completion.mjs test/native-chat-execution-ledger.mjs test/chat-send-dispatch-result.mjs test/chat-reply-dedup-race.mjs test/memcode-lifecycle.mjs test/runtime-peer-review.mjs test/read-continuation-schema.mjs test/completion-submit-acknowledgement.mjs test/completion-live-status.mjs test/completion-iframe-submit.mjs test/completion-semantic-commit.mjs test/completion-diagnostics.mjs test/mastodon-publication.mjs test/calculator.mjs test/chat-recovery-protocol.mjs test/chat-pending-reconciliation.mjs test/semantic-page-retry.mjs test/pdf-detection.mjs test/runtime-lifecycle.mjs test/collection-read-progress.mjs test/network-lifecycle.mjs test/text-write-cancellation.mjs test/trusted-field-preparation.mjs test/draftjs-text.mjs test/rich-text-frameworks.mjs test/cdp-managed-text-selection.mjs test/firefox-rich-text-readback.mjs test/contenteditable-beforeinput.mjs test/trusted-field-preparation-ownership.mjs test/typing-preparation-geometry.mjs test/chat-steering.mjs test/resource-mutation-guards.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/permission-steering-wakeup.mjs test/pure-calculation-reply.mjs test/pure-calculation-tools.mjs test/page-feedback.mjs test/page-feedback-progress.mjs test/ask-response-scope.mjs test/ask-completion-churn.mjs test/page-feedback-policy.mjs test/page-feedback-transport-races.mjs test/page-feedback-recovery.mjs test/telegram-read-preparation-agent.mjs test/media-download-agent-handler.mjs test/code-scanning-url-recipient.mjs test/apocalypse-comm-parsing.mjs test/apocalypse-scalar-decoding.mjs test/bitgpu-chat-security.mjs test/social-media-url-upgrades.mjs test/downloaded-file-saved-bytes.mjs test/downloaded-file-local-probe.mjs test/formless-verification-recovery.mjs test/file-upload-accept.mjs test/file-upload-accept-agent.mjs test/workflow-route-generic-completion.mjs test/release-publication-completion.mjs test/workflow-implicit-metadata.mjs test/completion-current-execution-evidence.mjs test/video-upload-attachment.mjs test/feedback-automatic-churn.mjs test/feedback-navigation-idle.mjs test/feedback-run-boundaries.mjs test/feedback-ask-viewing.mjs test/lifecycle-terminal-done.mjs test/lifecycle-planner-digest.mjs test/lifecycle-steering-latency.mjs test/lifecycle-vision-fallback.mjs test/delivery-click-locks.mjs test/guards-steering-receipts.mjs test/terminal-user-messages.mjs",
+ "test:shard:runtime-unit": "node --test test/skill-download-wait.mjs && node --test test/agent-lifecycle.mjs test/runtime-startup.mjs test/run-ui-scheduled-lifecycle.mjs test/transport-deadlines.mjs test/cdp-worker-restart.mjs test/bot-memory.mjs test/bot-memory-click-guard.mjs test/bot-memory-registries.mjs test/bot-memory-cloud-controller.mjs test/cdp-clear-receipt.mjs test/cdp-field-submit-recovery.mjs test/conversation-persistence.mjs test/context-live-tool-group.mjs test/integration-races.mjs test/watch-completion-checkpoint.mjs test/runtime-model-identity.mjs test/provider-message-privacy.mjs test/runtime-task-authority.mjs test/planner-repair-authority.mjs test/runtime-progress-continuation.mjs test/chat-resume-chain.mjs test/chat-resume-completion.mjs test/native-chat-execution-ledger.mjs test/chat-send-dispatch-result.mjs test/chat-reply-dedup-race.mjs test/memcode-lifecycle.mjs test/runtime-peer-review.mjs test/read-continuation-schema.mjs test/completion-submit-acknowledgement.mjs test/completion-live-status.mjs test/completion-iframe-submit.mjs test/completion-semantic-commit.mjs test/completion-diagnostics.mjs test/mastodon-publication.mjs test/calculator.mjs test/chat-recovery-protocol.mjs test/chat-pending-reconciliation.mjs test/semantic-page-retry.mjs test/pdf-detection.mjs test/runtime-lifecycle.mjs test/collection-read-progress.mjs test/network-lifecycle.mjs test/text-write-cancellation.mjs test/trusted-field-preparation.mjs test/draftjs-text.mjs test/rich-text-frameworks.mjs test/cdp-managed-text-selection.mjs test/firefox-rich-text-readback.mjs test/contenteditable-beforeinput.mjs test/trusted-field-preparation-ownership.mjs test/typing-preparation-geometry.mjs test/chat-steering.mjs test/resource-mutation-guards.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/permission-steering-wakeup.mjs test/pure-calculation-reply.mjs test/pure-calculation-tools.mjs test/page-feedback.mjs test/page-feedback-progress.mjs test/ask-response-scope.mjs test/ask-completion-churn.mjs test/page-feedback-policy.mjs test/page-feedback-transport-races.mjs test/page-feedback-recovery.mjs test/telegram-read-preparation-agent.mjs test/media-download-agent-handler.mjs test/code-scanning-url-recipient.mjs test/apocalypse-comm-parsing.mjs test/apocalypse-scalar-decoding.mjs test/bitgpu-chat-security.mjs test/social-media-url-upgrades.mjs test/downloaded-file-saved-bytes.mjs test/downloaded-file-local-probe.mjs test/formless-verification-recovery.mjs test/file-upload-accept.mjs test/file-upload-accept-agent.mjs test/workflow-route-generic-completion.mjs test/release-publication-completion.mjs test/workflow-implicit-metadata.mjs test/completion-current-execution-evidence.mjs test/video-upload-attachment.mjs test/feedback-automatic-churn.mjs test/feedback-navigation-idle.mjs test/feedback-run-boundaries.mjs test/feedback-ask-viewing.mjs test/lifecycle-terminal-done.mjs test/lifecycle-planner-digest.mjs test/lifecycle-steering-latency.mjs test/lifecycle-vision-fallback.mjs test/delivery-click-locks.mjs test/guards-steering-receipts.mjs test/terminal-user-messages.mjs",
"test:shard:browser-a": "node test/bot-memory-dom.mjs && node test/bot-memory-click-dom.mjs && node test/ui-content-lifecycle.mjs && node --test test/native-telegram-chat.mjs test/native-telegram-recipient.mjs test/telegram-native-baseline.mjs test/telegram-native-latest.mjs test/native-chat-pre-enter-draft.mjs test/chat-draft-dispatch-ownership.mjs test/native-telegram-alias-preparation.mjs test/telegram-read-preparation-content.mjs test/queued-composer-ownership.mjs test/onboarding-provider-ready.mjs test/workflow-native-targets.mjs test/native-whatsapp-chat.mjs test/native-chat-context-identity.mjs test/native-whatsapp-contact.mjs test/whatsapp-native-bootstrap.mjs test/whatsapp-drawer-identity.mjs test/whatsapp-read-latest.mjs test/whatsapp-read-preparation.mjs test/whatsapp-chat-completion.mjs test/whatsapp-chat-restart.mjs test/chat-goal-lifecycle.mjs test/chat-completion.mjs test/chat-generic-dispatch.mjs test/completion-live-status-browser.mjs test/native-confirmation-visibility.mjs test/native-button-preparation.mjs test/read-continuation-browser.mjs test/iframe-preparation-focus.mjs test/contenteditable-literal.mjs test/native-chat-empty-editor.mjs test/native-chat-trusted-clear.mjs test/chat-steering-ui.mjs test/assistant-message-visibility-ui.mjs test/page-monitor-ui.mjs test/page-monitor-dialog.mjs test/page-monitor-dialog-native.mjs test/page-monitor-inline-post.mjs test/bluesky-composer-context.mjs test/page-monitor-anchored.mjs test/page-monitor-upload-owner.mjs test/page-monitor-upload-release.mjs test/page-monitor-native-controls.mjs test/page-monitor-native-preparation.mjs test/native-preparation-cold.mjs test/page-monitor-navigation.mjs test/page-monitor-main-owner.mjs test/page-monitor-collateral-controls.mjs test/accessibility-tree-scoped-budget.mjs test/ax-reference-origin.mjs test/page-monitor-decorative-hit.mjs test/social-ui-navigation.mjs test/native-resource-deletion-binding.mjs test/dropdown-menu-inventory.mjs test/page-monitor-passive-progress.mjs test/media-download-binding.mjs test/media-download-capture-integration.mjs test/social-media-downloader-reinjection.mjs test/upload-file-local-state-guidance.mjs test/monitor-intervention-contract.mjs test/monitor-owned-geometry.mjs test/monitor-viewport-remainder.mjs test/monitor-local-attribution.mjs test/monitor-lifecycle-leaks.mjs test/lifecycle-run-ui.mjs test/delivery-cdp-input.mjs test/delivery-click-ax-response-loss.mjs test/delivery-native-button-geometry.mjs test/delivery-stop-compound.mjs test/guards-control-classification.mjs",
"test:shard:browser-b1": "node test/message-recipient-upload.mjs && node --test test/message-recipient-whatsapp.mjs && node test/quality/integration-mv3.mjs --full-form && node test/quality/literal-calculate-midrun-mv3.mjs && node test/quality/ask-completion-churn-mv3.mjs && node test/quality/telegram-cold-preparation-mv3.mjs && node test/quality/native-chat-mv3.mjs && node test/quality/native-chat-presubmit-mv3.mjs && node test/quality/cloud-bot-memory-mv3.mjs",
"test:shard:browser-b2": "node test/quality/whatsapp-contact-matrix.mjs && node test/quality/pdf-detection-mv3.mjs && node test/quality/download-upload-mv3.mjs && node test/quality/upload-release-binding-mv3.mjs && node test/quality/release-review-world-mv3.mjs && node test/quality/downloaded-file-saved-bytes-mv3.mjs && node test/quality/file-upload-accept-mv3.mjs && node test/quality/bulk-resume-mv3.mjs && node test/quality/shared-action-guards-mv3.mjs && node test/quality/video-upload-attachment-mv3.mjs",
diff --git a/src/chrome/skills/freeskillz-xyz.md b/src/chrome/skills/freeskillz-xyz.md
index 649040fc6..aca8053a3 100644
--- a/src/chrome/skills/freeskillz-xyz.md
+++ b/src/chrome/skills/freeskillz-xyz.md
@@ -173,7 +173,7 @@ This skill exposes `read_youtube_transcript`, `fetch_nytimes_article`, `resolve_
"cleanupEndpoint": "https://freeskillz.xyz/v1/media/jobs/{job_id}",
"jobIdField": "job_id",
"pollIntervalMs": 1000,
- "timeoutMs": 180000,
+ "timeoutMs": 1200000,
"defaultArgs": {
"kind": "auto",
"max_height": 720
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index bb4981f3f..b87808d20 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -41600,7 +41600,10 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai
executeOnline: (onlineTool, onlineArgs) => executeHttpSkillTool(onlineTool, onlineArgs, { tabId }),
});
}
- return await executeHttpSkillTool(skillTool, args, { tabId });
+ return await executeHttpSkillTool(skillTool, args, {
+ tabId,
+ onProgress: message => onUpdate?.('tool_progress', { name, message }),
+ });
}
const skillEndpointRedirect = this._skillEndpointToolRedirect(name, args, tabId);
if (skillEndpointRedirect) {
diff --git a/src/chrome/src/agent/skills.js b/src/chrome/src/agent/skills.js
index 3ead8650b..18a764bb8 100644
--- a/src/chrome/src/agent/skills.js
+++ b/src/chrome/src/agent/skills.js
@@ -586,7 +586,7 @@ function normalizeSkillTools(value, skillId) {
fileEndpoint: normalizeEndpointTemplate(item.fileEndpoint || item.file_endpoint || item.fileUrlTemplate || item.file_url_template || jobSource.fileEndpoint || jobSource.file_endpoint || jobSource.fileUrlTemplate || jobSource.file_url_template),
cleanupEndpoint: normalizeEndpointTemplate(item.cleanupEndpoint || item.cleanup_endpoint || item.deleteEndpoint || item.delete_endpoint || jobSource.cleanupEndpoint || jobSource.cleanup_endpoint || jobSource.deleteEndpoint || jobSource.delete_endpoint),
pollIntervalMs: Math.max(250, Math.min(5000, Number(item.pollIntervalMs || item.poll_interval_ms || jobSource.pollIntervalMs || jobSource.poll_interval_ms || 1000) || 1000)),
- timeoutMs: Math.max(5000, Math.min(180000, Number(item.timeoutMs || item.timeout_ms || jobSource.timeoutMs || jobSource.timeout_ms || 90000) || 90000)),
+ timeoutMs: Math.max(5000, Math.min(1200000, Number(item.timeoutMs || item.timeout_ms || jobSource.timeoutMs || jobSource.timeout_ms || 90000) || 90000)),
};
if (kind === 'httpDownloadJob' && (!job.statusEndpoint || !job.fileEndpoint)) continue;
seen.add(name);
diff --git a/src/chrome/src/network/network-tools.js b/src/chrome/src/network/network-tools.js
index 3b2470bef..5ec61f68f 100644
--- a/src/chrome/src/network/network-tools.js
+++ b/src/chrome/src/network/network-tools.js
@@ -1136,7 +1136,7 @@ async function downloadSkillFile(url, filename, waitMs = 60000) {
return result;
}
-async function executeHttpDownloadJobSkillTool(tool, payload, endpoint) {
+async function executeHttpDownloadJobSkillTool(tool, payload, endpoint, ctx = {}) {
const create = await fetchSkillJson(endpoint.href, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -1160,7 +1160,27 @@ async function executeHttpDownloadJobSkillTool(tool, payload, endpoint) {
return await withSkillDownloadJobCleanup({ success: false, provider: endpoint.hostname, skillTool: tool.name || '', skillName: tool.skillName || '', jobId, error: fileEndpoint.error }, cleanupEndpoint, endpoint, tool);
}
- const deadline = Date.now() + (tool.job?.timeoutMs || 90000);
+ const startedAt = Date.now();
+ const deadline = startedAt + (tool.job?.timeoutMs || 90000);
+ let waitNoticeSent = false;
+ const notifyLongWait = data => {
+ if (waitNoticeSent) return;
+ const metadata = data?.metadata || {};
+ const duration = Number(metadata.duration);
+ const bytes = Number(metadata.filesize || metadata.filesize_approx);
+ const longVideo = Number.isFinite(duration) && duration >= 120;
+ const largeFile = Number.isFinite(bytes) && bytes >= 50 * 1024 * 1024;
+ if (!longVideo && !largeFile && Date.now() - startedAt < 30000) return;
+ waitNoticeSent = true;
+ // Only numeric metadata enters chat; provider titles and text stay untrusted.
+ const size = largeFile ? `about ${Math.ceil(bytes / (1024 * 1024))} MB`
+ : longVideo ? `about ${Math.ceil(duration / 60)} minutes long` : '';
+ const message = size
+ ? `This media is ${size}, so downloading and preparing the final file may take several minutes. I’ll keep waiting.`
+ : 'The media is still downloading or being prepared. Larger files and longer videos can take several minutes. I’ll keep waiting.';
+ try { ctx.onProgress?.(message); } catch { /* Chat updates must not interrupt delivery. */ }
+ };
+ notifyLongWait(create.data);
const pollIntervalMs = tool.job?.pollIntervalMs || 1000;
let lastStatus = create.data;
while (Date.now() < deadline) {
@@ -1181,20 +1201,24 @@ async function executeHttpDownloadJobSkillTool(tool, payload, endpoint) {
error: providerError(502, poll.data, '') || `Skill download job ${jobId} failed.`,
}, cleanupEndpoint, endpoint, tool);
}
+ notifyLongWait(lastStatus);
await new Promise(r => setTimeout(r, pollIntervalMs));
}
const finalStatus = String(lastStatus?.status || '').toLowerCase();
if (!(finalStatus === 'complete' || finalStatus === 'completed' || finalStatus === 'done' || finalStatus === 'success')) {
- return await withSkillDownloadJobCleanup({
+ // A polling deadline does not cancel the remote job. Keep its identity for recovery.
+ return {
success: false,
provider: endpoint.hostname,
skillTool: tool.name || '',
skillName: tool.skillName || '',
jobId,
jobStatus: finalStatus || 'unknown',
- error: `Skill download job timed out before completion.`,
- }, cleanupEndpoint, endpoint, tool);
+ statusUrl: statusEndpoint.url,
+ fileUrl: fileEndpoint.url,
+ error: 'The wait limit was reached, but the remote job may still finish. Check statusUrl before starting another download.',
+ };
}
let cleanup = null;
@@ -1272,7 +1296,7 @@ export async function executeHttpSkillTool(tool, args = {}, ctx = {}) {
}
if (tool.kind === 'httpDownloadJob') {
- return await executeHttpDownloadJobSkillTool(tool, payload, endpoint);
+ return await executeHttpDownloadJobSkillTool(tool, payload, endpoint, ctx);
}
const init = {
diff --git a/src/firefox/skills/freeskillz-xyz.md b/src/firefox/skills/freeskillz-xyz.md
index 649040fc6..aca8053a3 100644
--- a/src/firefox/skills/freeskillz-xyz.md
+++ b/src/firefox/skills/freeskillz-xyz.md
@@ -173,7 +173,7 @@ This skill exposes `read_youtube_transcript`, `fetch_nytimes_article`, `resolve_
"cleanupEndpoint": "https://freeskillz.xyz/v1/media/jobs/{job_id}",
"jobIdField": "job_id",
"pollIntervalMs": 1000,
- "timeoutMs": 180000,
+ "timeoutMs": 1200000,
"defaultArgs": {
"kind": "auto",
"max_height": 720
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index a064fa9d2..4bde9f72d 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -37724,7 +37724,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
executeOnline: (onlineTool, onlineArgs) => executeHttpSkillTool(onlineTool, onlineArgs, { tabId }),
});
}
- return await executeHttpSkillTool(skillTool, args, { tabId });
+ return await executeHttpSkillTool(skillTool, args, {
+ tabId,
+ onProgress: message => onUpdate?.('tool_progress', { name, message }),
+ });
}
const skillEndpointRedirect = this._skillEndpointToolRedirect(name, args, tabId);
if (skillEndpointRedirect) {
diff --git a/src/firefox/src/agent/skills.js b/src/firefox/src/agent/skills.js
index 943609f93..f198ede7c 100644
--- a/src/firefox/src/agent/skills.js
+++ b/src/firefox/src/agent/skills.js
@@ -586,7 +586,7 @@ function normalizeSkillTools(value, skillId) {
fileEndpoint: normalizeEndpointTemplate(item.fileEndpoint || item.file_endpoint || item.fileUrlTemplate || item.file_url_template || jobSource.fileEndpoint || jobSource.file_endpoint || jobSource.fileUrlTemplate || jobSource.file_url_template),
cleanupEndpoint: normalizeEndpointTemplate(item.cleanupEndpoint || item.cleanup_endpoint || item.deleteEndpoint || item.delete_endpoint || jobSource.cleanupEndpoint || jobSource.cleanup_endpoint || jobSource.deleteEndpoint || jobSource.delete_endpoint),
pollIntervalMs: Math.max(250, Math.min(5000, Number(item.pollIntervalMs || item.poll_interval_ms || jobSource.pollIntervalMs || jobSource.poll_interval_ms || 1000) || 1000)),
- timeoutMs: Math.max(5000, Math.min(180000, Number(item.timeoutMs || item.timeout_ms || jobSource.timeoutMs || jobSource.timeout_ms || 90000) || 90000)),
+ timeoutMs: Math.max(5000, Math.min(1200000, Number(item.timeoutMs || item.timeout_ms || jobSource.timeoutMs || jobSource.timeout_ms || 90000) || 90000)),
};
if (kind === 'httpDownloadJob' && (!job.statusEndpoint || !job.fileEndpoint)) continue;
seen.add(name);
diff --git a/src/firefox/src/network/network-tools.js b/src/firefox/src/network/network-tools.js
index f2e2b57a6..ff8ca593a 100644
--- a/src/firefox/src/network/network-tools.js
+++ b/src/firefox/src/network/network-tools.js
@@ -1144,7 +1144,7 @@ async function downloadSkillFile(url, filename, waitMs = 60000) {
return result;
}
-async function executeHttpDownloadJobSkillTool(tool, payload, endpoint) {
+async function executeHttpDownloadJobSkillTool(tool, payload, endpoint, ctx = {}) {
const create = await fetchSkillJson(endpoint.href, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -1168,7 +1168,27 @@ async function executeHttpDownloadJobSkillTool(tool, payload, endpoint) {
return await withSkillDownloadJobCleanup({ success: false, provider: endpoint.hostname, skillTool: tool.name || '', skillName: tool.skillName || '', jobId, error: fileEndpoint.error }, cleanupEndpoint, endpoint, tool);
}
- const deadline = Date.now() + (tool.job?.timeoutMs || 90000);
+ const startedAt = Date.now();
+ const deadline = startedAt + (tool.job?.timeoutMs || 90000);
+ let waitNoticeSent = false;
+ const notifyLongWait = data => {
+ if (waitNoticeSent) return;
+ const metadata = data?.metadata || {};
+ const duration = Number(metadata.duration);
+ const bytes = Number(metadata.filesize || metadata.filesize_approx);
+ const longVideo = Number.isFinite(duration) && duration >= 120;
+ const largeFile = Number.isFinite(bytes) && bytes >= 50 * 1024 * 1024;
+ if (!longVideo && !largeFile && Date.now() - startedAt < 30000) return;
+ waitNoticeSent = true;
+ // Only numeric metadata enters chat; provider titles and text stay untrusted.
+ const size = largeFile ? `about ${Math.ceil(bytes / (1024 * 1024))} MB`
+ : longVideo ? `about ${Math.ceil(duration / 60)} minutes long` : '';
+ const message = size
+ ? `This media is ${size}, so downloading and preparing the final file may take several minutes. I’ll keep waiting.`
+ : 'The media is still downloading or being prepared. Larger files and longer videos can take several minutes. I’ll keep waiting.';
+ try { ctx.onProgress?.(message); } catch { /* Chat updates must not interrupt delivery. */ }
+ };
+ notifyLongWait(create.data);
const pollIntervalMs = tool.job?.pollIntervalMs || 1000;
let lastStatus = create.data;
while (Date.now() < deadline) {
@@ -1189,20 +1209,24 @@ async function executeHttpDownloadJobSkillTool(tool, payload, endpoint) {
error: providerError(502, poll.data, '') || `Skill download job ${jobId} failed.`,
}, cleanupEndpoint, endpoint, tool);
}
+ notifyLongWait(lastStatus);
await new Promise(r => setTimeout(r, pollIntervalMs));
}
const finalStatus = String(lastStatus?.status || '').toLowerCase();
if (!(finalStatus === 'complete' || finalStatus === 'completed' || finalStatus === 'done' || finalStatus === 'success')) {
- return await withSkillDownloadJobCleanup({
+ // A polling deadline does not cancel the remote job. Keep its identity for recovery.
+ return {
success: false,
provider: endpoint.hostname,
skillTool: tool.name || '',
skillName: tool.skillName || '',
jobId,
jobStatus: finalStatus || 'unknown',
- error: `Skill download job timed out before completion.`,
- }, cleanupEndpoint, endpoint, tool);
+ statusUrl: statusEndpoint.url,
+ fileUrl: fileEndpoint.url,
+ error: 'The wait limit was reached, but the remote job may still finish. Check statusUrl before starting another download.',
+ };
}
let cleanup = null;
@@ -1280,7 +1304,7 @@ export async function executeHttpSkillTool(tool, args = {}, ctx = {}) {
}
if (tool.kind === 'httpDownloadJob') {
- return await executeHttpDownloadJobSkillTool(tool, payload, endpoint);
+ return await executeHttpDownloadJobSkillTool(tool, payload, endpoint, ctx);
}
const init = {
diff --git a/test/run.js b/test/run.js
index f7decdb0b..fb17cf520 100644
--- a/test/run.js
+++ b/test/run.js
@@ -32104,7 +32104,7 @@ test('executeHttpSkillTool does not require HEAD support for skill downloads', a
}
});
-test('executeHttpSkillTool cleans up provider jobs on pre-download failures', async () => {
+test('executeHttpSkillTool cleans up failures and preserves timed-out provider jobs', async () => {
const originalFetch = globalThis.fetch;
const originalChrome = globalThis.chrome;
const originalBrowser = globalThis.browser;
@@ -32140,7 +32140,8 @@ test('executeHttpSkillTool cleans up provider jobs on pre-download failures', as
},
statusResponse: () => ({ status: 200, body: { status: 'running' } }),
assertResult(result, label) {
- assert.match(result.error, /timed out/i, `${label}: timeout error missing`);
+ assert.match(result.error, /wait limit/i, `${label}: timeout error missing`);
+ assert.equal(result.statusUrl, 'https://freeskillz.xyz/v1/media/jobs/job_timeout');
},
},
];
@@ -32203,12 +32204,12 @@ test('executeHttpSkillTool cleans up provider jobs on pre-download failures', as
const result = await executeTool(tool, { url: 'https://www.instagram.com/reel/abc/' });
assert.equal(result.success, false, `${label} ${scenario.name}: pre-download failure should fail`);
assert.equal(result.jobId, scenario.jobId, `${label} ${scenario.name}: job id missing`);
- assert.equal(result.cleanup?.success, true, `${label} ${scenario.name}: provider cleanup should run`);
+ assert.equal(result.cleanup?.success, scenario.name === 'timeout' ? undefined : true, `${label} ${scenario.name}: cleanup should only run for failures`);
assert.equal(downloadCalls.length, 0, `${label} ${scenario.name}: browser download should not start`);
assert.equal(providerCalls[0].opts.method, 'POST', `${label} ${scenario.name}: create job should be first`);
const lastProviderCall = providerCalls.at(-1);
assert.equal(lastProviderCall.url, `https://freeskillz.xyz/v1/media/jobs/${scenario.jobId}`, `${label} ${scenario.name}: cleanup URL should be last`);
- assert.equal(lastProviderCall.opts.method, 'DELETE', `${label} ${scenario.name}: cleanup method should be DELETE`);
+ assert.equal(lastProviderCall.opts.method, scenario.name === 'timeout' ? 'GET' : 'DELETE', `${label} ${scenario.name}: timed-out jobs must remain available`);
assert.equal(
providerCalls.some(call => call.url.endsWith('/file')),
false,
diff --git a/test/skill-download-wait.mjs b/test/skill-download-wait.mjs
new file mode 100644
index 000000000..040131e4c
--- /dev/null
+++ b/test/skill-download-wait.mjs
@@ -0,0 +1,79 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import { test } from 'node:test';
+
+for (const build of ['chrome', 'firefox']) {
+ test(`${build}: long media waits beyond three minutes, reports once, and retains timed-out job`, async () => {
+ const { executeHttpSkillTool } = await import(`../src/${build}/src/network/network-tools.js`);
+ const { normalizeCustomSkills, buildSkillToolRegistry } = await import(`../src/${build}/src/agent/skills.js`);
+ const skills = normalizeCustomSkills([{
+ id: 'freeskillz-xyz', name: 'FreeSkillz.xyz', enabled: true,
+ content: fs.readFileSync(new URL(`../src/${build}/skills/freeskillz-xyz.md`, import.meta.url), 'utf8'),
+ }]);
+ const tool = buildSkillToolRegistry(skills).get('download_public_media');
+ assert.equal(tool.job.timeoutMs, 1200000);
+ const originalFetch = globalThis.fetch;
+ const originalNow = Date.now;
+ const originalTimeout = globalThis.setTimeout;
+ try {
+ for (const scenario of ['duration', 'size', 'unknown', 'short']) {
+ let clock = 0;
+ let polls = 0;
+ const notices = [];
+ const methods = [];
+ Date.now = () => clock;
+ globalThis.setTimeout = callback => { clock += 1000; callback(); return 0; };
+ const metadata = scenario === 'duration' ? { duration: 204, title: '<untrusted>' }
+ : scenario === 'size' ? { filesize_approx: 80 * 1024 * 1024 }
+ : scenario === 'short' ? { duration: 10 } : {};
+ globalThis.fetch = async (_url, opts) => {
+ methods.push(opts.method);
+ if (opts.method === 'GET') {
+ polls++;
+ clock += scenario === 'short' ? 1 : 60000;
+ }
+ const data = opts.method === 'POST' ? { job_id: 'slow', metadata }
+ : { status: scenario === 'short' ? 'failed' : 'running', metadata };
+ return { ok: true, status: 200, text: async () => JSON.stringify(data) };
+ };
+ const result = await executeHttpSkillTool(tool, { url: 'https://x.com/user/status/123', kind: 'video' }, {
+ onProgress: message => notices.push(message),
+ });
+ if (scenario === 'short') {
+ assert.deepEqual(notices, []);
+ assert.ok(methods.includes('DELETE'));
+ } else {
+ assert.ok(polls > 3, 'must keep polling beyond original three-minute limit');
+ assert.equal(notices.length, 1);
+ assert.ok(!notices[0].includes('<untrusted>'));
+ assert.match(notices[0], scenario === 'duration' ? /4 minutes/ : scenario === 'size' ? /80 MB/ : /still downloading/);
+ assert.equal(result.jobId, 'slow');
+ assert.equal(result.statusUrl, 'https://freeskillz.xyz/v1/media/jobs/slow');
+ assert.equal(result.jobStatus, 'running');
+ assert.ok(!methods.includes('DELETE'), 'timeout must preserve a running job');
+ }
+ }
+ } finally {
+ globalThis.fetch = originalFetch;
+ Date.now = originalNow;
+ globalThis.setTimeout = originalTimeout;
+ }
+ });
+}
+
+for (const build of ['chrome', 'firefox']) {
+ test(`${build}: skill progress reaches the chat tool-progress channel`, async () => {
+ const source = fs.readFileSync(new URL(`../src/${build}/src/agent/agent.js`, import.meta.url), 'utf8');
+ const start = source.lastIndexOf(' const skillTool = this._activeSkillToolForName(tabId, name);');
+ const end = source.indexOf(' const skillEndpointRedirect', start);
+ assert.ok(start > 0 && end > start);
+ const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
+ const handler = new AsyncFunction('tabId', 'name', 'args', 'onUpdate', 'isTrustedChromeWebStoreSkillTool', 'executeHttpSkillTool', source.slice(start, end));
+ const updates = [];
+ const result = await handler.call({ _activeSkillToolForName: () => ({ skillId: 'freeskillz-xyz' }) },
+ 1, 'download_public_media', {}, (...update) => updates.push(update), () => false,
+ async (_tool, _args, ctx) => { ctx.onProgress('Preparing a large file'); return { success: true }; });
+ assert.equal(result.success, true);
+ assert.deepEqual(updates, [['tool_progress', { name: 'download_public_media', message: 'Preparing a large file' }]]);
+ });
+}