From d430d5149bea1a1144c3669e7dd50dfe6963a9b1 Mon Sep 17 00:00:00 2001 From: LangSmith Forge Date: Fri, 17 Apr 2026 00:34:30 +0000 Subject: [PATCH] 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 --- agent/prompt.py | 1 + agent/tools/http_request.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/agent/prompt.py b/agent/prompt.py index 744935f99..295c1aebd 100644 --- a/agent/prompt.py +++ b/agent/prompt.py @@ -135,6 +135,7 @@ def _load_default_prompt() -> str: #### `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, update, or otherwise manage GitHub pull requests.** This tool sends no GitHub authentication and will receive a 401 Unauthorized from the GitHub API. Always use `commit_and_open_pr` for GitHub PR operations. #### `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 942faba8d..471db48f9 100644 --- a/agent/tools/http_request.py +++ b/agent/tools/http_request.py @@ -107,6 +107,10 @@ def http_request( ) -> dict[str, Any]: """Make HTTP requests to APIs and web services. + Do NOT use this tool to create, update, or otherwise manage GitHub pull requests — + always use the `commit_and_open_pr` tool for that. This tool sends no GitHub + authentication and will receive a 401 Unauthorized response from the GitHub API. + Args: url: Target URL method: HTTP method (GET, POST, PUT, DELETE, etc.)