Skip to content

fix(link-understanding): honor global or largest model timeout for link fetches#100731

Merged
steipete merged 1 commit into
openclaw:mainfrom
cxbAsDev:fix/100660-link-understanding-fetch-timeout
Jul 6, 2026
Merged

fix(link-understanding): honor global or largest model timeout for link fetches#100731
steipete merged 1 commit into
openclaw:mainfrom
cxbAsDev:fix/100660-link-understanding-fetch-timeout

Conversation

@cxbAsDev

@cxbAsDev cxbAsDev commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #100660.

In runLinkUnderstanding() (src/link-understanding/runner.ts), the HTTP fetch timeout for every link was resolved from entries[0] only. If later model entries had larger timeoutSeconds, the fetch could still time out using the first entry's shorter window. The fetch phase is independent of any single CLI execution, so it should use either an explicit global link-tools timeout or the largest configured model timeout.

Why This Change Was Made

Introduced resolveFetchTimeoutMsFromConfig() which:

  1. Honors tools.links.timeoutSeconds when it is explicitly configured.
  2. Falls back to Math.max(...) across all configured model timeouts so slower entries are not capped by the first one.

The timeout is now computed once per call instead of once per URL.

User Impact

Link-understanding fetches no longer fail prematurely when the first configured model has a shorter timeout than later models. Users who set a global tools.links.timeoutSeconds get predictable fetch timeouts independent of model ordering.

Evidence

Added two regression tests in src/link-understanding/runner.test.ts that both fail on current main:

  • Global timeout test: with tools.links.timeoutSeconds: 15 and model timeouts 1 and 9, the fetch must use 15000 ms. On main it uses 1000 ms.
  • Fallback test: with no global timeout and model timeouts 1 and 9, the fetch must use 9000 ms. On main it uses 1000 ms.
pnpm test src/link-understanding/runner.test.ts -- --run

All six tests in the file pass.

@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Maintainer verification complete.

  • Blacksmith Testbox tbx_01kwv3cxf387yceenrhrmk7rr5: src/link-understanding/runner.test.ts — 6 passed.
  • Same Testbox: full check:changed for both touched files passed, including production/test typechecks and oxlint.
  • Current config help defines tools.links.timeoutSeconds as the per-link understanding budget; the implementation preserves that explicit global budget and otherwise uses the largest effective model/default timeout.
  • The SSRF guard, strict fetch mode, response-size bound, and per-entry CLI timeouts remain unchanged.
  • Fresh whole-branch autoreview: no actionable findings.
  • No independent delayed live-HTTP reproduction was run; the runner-to-guard timeout boundary is directly asserted.
  • Exact-head hosted CI: https://github.com/openclaw/openclaw/actions/runs/28776470452

Prepared head: 78f63b421300fa85e726f223d56148a4c77b3cae.

@steipete
steipete merged commit d6c880a into openclaw:main Jul 6, 2026
104 of 105 checks passed
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
@cxbAsDev
cxbAsDev deleted the fix/100660-link-understanding-fetch-timeout branch July 15, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: runLinkUnderstanding resolves HTTP fetch timeout from the first model entry only

2 participants