Skip to content

Align Alexandria CLI timeouts with the 120-second API deadline - #279

Open
developersdigest wants to merge 1 commit into
mainfrom
fix/alexandria-timeout-120s
Open

developersdigest wants to merge 1 commit into
mainfrom
fix/alexandria-timeout-120s

Conversation

@developersdigest

@developersdigest developersdigest commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Alexandria CLI calls currently time out after 80 seconds because the SDK transport still assumes a 50-second execution deadline. The API now allows 120 seconds after firecrawl/firecrawl#4728, so valid requests can outlive the CLI connection.

Send Alexandria requests directly to /v2/scrape with a default and maximum execution timeout of 120 seconds, plus 30 seconds for response delivery. Preserve explicit shorter timeouts, request IDs, receipts, error metadata, and retry guidance. Transport failures are not automatically retried. This bypass is scoped to Alexandria because the latest published SDK still hard-codes the shorter transport limit.

Validation: build and TypeScript check pass; 47 Alexandria CLI integration tests and four timeout/recovery tests pass. The updated build was installed locally; no npm release was published. This fixes the premature client timeout, not upstream deadline failures.


Summary by cubic

Fixes Alexandria CLI calls timing out after 80 seconds by bypassing the SDK's hard-coded transport limit and sending requests directly to /v2/scrape with the API's 120-second execution deadline.

  • Default and maximum execution timeout is now 120 seconds, plus 30 seconds for response delivery; explicit shorter timeouts are preserved.
  • Request IDs, receipts, error metadata, and retry guidance are kept; transport failures are not retried.
  • Bypass is scoped to Alexandria because the latest published SDK still caps the transport at 80 seconds.

Written for commit f9d3720. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Confidence score: 3/5

  • src/commands/alexandria.ts mishandles non-JSON HTTP failures, causing users to see a JSON parse error instead of the actual HTTP status and retry metadata; parse failures as an empty body before constructing the error response.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/alexandria.ts">

<violation number="1" location="src/commands/alexandria.ts:230">
P2: Non-JSON HTTP failures bypass the `response` object below, so users receive a JSON parse error instead of the HTTP status and retry metadata. Parse failures as an empty body before constructing the error response.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Fix all with cubic | Re-trigger cubic

redirect: 'error',
signal: AbortSignal.timeout(timeout + 30_000),
});
const body = await response.json();

@cubic-dev-ai cubic-dev-ai Bot Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Non-JSON HTTP failures bypass the response object below, so users receive a JSON parse error instead of the HTTP status and retry metadata. Parse failures as an empty body before constructing the error response.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/alexandria.ts, line 230:

<comment>Non-JSON HTTP failures bypass the `response` object below, so users receive a JSON parse error instead of the HTTP status and retry metadata. Parse failures as an empty body before constructing the error response.</comment>

<file context>
@@ -207,19 +206,52 @@ export async function requestAlexandria(
+      redirect: 'error',
+      signal: AbortSignal.timeout(timeout + 30_000),
     });
+    const body = await response.json();
+    if (!response.ok || !body?.success) {
+      throw Object.assign(
</file context>
Suggested change
const body = await response.json();
const body = await response.json().catch(() => ({}));
Fix with cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant