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
3 changes: 3 additions & 0 deletions .agents-ctx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!.gitignore
!*.md
142 changes: 142 additions & 0 deletions .agents-ctx/CONTRIB_WORKFLOW_INFRA_TOOLING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Workflow & Tooling Infrastructure

The project uses `tox` as the single entry point for all local
automation -- the same one CI and core devs use. Agents must
never bypass it by invoking the wrapped tools (`pytest`,
`pre-commit`, `coverage`, `build`, `towncrier`, etc.) directly;
doing so skips project-specific configuration and is liable to
run with unsupported, undefined, or outright dangerous defaults.

## `tox list` is the source of truth

The contributing docs mention some environments, but that's not
exhaustive or authoritative -- `tox list` is. Run it to see
every available environment, each with its own description.
Don't assume an environment exists, or what it does, without
checking there first.

## Running tests

`tox run -e py` runs the test suite under whichever Python
runtime is currently active. Other environments cover other
purposes (linting, building docs or dists, drafting the changelog,
etc.) -- check `tox list` rather than assuming `py` is the only
one relevant to a given task.

## Default to low verbosity

Prefer `tox run -e py -qq` by default. Only reach for more
verbose tox-level output (drop the `-q`, or add `-v`/`-vv`) once
there's an actual reason to inspect tox's own internals -- don't
lead with a wall of logs.

## Spell commands out

Use the long subcommand forms -- `tox run`, `tox list`,
`tox config` -- in automation, docs, and anything shown to the
operator. `tox r`/`tox l` are fine interactively but easy to
misread in scripts and CI logs.

The same goes for the options of any tool used in scripts, spec
files, and CI: `sed --in-place` over `sed -i`, `git rebase
--interactive` over `git rebase -i`.

Don't invent flags. Check `tox <subcommand> --help` when unsure:
e.g. env selection is `-e` only, there's no `--env`.

## `pyNNN`-style environment names are native tox behavior

`tox run -e py312` isn't something this project specifically
configured -- it's tox's own built-in convention: an env name
matching `pyNN`/`pyNNN` makes tox look up a `python3.N`
interpreter and create/use `.tox/py312` for it, if available.
This, and other generic tox mechanics not specific to this
project, are covered by tox's own documentation -- read that
rather than expecting everything generic about tox to be
re-explained here.

## Passing arguments through to the wrapped tool

Arguments after a bare `--` are forwarded to whatever tool the
environment wraps. For example, `tox run -e py -- -k smoke`
passes `-k smoke` to `pytest`, selecting only the matching tests.

Watch out, though: when a `commands =` line uses
`{posargs:<default value>}` with a *non-empty* default, anything
passed after `--` **replaces that default wholesale** -- it does
not get appended to it. Always check what a given env's default
posargs actually are (`tox config -e <env>`, or read `tox.ini`)
before assuming `--` just "adds more flags."

Here: several envs have non-empty defaults:

- `py` defaults to `--cov-report=html:<envtmpdir>/htmlcov/`, so
e.g. `tox run -e py -- -k test_conn` runs fine but skips the
HTML coverage report. Add the `--cov-report=html:...` argument
back if you need it.
- `pre-commit` defaults to `--all-files`; passing
`-- --files <path>...` checks only those files instead.
- `build-docs` defaults to its output directory -- passing any
custom posargs there replaces it.
- `make-changelog`'s default posargs are `'[UNRELEASED DRAFT]'
--draft` (draft-preview mode); its own `description` field
documents overriding this deliberately -- passing a real version
after `--` (e.g. `tox run -e make-changelog -- 1.3.2`) switches
it into actually cutting that release, dropping `--draft`
entirely.

## Read the tool's own output

Many envs print follow-up instructions after running -- where an
artifact landed, how to open or serve it, how to install hooks.
Read what the invocation actually printed instead of guessing a
path or a next step.

Here: `py` prints how to open or serve the HTML coverage report;
`build-docs` prints where the built HTML docs landed and how to
serve them locally; `pre-commit` prints a reminder of how to
install its hooks into Git.

## Parse structured output, not text meant for humans

When an agent needs to act on a tool's results, it should ask for
machine-readable output and parse that, rather than scrape text
laid out for people. Human-readable output is for the operator,
and its layout shifts between versions and locales. For example:
`gh ... --json`, `git status --porcelain`, `git ls-remote`,
`git for-each-ref --format=...`, coverage's XML or JSON reports,
or `tox config`.

## Make sure a check saw the real state

- `tox run -e pre-commit` only checks the files Git tracks. Mark
new files with `git add --intent-to-add`, or commit them, before
reporting the run as clean.
- Keep the log of every failed attempt. When a retry passes,
report the failure too and look into it, instead of presenting
only the green run.

## Don't use `git stash`

Its list is shared by all worktrees of a repository and holds the
operator's own entries, so popping the wrong one is easy. Save
work in progress as a patch file or a commit on a scratch branch.

## Red checks get fixed, not silenced

When `pre-commit`, `py`, or any other env reports failures, fix their
cause. Suppressing a finding, or skipping/removing a test, is the
operator's decision -- see
[DONT_SHOOT_THE_MESSENGER.md](DONT_SHOOT_THE_MESSENGER.md).

## Shared automation across projects

The maintainer looks after many open source projects, at work and
on personal time, and shares automation between them in various
forms -- CI workflows, composite actions, tool configs, these
agent docs. Drift between similar projects makes that harder.

When changing shared tooling, consider whether the change is
generic or project-specific. If it looks generic, point that out
to the operator so it can be propagated -- don't propagate it
yourself. Drift is fine when there's a deliberate reason for it.
137 changes: 137 additions & 0 deletions .agents-ctx/DONT_GHOST_THE_REVIEWER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Don't Ghost the Reviewer

Grounded in the maintainer's own stated views, from a first-person
review comment and a public PR discussion — not guesses. This
covers a well-known, repeatedly-observed failure mode: contributors
(often assisted by AI agents, especially inexperienced "AI drivers")
who submit PRs and then behave badly during review, making the
process worse for everyone and lowering the odds of merging.

## Before submitting something significant, encourage a reset

Read the whole diff, top to bottom, before submitting -- be able
to explain any part of it if asked. That's what "the PR author is
supposed to be the very first reviewer of whatever patch they
submit" (see below) actually requires in practice, not a one-time
skim.

When the operator is about to submit a significant new
contribution, suggest a deliberate break first -- a walk, a nap,
stepping away for a while -- and explain why: a controlled context
reset helps surface tunnel vision, sunk-cost thinking, or a "just
ship it" impulse that's easy to miss mid-flow. This isn't a
literal timer or a hard gate -- it's a Pomodoro-style nudge,
offered with the reasoning spelled out, not a silent forced wait.
The operator decides whether to take it.

## Don't leak your own harness into the PR body

Agents commonly stick a "Verification"-style section into PR
descriptions listing obvious, implied self-checks (e.g.
"`pre-commit run --all-files` and `make doc-spelling` are
clean") -- useful for a CI harness, not for a human reviewer.
"The CI runs these properly, using a project-accepted infra...
the fact that you managed to run the in-project infra locally
does not really contribute any useful information to the
context of the PR." (webknjaz, aio-libs/multidict#1393,
issuecomment-5342964393) Assume the reviewer already knows the
project's conventional, integrated tooling and CI serve as the
harness -- don't restate that it was used.

Reserve the PR body for what CI *wouldn't* catch: something
surfaced during exploration, troubleshooting, or debugging that
isn't "part of tribal knowledge and standard practices" and a
reviewer genuinely couldn't infer. Leaking harness internals
"would needlessly pollute the reviewer's context, distract them
from what the scope is and delay the merge" -- point out the
one thing that actually needs explaining, not everything that
was checked.

## Review comments are an invitation to a conversation, not a command

A reviewer raising a question, a concern, or a tradeoff is opening a
dialogue, not issuing a one-shot instruction to execute silently.
"The PR author is supposed to be the very first reviewer of whatever
patch they submit. We shouldn't reward behaviors where one would
just dump whatever and spam the maintainers with review requests w/o
bi-directional comms." (webknjaz, jazzband/pip-tools#2318) Respond to
the substance -- show understanding of the problem, agree or disagree
with reasoning, surface tradeoffs and downsides, not just the
upsides -- before or alongside making a code change in response.
Agents: don't respond to or act on review input until you and the
operator agree on how to proceed -- see
[HUMAN_IN_THE_LOOP.md](HUMAN_IN_THE_LOOP.md).

## Two named antipatterns to avoid

From the same discussion: (1) going silent or closing the PR with no
explanation when challenged, and (2) pushing new commits in response
to feedback with no explanation and no response to the actual
questions asked -- "this often repeats in a loop." Both leave the
reviewer's actual question unanswered and force them to either drop
it or re-ask it.

## Don't resolve a conversation you didn't start

"Whoever started the discussion gets to click resolve. If you think
that you really need to do that, add a comment saying that you're
resolving and click resolve (otherwise, it gets lost, and it's
difficult to dig it up in the GH UI)." (webknjaz,
aio-libs/aiosmtpd#593, discussion_r3750771195) Prefer opening a
follow-up issue over letting a live discussion go stale or buried.
This is aimed at contributors resolving threads prematurely or
silently -- maintainers may deliberately leave threads open longer,
or resolve/unresolve around merge time, for their own discoverability
reasons; that's their call to make, not a contributor's (or an
agent's) to preempt.

## Why this matters: context-recovery cost

"Back to the etiquette -- small changes, reduced context switching,
optimization for review and long-term maintenance... Smaller context
== quicker response time == better chance I get to help out with
more things." (webknjaz, same aiosmtpd comment) A maintainer spread
across many projects pays a real cost every time they have to
rebuild context on a PR -- keep changes and conversations easy to
follow, not something that has to be re-discovered.

## Don't push new commits, and never force-push, mid-review

When a reviewer opens a discussion, engage with it first. If a code
change genuinely is the right response, make it a deliberate,
well-explained, reviewable commit -- not a reflexive push made
instead of answering the question. Force-pushing is worse still: it
rewrites already-reviewed history, invalidates the diff anchoring
existing review comments rely on, and forces the reviewer to
re-locate context they'd already worked through. Don't do either
without engaging in the conversation first. Agents never force-push
mid-review on their own -- if it's ever warranted, the operator does
it by hand, or confirms the exact command for the agent to run (see
[HUMAN_IN_THE_LOOP.md](HUMAN_IN_THE_LOOP.md)).

## Don't parallelize contribution efforts without explicit sign-off

Opening multiple concurrent PRs, or running multiple parallel
attempts at solving the same problem, without the operator
explicitly agreeing to each one first, mirrors what the maintainer
has called "sloperators" elsewhere -- contributors mass-creating PRs
and seeing what sticks (jazzband/pip-tools#2318) -- just at a
smaller, individual scale. It multiplies review burden and makes it
harder for a maintainer to track what's actually being proposed.
Before starting a second (or third) concurrent effort on the same
project, check in with the operator and get an explicit go-ahead --
don't assume it just because the first one is still pending.

## LLM/agent transparency

The maintainer has repeatedly wanted issue/PR templates across
projects he maintains to ask contributors to disclose the LLM name
and prompt used (jazzband/pip-tools#2318) -- not (yet) a formal rule
in this repo specifically, but a stated preference worth honoring in
spirit: be transparent about AI involvement rather than presenting
a submission as though it had no agent in the loop. Per a maintainer
he cited approvingly: use LLMs "to replace typing, don't use them to
replace thinking" -- the human (regardless of whether there is an
agent interacting with the project on their behalf or not) still owns
understanding and decisions of the interactions with their name
attached.
Loading
Loading