Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/agent-sops/task-implementer.sop.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,9 @@ If all tests are passing, draft a conventional commit message, perform the git c
- You MUST give an overview of the feature being implemented
- You MUST include any notes on key implementation decisions, ambiguity, or other information as part of the pull request description
- If the `create_pull_request` tool fails (excluding deferred responses):
- You MUST create a PR creation link using GitHub's query parameters
- You MUST post the link as a comment on the issue
- You MUST use the format: `https://github.com/{owner}/{repo}/compare/{base}...{head}?quick_pull=1&title={url_encoded_title}&body={url_encoded_body}`
- URL-encode the title and body parameters
- Include "Resolves: #{issue_number}" in the body
- The tool automatically handles fallback by posting a properly URL-encoded manual PR creation link as a comment on the specified fallback issue
- You MUST verify the fallback comment was posted successfully by checking the tool's return message
- You MUST NOT manually construct PR creation URLs since the tool handles URL encoding automatically
- If PR creation succeeds or is deferred:
- You MUST review your notes for any updates to provide on the pull request
- You MAY use the `update_pull_request` tool to update the pull request body or title
Expand Down
13 changes: 10 additions & 3 deletions .github/scripts/python/github_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from functools import wraps
import json
from typing import Any, TypedDict
from urllib.parse import urlencode, quote

import requests
from rich import box
Expand Down Expand Up @@ -363,9 +364,15 @@ def create_pull_request(title: str, head: str, base: str, body: str = "", repo:
agent_message = "Failed to create pull request, commenting on issue instead."
console.print(Panel(escape(agent_message), title="[bold yellow]Fallback", border_style="yellow"))
repo_name = repo or os.environ.get("GITHUB_REPOSITORY", "")
pr_link = f"https://github.com/{repo_name}/compare/{base}...{head}?quick_pull=1&title={title.replace(' ', '%20')}&body={body.replace(' ', '%20').replace('\n', '%0A')}"
fallback_comment = f"Failed to create pull request, you can create it by clicking this link:\n\n{pr_link}"
return add_issue_comment(fallback_issue_id, fallback_comment, repo)
query_params = urlencode({
'quick_pull': '1',
'title': title,
'body': body
}, quote_via=quote)
pr_link = f"https://github.com/{repo_name}/compare/{base}...{head}?{query_params}"
fallback_comment = f"Unable to create pull request via API. You can create it manually by clicking [here]({pr_link})."
add_issue_comment(fallback_issue_id, fallback_comment, repo)
return f"Unable to create pull request via API - posted a manual creation link as a comment on issue #{fallback_issue_id}"
else:
error_msg = f"Error: {e!s}"
console.print(Panel(escape(error_msg), title="[bold red]Error", border_style="red"))
Expand Down
Loading