fix: warn against using http_request for GitHub PR creation#1203
fix: warn against using http_request for GitHub PR creation#1203langsmith-forge[bot] wants to merge 1 commit intomainfrom
Conversation
- 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
Arsh Verma (ArshVermaGit)
left a comment
There was a problem hiding this comment.
This is a sharp and practical fix that addresses a real behavioral gap in the agent’s tool selection logic. By explicitly clarifying that http_request must not be used for GitHub PR creation, the change removes ambiguity that was leading the model to consistently choose an unauthenticated path and silently fail with 401 errors. I particularly like that the guidance is reinforced in both the tool docstring and the central TOOL_USAGE_SECTION, ensuring the constraint is visible wherever the model reasons about tool usage. Keeping the change minimal and documentation-focused avoids unnecessary complexity while still materially improving reliability of PR automation flows. Overall, this is a high-leverage prompt alignment improvement that prevents a subtle but costly failure mode.
Problem
The agent uses the
http_requesttool to POST to the GitHub PR creation API (/repos/{owner}/{repo}/pulls) instead of usingcommit_and_open_pr. Becausehttp_requestsends no authentication headers, these calls always return 401 Unauthorized, causing PR creation to fail silently.Traces:
Root cause
The
http_requesttool docstring and theTOOL_USAGE_SECTIONinprompt.pycontained no guidance that this tool cannot be used for GitHub PR operations. Without an explicit prohibition, the agent fell back tohttp_requestwhen attempting to create PRs — which always fails with 401 because no Authorization header is sent.Fix
Added an explicit "Do NOT use this tool for GitHub PR operations — use
commit_and_open_prinstead" warning to both:agent/tools/http_request.py— the function docstring the LLM sees as a tool descriptionagent/prompt.py— theTOOL_USAGE_SECTION#### http_requestentry in the system promptEvidence
No tests written — this is a docstring/prompt wording change. Per project guidelines, brittle string-matching tests for prompt content add maintenance cost with no value.