Skip to content

Return tool errors for invalid web fetch URLs#61

Merged
MohamedAkbarally merged 5 commits into
mainfrom
handle-invalid-web-fetch-url
Jul 8, 2026
Merged

Return tool errors for invalid web fetch URLs#61
MohamedAkbarally merged 5 commits into
mainfrom
handle-invalid-web-fetch-url

Conversation

@MohamedAkbarally

Copy link
Copy Markdown
Contributor

Summary

  • Return a failed ToolResult when fetch_web_page receives a non-absolute web URL, such as a local filesystem path.
  • Keep the existing httpx fetch path unchanged for absolute http:// and https:// URLs.
  • Add focused tests for local-path rejection and unchanged valid URL fetching.

Backward compatibility

This is backward compatible because the new guard only intercepts inputs that httpx cannot fetch successfully with the existing default transport: URLs without an http/https scheme or without a network location. Any absolute HTTP or HTTPS URL still flows through the same _fetch implementation, headers, retries, and response handling as before. Previously crashing inputs now return success=False to the model instead of aborting the agent run.

Test plan

  • uv run ruff format src/stirrup/tools/web.py tests/test_web_search.py
  • uv run pytest tests/test_web_search.py
  • uv run ruff check src/stirrup/tools/web.py tests/test_web_search.py

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@MohamedAkbarally MohamedAkbarally requested review from declanjackson and keatingw and removed request for keatingw July 8, 2026 01:33
MohamedAkbarally and others added 3 commits July 8, 2026 01:35
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@MohamedAkbarally MohamedAkbarally requested a review from keatingw July 8, 2026 01:40

@declanjackson declanjackson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, just one small comment on the error msg

Comment thread src/stirrup/tools/web.py Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
@MohamedAkbarally MohamedAkbarally merged commit d4922f0 into main Jul 8, 2026
2 checks passed
@MohamedAkbarally MohamedAkbarally deleted the handle-invalid-web-fetch-url branch July 8, 2026 01:54
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.

2 participants