From 0464126c83ec2fee1c3ba944c3fcce33a9606695 Mon Sep 17 00:00:00 2001 From: "langsmith-forge[bot]" <270983758+langsmith-forge[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 14:14:44 -0700 Subject: [PATCH] fix: warn against using http_request for GitHub PR creation (#1203) * fix: warn against using http_request for GitHub PR creation - Root cause: http_request tool description and system prompt lacked explicit guidance not to use it for GitHub PR operations, causing the agent to fall back to it and receive 401 Unauthorized responses - Change: added clear warnings to both the http_request docstring and the TOOL_USAGE_SECTION in prompt.py directing agents to use commit_and_open_pr instead - Verified: docstring and prompt changes are minimal and scoped * fix: clarify http_request PR guidance --------- Co-authored-by: LangSmith Forge Co-authored-by: Johannes du Plessis --- agent/prompt.py | 1 + agent/tools/http_request.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/agent/prompt.py b/agent/prompt.py index abfb7ecc..5dae7f70 100644 --- a/agent/prompt.py +++ b/agent/prompt.py @@ -138,6 +138,7 @@ Fetches a URL and converts HTML to markdown. Use for web pages. Synthesize the c #### `http_request` Make HTTP requests (GET, POST, PUT, DELETE, etc.) to APIs. Use this for API calls with custom headers, methods, params, or request bodies — not for fetching web pages. +Do not use this tool to create or update the pull request for completed code changes. Use `commit_and_open_pr` for that workflow so commits are pushed and GitHub authentication is handled correctly. For other PR-related actions, use the dedicated GitHub PR tools when available. #### `commit_and_open_pr` Commits all changes, pushes to a branch, and opens a **draft** GitHub PR. If a PR already exists for the branch, it is updated instead of recreated. diff --git a/agent/tools/http_request.py b/agent/tools/http_request.py index 942faba8..40a817a7 100644 --- a/agent/tools/http_request.py +++ b/agent/tools/http_request.py @@ -107,6 +107,11 @@ def http_request( ) -> dict[str, Any]: """Make HTTP requests to APIs and web services. + Do not use this tool to create or update the pull request for completed code + changes. Use `commit_and_open_pr` for that workflow so commits are pushed and + GitHub authentication is handled correctly. For other PR-related actions, use + the dedicated GitHub PR tools when available. + Args: url: Target URL method: HTTP method (GET, POST, PUT, DELETE, etc.)