PR Draft Summary Purpose
Produce the PR-ready summary required in this repository after substantive code work is complete: a concise summary plus a PR-ready title and draft description that begins with "This pull request ...". The block should be ready to paste into a PR for openai-agents-python.
When to Trigger
The task for this repo is finished (or ready for review) and it touched runtime code, tests, examples, docs with behavior impact, or build/test configuration.
You are about to send the "work complete" response and need the PR block included.
Skip only for trivial or conversation-only tasks where no PR-style summary is expected.
Inputs to Collect Automatically (do not ask the user)
Current branch: git rev-parse --abbrev-ref HEAD.
Working tree: git status -sb.
Untracked files: git ls-files --others --exclude-standard (use with git status -sb to ensure they are surfaced; --stat does not include them).
Changed files: git diff --name-only (unstaged) and git diff --name-only --cached (staged); sizes via git diff --stat and git diff --stat --cached.
Base reference (use the branch's upstream, fallback to origin/main):
BASE_REF=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null || echo origin/main).
BASE_COMMIT=$(git merge-base --fork-point "$BASE_REF" HEAD || git merge-base "$BASE_REF" HEAD || echo "$BASE_REF").
Commits ahead of the base fork point: git log --oneline --no-merges ${BASE_COMMIT}..HEAD.
Category signals for this repo: runtime (src/agents/), tests (tests/), examples (examples/), docs (docs/, mkdocs.yml), build/test config (pyproject.toml, uv.lock, Makefile, .github/).
Workflow
Run the commands above without asking the user; compute BASE_REF/BASE_COMMIT first so later commands reuse them.
If there are no staged/unstaged/untracked changes and no commits ahead of ${BASE_COMMIT}, reply briefly that no code changes were detected and skip emitting the PR block.
Infer change type from the touched paths listed under "Category signals"; classify as feature, fix, refactor, or docs-with-impact, and flag backward-compatibility risk when runtime code changed.
Summarize changes in 1–3 short sentences using the key paths (top 5) and git diff --stat output; explicitly call out untracked files from git status -sb/git ls-files --others --exclude-standard because --stat does not include them. If the working tree is clean but there are commits ahead of ${BASE_COMMIT}, summarize using those commit messages.
Choose the lead verb for the description: feature → adds, bug fix → fixes, refactor/perf → improves or updates, docs-only → updates.
Suggest a branch name. If already off main, keep it; otherwise propose feat/
When closing out a task and the summary block is desired, add this concise Markdown block (English only) after any brief status note. If the user says they do not want it, skip this section.
Pull Request Draft
Branch name suggestion
git checkout -b
Title
Description
Keep it tight—no redundant prose around the block, and avoid repeating details between Changes and the description. Tests do not need to be listed unless specifically requested.