Skip to content

[scanner] prebuild sync scripts fetch() without any timeout — a stalled remote hangs the build until job timeout #394

Closed

Description

@hivecommons-hive

Summary

Every network request made during prebuild uses bare fetch() with no deadline. If a remote accepts the connection but never completes the response, the sync step blocks until the GitHub Actions job timeout-minutes (15) kills it — or until Netlify's build timeout on production deploys — with no log line naming the URL that hung.

Call sites (main @ a239ee5)

  • scripts/sync-hive-docs.ts:220 — fetchText: const response = await fetch(url);
  • scripts/sync-sibling-docs.ts:444 — fetchFile: const res = await fetch(rawUrl(r, source));
  • scripts/sync-sibling-docs.ts:450 — fetchBinary: const res = await fetch(rawUrl(r, source)); (called once per referenced asset, so a single stalled image stalls the whole step)
  • scripts/update-meeting-recordings.ts:126 — const response = await fetch(FEED_URL);

scripts/run-sync-step.ts only propagates the child's exit code; it has no deadline of its own, so it cannot help here.

Impact

  • CI build / Netlify deploys fail by job timeout instead of by a fast, attributable error.
  • DOCS_SYNC_OPTIONAL=1 (the offline/local fallback) never gets a chance to engage, because the step never exits.

Proposed fix

Add one small shared helper (e.g. scripts/fetch-with-timeout.ts) that wraps fetch in an AbortController with a bounded deadline (30–60s, overridable via an env var for slow networks), rethrows an abort as a clear Error("timed out after Ns fetching <url>"), and use it at the four call sites above. Keep existing non-2xx semantics (throw in fetchText, null in fetchFile/fetchBinary, warn-and-keep-committed-data in update-meeting-recordings.ts). Add a vitest covering the timeout path with a fake fetch that never resolves.

Decision taken by hive: single shared helper + per-request timeout (simplest additive, backward-compatible option); no per-step total budget in this change.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    agent/scannerCreated by Hive for agent-filed issue provenance
    kind/bugCreated by Hive for agent-filed issue provenance
    stage/020-claimedClaimed by the scanner or a relay contributor
    and removed
    stage/020-claimedClaimed by the scanner or a relay contributor
    on Oct 20, 2026
  2. hivecommons-hive commented on Oct 20, 2026

    @hivecommons-hive
    ContributorAuthor

    Folded finding. This was filed as a separate issue, but 1 open agent-filed issue (plus 5 closed as completed in the last 14 days) already cite scripts/sync-hive-docs.ts, so it was folded into the oldest of them instead of opening another. Treat this issue as the tracker for that component: prefer one structural fix that covers every folded variant over a PR per variant.

    Review backlog (style): New import breaks alphabetical sibling-import order in sync-hive-docs.ts

    Filed from an out-of-scope finding in the Hive review of PR #395.

    PR: #395 (#395)
    Perspective: style
    Severity: info (P3)
    Evidence: scripts/sync-hive-docs.ts:7 (

    import { fetchTextWithTimeout } from "./fetch-with-timeout";
    )
    Finding: New import breaks alphabetical sibling-import order in sync-hive-docs.ts

    scripts/sync-hive-docs.ts:7 inserts ./fetch-with-timeout after ./link-rewrite, while the surrounding relative imports (link-rewrite, markdown-fences, scrub-legacy-branding) are alphabetical and sync-sibling-docs.ts:18 places the same import correctly. No eslint import/order rule exists (eslint.config.mjs), so this is cosmetic only.

    Fingerprint: f724ed74fad77f2ad4efd32307704f389b81397fd2ada341a9e3bfa64222d9fa

    filed by Hive review backlog

  3. hivecommons-hive commented on Oct 20, 2026

    @hivecommons-hive
    ContributorAuthor

    Linked again from the Hive review of PR #395.

  4. added a commit that references this issue on Oct 20, 2026
    3a30e2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/reviewerCreated by Hive for agent-filed issue provenanceagent/scannerCreated by Hive for agent-filed issue provenancehive/claimed-by-scannerkind/bugCreated by Hive for agent-filed issue provenancestage/040-covered-by-prAn open PR covers this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions