Skip to content

fix: warn against using http_request for GitHub PR creation#1203

Open
langsmith-forge[bot] wants to merge 1 commit intomainfrom
auto/agent-fix-http-request-pr-creation
Open

fix: warn against using http_request for GitHub PR creation#1203
langsmith-forge[bot] wants to merge 1 commit intomainfrom
auto/agent-fix-http-request-pr-creation

Conversation

@langsmith-forge
Copy link
Copy Markdown

Problem

The agent uses the http_request tool to POST to the GitHub PR creation API (/repos/{owner}/{repo}/pulls) instead of using commit_and_open_pr. Because http_request sends no authentication headers, these calls always return 401 Unauthorized, causing PR creation to fail silently.

Traces:

Root cause

The http_request tool docstring and the TOOL_USAGE_SECTION in prompt.py contained no guidance that this tool cannot be used for GitHub PR operations. Without an explicit prohibition, the agent fell back to http_request when 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_pr instead" warning to both:

  • agent/tools/http_request.py — the function docstring the LLM sees as a tool description
  • agent/prompt.py — the TOOL_USAGE_SECTION #### http_request entry in the system prompt

Evidence

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.

  • CI checks pass locally
  • Existing tests pass, no regressions
  • Change is minimal and scoped (5 lines added, no logic changed)

- 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
Copy link
Copy Markdown

@ArshVermaGit Arsh Verma (ArshVermaGit) left a comment

Choose a reason for hiding this comment

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

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.

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.

1 participant