fix(web): make web_search and web_fetch errors actionable#632
Merged
esengine merged 2 commits intoMay 11, 2026
Merged
Conversation
Bare HTTP status codes and terse refusal messages gave the model no signal about what to do next, leading it to either retry blindly or abandon the tool. Each error now carries a short " — try: …" tail tailored to the failure mode (429 backoff, 403 client-block, timeout, oversize body, unreachable SearXNG, invalid URL) so the model can self-correct without a human in the loop.
Biome's formatter flagged the existing single-line `expect(...).rejects.toThrow(...)` calls as needing the multi-line layout. Reformat to satisfy the formatter so `npm run lint` is clean.
esengine
added a commit
that referenced
this pull request
May 11, 2026
Hotfix for 0.39.0 install failure: the `postinstall: patch-package` hook + missing `patch-package` runtime dep + missing `patches/` in the files array meant fresh `npm install` / `npx reasonix@latest` runs crashed before the binary was usable. 0.39.0 has been deprecated on npm and `latest` rolled back to 0.38.0. Removes the patch-package machinery entirely — it can't work for a published library since npm hoists `ink` out of reasonix's own `node_modules`. The ink alt-screen render fix (#639) will return via a forked ink + `npm:` alias (#663) in a later release. Piggybacks three PRs that landed since 0.39.0: - #632 fix(web): actionable web_search / web_fetch errors - #661 feat(composer): Ctrl+X opens \$EDITOR - #662 feat(composer): Ctrl+P / Ctrl+N picker navigation
This was referenced May 11, 2026
esengine
added a commit
that referenced
this pull request
May 11, 2026
) #632 actionable-error work stopped at 429 + 403 — generic 5xx still fell through to the catch-all "rephrase the query / switch engine" message, which is the wrong advice for a transient server-side failure. Add serverError5xx + fetchServerError5xx pointing the model at a browser sanity-check and a 30s retry instead. Existing webSearch 503 test tightened from `/web_search 503.*try:/` to assert on the new `retry in 30s` substring; a parallel webFetch 502 test added in the same shape. Credit to @MyPrototypeWhat — #671 surfaced the gap and the 503 test case lands with this PR.
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
* fix(web): make web_search and web_fetch errors actionable Bare HTTP status codes and terse refusal messages gave the model no signal about what to do next, leading it to either retry blindly or abandon the tool. Each error now carries a short " — try: …" tail tailored to the failure mode (429 backoff, 403 client-block, timeout, oversize body, unreachable SearXNG, invalid URL) so the model can self-correct without a human in the loop. * style(tests): reformat web-tools assertions for biome Biome's formatter flagged the existing single-line `expect(...).rejects.toThrow(...)` calls as needing the multi-line layout. Reformat to satisfy the formatter so `npm run lint` is clean.
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
Hotfix for 0.39.0 install failure: the `postinstall: patch-package` hook + missing `patch-package` runtime dep + missing `patches/` in the files array meant fresh `npm install` / `npx reasonix@latest` runs crashed before the binary was usable. 0.39.0 has been deprecated on npm and `latest` rolled back to 0.38.0. Removes the patch-package machinery entirely — it can't work for a published library since npm hoists `ink` out of reasonix's own `node_modules`. The ink alt-screen render fix (esengine#639) will return via a forked ink + `npm:` alias (esengine#663) in a later release. Piggybacks three PRs that landed since 0.39.0: - esengine#632 fix(web): actionable web_search / web_fetch errors - esengine#661 feat(composer): Ctrl+X opens \$EDITOR - esengine#662 feat(composer): Ctrl+P / Ctrl+N picker navigation
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
…sengine#676) esengine#632 actionable-error work stopped at 429 + 403 — generic 5xx still fell through to the catch-all "rephrase the query / switch engine" message, which is the wrong advice for a transient server-side failure. Add serverError5xx + fetchServerError5xx pointing the model at a browser sanity-check and a 30s retry instead. Existing webSearch 503 test tightened from `/web_search 503.*try:/` to assert on the new `retry in 30s` substring; a parallel webFetch 502 test added in the same shape. Credit to @MyPrototypeWhat — esengine#671 surfaced the gap and the 503 test case lands with this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Errors thrown by
web_searchandweb_fetchpreviously surfaced as bare status codes or terse refusals (web_search 429,web_fetch: url must start with http:// or https://), giving the model no signal about what to do next. Each error path now appends a short— try: …tail tailored to the failure mode so the model can self-correct (back off on 429, switch engine on 403, pick a smaller URL on oversize, etc.) without a human in the loop.Changes
src/tools/web.ts: addsearchStatusError/fetchStatusErrorhelpers that branch on429and403and fall back to the generic status template; route the non-2xx throws insearchMojeek,searchSearxng, andwebFetchthrough them.src/tools/web.ts: track atimedOutflag around the internalAbortControllerinwebFetchso a timer-driven abort throws the newfetchTimeoutmessage (with{ms}and{url}), while a caller-cancelled abort re-throws unchanged.src/i18n/EN.tsandsrc/i18n/zh-CN.ts: append— try: …tails to every existingwebErrorstemplate (status, mojeekBlocked, mojeekNoResults, invalidEndpoint, endpointMustBeHttp, cannotReach, searxngNoResults, fetchStatus, fetchTooLarge, fetchBodyTooLarge, fetchInvalidUrl) and add three new keys:rateLimit429,forbidden403,fetchRateLimit429,fetchForbidden403,fetchTimeout.src/i18n/types.ts: extend thewebErrorsinterface with the new keys so both locales stay in sync under the existingTranslationSchematyping.tests/web-tools.test.ts: add coverage asserting the new tails —429returns the wait-and-retry hint,403returns the switch-engine hint on search and the bot-block hint on fetch, and the existing non-2xx test still matches its/web_search 429/prefix.Testing
npm run test -- web— the targetedweb-toolssuite passes, including the existing non-2xx assertion (theweb_search 429prefix is preserved ahead of the new tail) and the three new hint assertions.Notes
The 429 and 403 branches are split out as their own keys rather than formatted inline so translators can tune the wording per locale; the generic
status/fetchStatustemplates still cover every other non-2xx code. ThetimedOutflag is deliberately scoped so only the internal timer produces the timeout hint — anEsc-driven caller abort still propagates as-is.Closes #16