Skip to content

feat: make webfetch tool's User-Agent no longer lie and respect robots.txt - #39757

Closed
ridiche34 wants to merge 1 commit into
anomalyco:devfrom
ridiche34:fix-impersonation
Closed

feat: make webfetch tool's User-Agent no longer lie and respect robots.txt#39757
ridiche34 wants to merge 1 commit into
anomalyco:devfrom
ridiche34:fix-impersonation

Conversation

@ridiche34

Copy link
Copy Markdown

Issue for this PR

Closes #14453

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Make the web fetch tool's User-Agent be "OpenCode/${InstallationVersion}" by default and can be changed in the config. Before sending a request, it checks the domain's robots.txt and fails if it disallows the user-agent or has unofficial instructions to disallow AI input in general. Can optionally be configured to also block the request if it disallows AI training (if your LLM provider trains on your queries). Can also be disabled entirely in the config. robots.txt files are cached in RAM for up to 45 minutes, purged when more than 500 entries are present.

How did you verify your code works?

Asked Big Pickle to check his User-Agent and if he can access various websites.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.
Not a UI change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebFetch UserAgent identifies as user, not as agent / bot

1 participant