Skip to content

Commit fc5cc28

Browse files
authored
chore: add implementation strategy guidance for compatibility decisions (#2600)
1 parent 2e1d608 commit fc5cc28

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: implementation-strategy
3+
description: Decide how to implement runtime and API changes in openai-agents-python before editing code. Use when a task changes exported APIs, runtime behavior, serialized state, tests, or docs and you need to choose the compatibility boundary, whether shims or migrations are warranted, and when unreleased interfaces can be rewritten directly.
4+
---
5+
6+
# Implementation Strategy
7+
8+
## Overview
9+
10+
Use this skill before editing code when the task changes runtime behavior or anything that might look like a compatibility concern. The goal is to keep implementations simple while protecting real released contracts.
11+
12+
## Quick start
13+
14+
1. Identify the surface you are changing: released public API, unreleased branch-local API, internal helper, persisted schema, wire protocol, CLI/config/env surface, or docs/examples only.
15+
2. Determine the latest release boundary:
16+
```bash
17+
BASE_TAG="$(.agents/skills/final-release-review/scripts/find_latest_release_tag.sh origin 'v*' 2>/dev/null || git tag -l 'v*' --sort=-v:refname | head -n1)"
18+
echo "$BASE_TAG"
19+
```
20+
3. Judge breaking-change risk against that latest release tag, not against unreleased branch churn or post-tag changes already on `main`.
21+
4. Prefer the simplest implementation that satisfies the current task. Update callers, tests, docs, and examples directly instead of preserving superseded unreleased interfaces.
22+
5. Add a compatibility layer only when there is a concrete released consumer or durable external state that requires it, or when the user explicitly asks for a migration path.
23+
24+
## Compatibility boundary rules
25+
26+
- Released public API or documented external behavior: preserve compatibility or provide an explicit migration path.
27+
- Persisted schema, serialized state, wire protocol, CLI flags, environment variables, and externally consumed config: treat as compatibility-sensitive even if the implementation is local.
28+
- Python-specific durable surfaces such as `RunState`, session persistence, exported dataclass constructor order, and documented model/provider configuration should be treated as compatibility-sensitive when they were part of the latest release tag.
29+
- Interface changes introduced only on the current branch: not a compatibility target. Rewrite them directly.
30+
- Interface changes present on `main` but added after the latest release tag: not a semver breaking change by themselves. Rewrite them directly unless they already define durable external state.
31+
- Internal helpers, private types, same-branch tests, fixtures, and examples: update them directly instead of adding adapters.
32+
33+
## Default implementation stance
34+
35+
- Prefer deletion or replacement over aliases, overloads, shims, feature flags, and dual-write logic when the old shape is unreleased.
36+
- Do not preserve a confusing abstraction just because it exists in the current branch diff.
37+
- If review feedback claims a change is breaking, verify it against the latest release tag and actual external impact before accepting the feedback.
38+
- If a change truly crosses the latest released contract boundary, call that out explicitly in the ExecPlan, release notes context, and user-facing summary.
39+
40+
## When to stop and confirm
41+
42+
- The change would alter behavior shipped in the latest release tag.
43+
- The change would modify durable external data, protocol formats, or serialized state.
44+
- The user explicitly asked for backward compatibility, deprecation, or migration support.
45+
46+
## Output expectations
47+
48+
When this skill materially affects the implementation approach, state the decision briefly in your reasoning or handoff, for example:
49+
50+
- `Compatibility boundary: latest release tag v0.x.y; branch-local interface rewrite, no shim needed.`
51+
- `Compatibility boundary: released RunState schema; preserve compatibility and add migration coverage.`

.agents/skills/pr-draft-summary/SKILL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Produce the PR-ready summary required in this repository after substantive code
1818
- Working tree: `git status -sb`.
1919
- Untracked files: `git ls-files --others --exclude-standard` (use with `git status -sb` to ensure they are surfaced; `--stat` does not include them).
2020
- Changed files: `git diff --name-only` (unstaged) and `git diff --name-only --cached` (staged); sizes via `git diff --stat` and `git diff --stat --cached`.
21+
- Latest release tag (prefer remote-aware lookup): `LATEST_RELEASE_TAG=$(.agents/skills/final-release-review/scripts/find_latest_release_tag.sh origin 'v*' 2>/dev/null || git tag -l 'v*' --sort=-v:refname | head -n1)`.
2122
- Base reference (use the branch's upstream, fallback to `origin/main`):
2223
- `BASE_REF=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null || echo origin/main)`.
2324
- `BASE_COMMIT=$(git merge-base --fork-point "$BASE_REF" HEAD || git merge-base "$BASE_REF" HEAD || echo "$BASE_REF")`.
@@ -27,7 +28,7 @@ Produce the PR-ready summary required in this repository after substantive code
2728
## Workflow
2829
1) Run the commands above without asking the user; compute `BASE_REF`/`BASE_COMMIT` first so later commands reuse them.
2930
2) 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.
30-
3) 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.
31+
3) 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 only when the diff changes released public APIs, external config, persisted data, serialized state, or wire protocols. Judge that risk against `LATEST_RELEASE_TAG`, not unreleased branch-only churn.
3132
4) 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.
3233
5) Choose the lead verb for the description: feature → `adds`, bug fix → `fixes`, refactor/perf → `improves` or `updates`, docs-only → `updates`.
3334
6) Suggest a branch name. If already off main, keep it; otherwise propose `feat/<slug>`, `fix/<slug>`, or `docs/<slug>` based on the primary area (e.g., `docs/pr-draft-summary-guidance`).

AGENTS.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ You can skip `$code-change-verification` for docs-only or repo-meta changes (for
3030

3131
When working on OpenAI API or OpenAI platform integrations in this repo (Responses API, tools, streaming, Realtime API, auth, models, rate limits, MCP, Agents SDK or ChatGPT Apps SDK), use `$openai-knowledge` to pull authoritative docs via the OpenAI Developer Docs MCP server (and guide setup if it is not configured).
3232

33+
#### `$implementation-strategy`
34+
35+
Before changing runtime code, exported APIs, external configuration, persisted schemas, wire protocols, or other user-facing behavior, use `$implementation-strategy` to decide the compatibility boundary and implementation shape. Judge breaking changes against the latest release tag, not unreleased branch-local churn. Interfaces introduced or changed after the latest release tag may be rewritten without compatibility shims unless they define durable external state or the user explicitly asks for a migration path.
36+
3337
### ExecPlans
3438

35-
Call out potential backward compatibility or public API risks early in your plan and confirm the approach before implementing changes that could impact users.
39+
Call out compatibility risk early in your plan only when the change affects behavior shipped in the latest release tag or durable external state, and confirm the approach before implementing changes that could impact users.
3640

37-
Use an ExecPlan when work is multi-step, spans several files, involves new features or refactors, or is likely to take more than about an hour. Start with the template and rules in `PLANS.md`, keep milestones and living sections (Progress, Surprises & Discoveries, Decision Log, Outcomes & Retrospective) up to date as you execute, and rewrite the plan if scope shifts. If you intentionally skip an ExecPlan for a complex task, note why in your response so reviewers understand the choice.
41+
Use an ExecPlan when work is multi-step, spans several files, involves new features or refactors, or is likely to take more than about an hour. Start with the template and rules in `PLANS.md`, keep milestones and living sections (Progress, Surprises & Discoveries, Decision Log, Outcomes & Retrospective) up to date as you execute, and rewrite the plan if scope shifts. Call out compatibility risk only when the plan changes behavior shipped in the latest release tag or durable external state. Do not treat branch-local interface churn or unreleased post-tag changes on `main` as breaking by default; prefer direct replacement over compatibility layers in those cases. If you intentionally skip an ExecPlan for a complex task, note why in your response so reviewers understand the choice.
3842

3943
### Public API Positional Compatibility
4044

@@ -98,7 +102,7 @@ The OpenAI Agents Python repository provides the Python Agents SDK, examples, an
98102
```
99103
2. If dependencies changed or you are setting up the repo, run `make sync`.
100104
3. Implement changes and add or update tests alongside code updates.
101-
4. Highlight backward compatibility or API risks in your plan before implementing breaking or user-facing changes.
105+
4. Highlight compatibility or API risks in your plan before implementing changes that alter the latest released behavior or durable external state.
102106
5. Build docs when you touch documentation:
103107
```bash
104108
make build-docs

0 commit comments

Comments
 (0)