Skip to content

Commit 44b1555

Browse files
docs: consolidate AGENTS.md guidance (#4254)
## Changes being requested Reduce AGENTS.md from 786 to 505 words (36%) by linking the existing contributor security and Python support policies, consolidating generated-file ownership, and shortening repeated prose. Retain the unique agent requirements, CODEOWNER/security regression gates, complete Python-version validation command sequence, automation isolation, and large-payload compatibility/test constraints. Preserve the generated-file-ownership anchor. ## Additional context & links Validation: - Completed basic diff and semantic-preservation review, including proxy security review, Python-floor changes, automation authority, and large-payload regression scenarios. - Verified all local file links and heading anchors; retained original section anchors. - Compared the validation shell block byte-for-byte with the original; unchanged. - Diff whitespace check passed. - No Python lint/build/runtime tests run: only AGENTS.md changed; repository lint/format scripts do not check this Markdown file.
1 parent c6fc264 commit 44b1555

1 file changed

Lines changed: 22 additions & 85 deletions

File tree

‎AGENTS.md‎

Lines changed: 22 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,41 @@
11
# Repository Guidance
22

3-
## Generated SDK
4-
5-
Most SDK source is generated from the OpenAI API schema. Follow `CONTRIBUTING.md` before
6-
changing generated files. Handwritten policy, automation, tests, and examples
7-
should remain small and should not alter exported SDK APIs unless the change
8-
explicitly requires it.
3+
<a id="generated-file-ownership"></a>
94

10-
## Generated-file ownership
5+
## Generated SDK
116

12-
Follow [Modifying/Adding code](CONTRIBUTING.md#modifyingadding-code) to identify the source of a fix before editing SDK files.
7+
Most SDK source is generated from the OpenAI API schema. Before editing, follow [Modifying/Adding code](CONTRIBUTING.md#modifyingadding-code) to identify schema/generator/handwritten ownership. Keep handwritten policy, automation, tests, and examples small; alter exported APIs only when explicitly required.
138

149
## Security requirements for coding agents
1510

16-
- Never commit real API or admin keys, bearer tokens, webhook secrets, cloud
17-
credentials, X.509 private keys, release credentials, or `.env` files. Read
18-
`OPENAI_API_KEY`, `OPENAI_ADMIN_KEY`, `OPENAI_WEBHOOK_SECRET`, and other
19-
credentials from the environment; use clearly fake examples and fixtures.
20-
- Redact credentials, `Authorization` and `api-key` headers, customer data, and
21-
sensitive request or response bodies from logs, exceptions, snapshots, and
22-
test output. Clearly fake or sanitized fixtures and safe `APIError.body`
23-
diagnostics may remain. Preserve existing sensitive-header filtering,
24-
including debug logging.
25-
- Review direct and transitive dependency changes in `pyproject.toml`, optional
26-
extras, dependency groups, and `uv.lock`. Check
27-
package provenance, build backends, and install scripts before accepting or
28-
running them.
29-
- Pin third-party GitHub Actions to reviewed full commit SHAs. Minimize
30-
job-level token permissions and never expose secrets or write-capable tokens
31-
to untrusted pull-request code.
32-
- Preserve separate build and publish jobs, protected release credentials, and
33-
PyPI Trusted Publishing. Grant `id-token: write` only to the trusted,
34-
upload-only publishing job; do not introduce long-lived PyPI tokens.
35-
- Obtain SDK CODEOWNER review and add focused synchronous and asynchronous
36-
security regression tests, as applicable, for changes to authentication,
37-
X.509 or webhook verification, HTTP destinations, redirects, proxies, TLS,
38-
cloud metadata, file uploads, serialization, dependencies, GitHub Actions,
39-
or release workflows.
40-
- Report suspected vulnerabilities privately as described in `SECURITY.md`;
41-
never disclose them in public issues, pull requests, or logs.
11+
Read and apply [contributor security requirements](CONTRIBUTING.md#security-requirements-for-contributions) for credentials, synthetic fixtures, redaction, dependency provenance/hooks, pinned actions, CI isolation, and publishing. Follow [SECURITY.md](SECURITY.md) for private reporting; never disclose vulnerabilities in public issues, PRs, or logs.
12+
13+
- Redact sensitive data from test output; preserve sensitive-header filtering, including debug logs. Clearly fake/sanitized fixtures and safe `APIError.body` diagnostics may remain.
14+
- Review all dependency groups, direct/transitive packages, extras, `uv.lock`, build backends, and install hooks before accepting or executing them.
15+
- Keep build/publish jobs separate; grant `id-token: write` only to the trusted upload-only job with protected credentials and PyPI Trusted Publishing. No long-lived PyPI tokens.
16+
- Obtain SDK CODEOWNER review and focused sync/async security regressions, as applicable, for the contributor guide's sensitive-change categories, including proxies.
4217

4318
## Python version policy
4419

45-
- `requires-python` in `pyproject.toml` is the authoritative technical minimum.
46-
- `PYTHON_VERSION_POLICY.md` is the human-readable support and release policy.
47-
- Support every fully released, non-EOL CPython line. A documented grace period
48-
may temporarily add the most recently retired line.
49-
- Keep `requires-python`, classifiers, dependency markers, README requirements,
50-
static-analysis targets, `.python-version`, and CI synchronized.
51-
- Do not combine a minimum-Python change with unrelated SDK or dependency
52-
upgrades.
20+
Read [PYTHON_VERSION_POLICY.md](PYTHON_VERSION_POLICY.md) for support, grace periods, release rules, and testing. `pyproject.toml#requires-python` owns the technical minimum. Keep classifiers, dependency markers, README requirements, analysis targets, `.python-version`, and CI synchronized; separate floor changes from unrelated SDK/dependency upgrades.
5321

5422
## Changing the minimum Python version
5523

56-
1. Update `pyproject.toml`, `.python-version`, the lock files, README,
57-
`CONTRIBUTING.md`, and `PYTHON_VERSION_POLICY.md`.
58-
2. Remove dependency branches that only served the retired runtime.
59-
3. Update minimum/current and full-matrix CI coverage.
60-
4. Build both distributions and validate their `Requires-Python` metadata and
61-
old-interpreter rejection behavior.
62-
5. Add a `## Release note` section to the pull request description naming the
63-
new minimum and final compatible SDK release. Do not promise security
64-
backports for the old release.
65-
6. Obtain SDK CODEOWNER approval.
24+
1. Update `pyproject.toml`, `.python-version`, locks, README, `CONTRIBUTING.md`, and `PYTHON_VERSION_POLICY.md`; remove dependency branches serving only the retired runtime.
25+
2. Update minimum/current and full-matrix CI; build both distributions and validate `Requires-Python` metadata and old-interpreter rejection.
26+
3. Add a `## Release note` PR section naming the new minimum and final compatible SDK release; do not promise security backports.
27+
4. Obtain SDK CODEOWNER approval.
6628

67-
The deterministic Python policy check proves repository surfaces agree. It
68-
does not decide whether an EOL grace period or floor increase is appropriate.
29+
The deterministic policy check proves consistency, not whether grace or a floor increase is appropriate.
6930

7031
## Automation map
7132

72-
- `.github/workflows/ci.yml`
73-
- On pull requests and branch pushes: lint, build, metadata validation, and
74-
tests on the minimum and current stable Python releases.
75-
- Nightly and manually: smoke-tests every supported Python release and the
76-
allowed-failure prerelease.
77-
- `.github/workflows/python-version-review.yml`
78-
- Monthly on the default branch: snapshots official CPython lifecycle data
79-
plus the public PyPI Python-minor distribution and asks Codex for a policy
80-
review.
81-
- Runs a pinned Codex runtime as an unprivileged user with no command network
82-
access and read-only repository permissions.
83-
- Codex cannot edit the repository or call GitHub. A separate job with no
84-
OpenAI credential opens or refreshes one issue only when action is needed.
85-
- Never changes the Python floor or merges code automatically.
33+
- [ci.yml](.github/workflows/ci.yml): PR/branch-push lint, build, metadata, and minimum/current tests; nightly/manual supported-version smoke matrix plus allowed-failure prerelease.
34+
- [python-version-review.yml](.github/workflows/python-version-review.yml): monthly default-branch review of official CPython lifecycle and public PyPI minor-version usage snapshots. Pinned Codex runs unprivileged, without command network access, with read-only repo permissions and no repository edits/GitHub calls. A separate job without OpenAI credentials opens/refreshes one issue only when needed. Never change the floor or merge automatically.
8635

8736
## Validation
8837

89-
Before publishing a Python-version change, run:
38+
Before publishing Python-version changes, run:
9039

9140
```sh
9241
uv lock
@@ -101,22 +50,10 @@ uv run --locked --all-extras python scripts/utils/validate-httpx2-wheel.py
10150
./scripts/test
10251
```
10352

104-
Also run the scheduled compatibility matrix before release.
53+
Run the scheduled compatibility matrix before release.
10554

10655
## Large-payload compatibility
10756

108-
Treat large payloads as a normal API contract, not evidence of malformed or
109-
hostile input. Responses, Chat Completions, and other APIs can legitimately
110-
return large `application/json` bodies and streaming events. Do not introduce
111-
arbitrary fixed limits on bodies, events, or lines as a security or efficiency
112-
fix. Prefer incremental processing, amortized-linear buffering, timely cleanup,
113-
and caller cancellation. Any new rejection limit needs an explicit,
114-
owner-approved API contract and a review of existing supported payloads and
115-
transports.
116-
117-
Protect this behavior with focused, deterministic public-entrypoint tests using
118-
large synthetic payloads generated in memory, not committed captures or live
119-
image generation. Their high memory use is intentional: do not shrink the
120-
payloads or raise client limits to make the tests pass. Keep coverage to the main
121-
JSON and streaming categories, and run large cases sequentially to keep peak
122-
memory reasonable. The fixture size is a regression probe, not a new API maximum.
57+
Large JSON bodies and streaming events are legitimate Responses, Chat Completions, and other API payloads, not inherently malformed/hostile. No arbitrary body/event/line caps: prefer incremental processing, amortized-linear buffering, cleanup, and caller cancellation. New rejection limits require an explicit owner-approved API contract and review of supported payloads/transports.
58+
59+
Use deterministic public-entrypoint tests with large synthetic in-memory payloads, not committed captures or live image generation. High memory use is intentional: do not shrink payloads or raise client limits to pass. Cover main JSON/streaming categories and run large cases sequentially. Fixture size is a regression probe, not an API maximum.

0 commit comments

Comments
 (0)