Improve error handling and sanitization in tool execution - #183
Merged
artemo-brd merged 11 commits intoSep 11, 2026
Merged
Conversation
- scrape_batch now returns a sanitized per-URL error message instead of serializing the raw rejection reason, matching the existing pattern in search_engine_batch. - Added a centralized error-sanitization boundary in tool_fn so no tool can propagate an unsanitized exception object out of a tool call. - Added a defense-in-depth Axios interceptor that redacts sensitive request headers on errors. - Extracted the sanitization helpers into a standalone, unit-tested error_sanitizer.js module. - Removed an internal stack trace from the ARIA snapshot filter's error output. - Added regression and unit tests covering a wide range of failure modes (HTTP errors, timeouts, DNS/TLS/connection failures, non-Error rejections, and malicious toJSON()). Bump version to 2.11.2.
…file
- scrape_batch and search_engine_batch now route failures through the
shared sanitize_error() instead of e.message/String(e) locally.
- scrape_batch keeps its original Promise.allSettled response shape
({status, value|reason}); a rejected item's reason is now always a
sanitized string.
- Add an overridable base URL constant so requests can be pointed at a
local stub server for tests.
- Add a fully offline, deterministic test using a local HTTP stub covering
a partial batch (one success, one failure).
- Sync package-lock.json version to 2.11.2.
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
Improve handling errors across tool executions, particularly for
scrape_batch. Failed entries and tool errors now return clean, sanitized messages, improving consistency and robustness of tool output.Also includes: