Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2be5283
Add review system
jpsamaroo Nov 27, 2026
873d829
review: match the CI check names GitHub actually reports
jpsamaroo Nov 28, 2026
1a3af8c
review: give every problem a severity, and let it decide the verdict
jpsamaroo Nov 28, 2026
dc99aae
review: merge duplicate findings and lead the brief with what to decide
jpsamaroo Nov 28, 2026
8f6a8a8
review: answer the maintainer's obvious questions in the brief
jpsamaroo Nov 28, 2026
18ed98a
AGENTS.md: add an Invariants section, and the NoAliasing lesson
jpsamaroo Nov 28, 2026
7789b6c
review: let reviewers ask the maintainer, and re-run with the answers
jpsamaroo Nov 28, 2026
fa3b447
review: one worktree and branch per reviewed pull request
jpsamaroo Nov 28, 2026
e7c66ec
review: fixes from the first batch of PR reviews (#801, #803, #810, #…
jpsamaroo Nov 28, 2026
84c1476
AGENTS.md: two Datadeps invariants from the maintainer
jpsamaroo Nov 28, 2026
98c66c6
review: let the maintainer have findings fixed, not just answered
jpsamaroo Nov 28, 2026
41a9632
review: say how to run Dagger's tests from a review worktree without …
jpsamaroo Nov 28, 2026
8a5b3c4
review: let the maintainer put findings on hold until a condition is met
jpsamaroo Nov 28, 2026
61faa71
review: open the brief with the PR's title and a short summary of the…
jpsamaroo Nov 28, 2026
df943e5
review: list an unrecognized benchmark attachment once, not once per key
jpsamaroo Nov 28, 2026
1502b6e
review: bind each [[change]] and [[hold]] to the finding it was writt…
jpsamaroo Nov 29, 2026
03215a8
review: give `changes` push guidance that fits the PR, after listing …
jpsamaroo Nov 29, 2026
5c5aa47
review: show the author's PR description and commits to reviewers as …
jpsamaroo Nov 29, 2026
b7c6350
review: label attached measurements as the reviewer's, and gate passe…
jpsamaroo Nov 29, 2026
6d582c1
review: show failing and pending CI checks that belong to no configur…
jpsamaroo Nov 29, 2026
ca2f437
AGENTS.md: say which argument the NoAliasing invariant's by-value rul…
jpsamaroo Nov 29, 2026
772dfe2
CI: run the review tool's unit tests
jpsamaroo Nov 29, 2026
b7724e9
review: keep fragments that `rerun` set aside when `collect` runs again
jpsamaroo Nov 29, 2026
28005b8
review: reject `unverified` over a supported blocker or should-fix
jpsamaroo Nov 29, 2026
2b18d7f
review: make the quick-start commands run the main checkout's tool
jpsamaroo Nov 29, 2026
aa9c0f9
review: do not escape `<` inside Markdown code spans
jpsamaroo Nov 29, 2026
5412121
review: name a category once in "raised by", at its worst severity
jpsamaroo Nov 29, 2026
2c48e16
review: identify maintainer answers by their content, not their position
jpsamaroo Nov 29, 2026
ffacd28
review: refuse to submit evidence collected for a superseded PR head
jpsamaroo Nov 29, 2026
29eb477
review: collect a merged PR's own range, not an empty diff
jpsamaroo Nov 29, 2026
9588dee
review: have the skill say what to do with a rejected claim as REVIEW…
jpsamaroo Nov 29, 2026
4506d58
review: verify a finding's severity only by a claim that is that severe
jpsamaroo Nov 29, 2026
eedca7c
review: do not accept the whole of evidence.json as a claim's evidence
jpsamaroo Nov 29, 2026
de02968
review: compare each failing CI job with the same job on the base
jpsamaroo Nov 29, 2026
d924aba
review: do not give a one-line struct the next struct's fields
jpsamaroo Nov 29, 2026
8a55c88
review: see short-form methods named like `length`, and operator methods
jpsamaroo Nov 29, 2026
59f71dc
review: send an answer whose question was set aside by a re-collect
jpsamaroo Nov 29, 2026
f2e1145
review: have `status` read questions and answers as they stand now
jpsamaroo Nov 29, 2026
22b86ac
review: have `changes` mark branch commits that are not requested fixes
jpsamaroo Nov 29, 2026
bcf2bbc
review: have every commit an agent pushes for the maintainer say so
jpsamaroo Nov 29, 2026
231f90d
review: find an existing review again when `start` runs without --branch
jpsamaroo Nov 29, 2026
d04687e
review: stop counting documentation, config and docstrings as new code
jpsamaroo Nov 29, 2026
8bd667c
review: require a quote to be within the lines its cite names
jpsamaroo Nov 29, 2026
1f82ada
review: show holds placed since the last submit when the brief is ren…
jpsamaroo Nov 29, 2026
4537659
review: count a re-indented assertion as moved, not removed
jpsamaroo Nov 29, 2026
5df4a37
review: compare a hold's `since` with comment times as times, not str…
jpsamaroo Nov 29, 2026
2ae8080
review: check a hand-written push hold against the head when it began
jpsamaroo Nov 29, 2026
50cbb5a
review: promote a multi-line answer as one Invariants bullet
jpsamaroo Nov 29, 2026
23ea5a9
review: skip unfilled answer stubs instead of failing every command
jpsamaroo Nov 29, 2026
cb9625d
review: caution against running a fork PR's code with the maintainer'…
jpsamaroo Nov 29, 2026
7c3aaa5
review: state in REVIEW.md the _meta.json limits that submit enforces
jpsamaroo Nov 29, 2026
ff57b30
review: count a benchmark suite attached under benchmarks/ as collected
jpsamaroo Nov 29, 2026
e83ed11
review: say that a claim may carry both evidence pointers and cites
jpsamaroo Nov 29, 2026
a93b7d8
review: take `attach external/NAME` as NAME, and let an attachment be…
jpsamaroo Nov 29, 2026
e093339
review: document the exact base/head samples shape, with examples
jpsamaroo Nov 29, 2026
e6fa91f
review: a measured 'no benchmark runs this code' is na, not unverified
jpsamaroo Nov 29, 2026
150d72b
review: tie each [[hold]]/[[change]] to its finding by a tag the entr…
jpsamaroo Nov 29, 2026
91097c4
review: `holds --rebind` re-binds only holds, `changes --rebind` only…
jpsamaroo Nov 29, 2026
7df86e0
review: `changes` refuses a brief whose evidence is for a superseded …
jpsamaroo Nov 29, 2026
dedee0d
review: `attach --remove` inside an attached file marks that attachme…
jpsamaroo Nov 29, 2026
082ead5
review: list attached measurements one short row per attachment
jpsamaroo Nov 29, 2026
86bc9e3
Merge branch 'master' into jps/review-system
jpsamaroo Nov 29, 2026
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
43 changes: 43 additions & 0 deletions .agents/skills/dagger-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: dagger-review
description: Review a change to Dagger.jl (a diff, branch, commit range or pull request) and produce the maintainer's structured brief with a verdict per category. Use when asked to review, assess, audit or summarize a change for acceptance. Not for writing or fixing code.
---

# Reviewing a change to Dagger.jl

Follow `review/REVIEW.md` in this repository exactly. It is the whole procedure; this file only says when
to use it.

`R` below means `python3 <main>/review/review.py`, where `<main>` is the main checkout: the one you start
in, which holds this skill. Write it with the absolute path, because after `start` every command runs
from the PR's worktree, whose own `review/review.py` is the PR's copy of the tool (its validator
included) and must not be used.

For a pull request, first `R start <N>`: it creates the worktree `../Dagger-<N>` on branch
`<prefix>/review/pr<N>` (the prefix is the requesting human's, e.g. `jps`; ask if `start` has none
remembered), and every later command runs from that worktree. `R status` lists the reviews in progress.

In short: `R collect` gathers evidence, `R task <category>` prints the instructions for each category, you
write one fragment per category, `R findings` lists the problem claims so you can merge duplicates into
`_findings.json`, and `R submit` validates the result and prints the brief. Present that brief verbatim.

If the maintainer answers the reviewers' questions (`answers.toml` in the worktree's `.review/`), run
`R rerun` and re-review only the categories it lists (REVIEW.md step 7).

If the maintainer asks for findings to be fixed (`[[change]]` in `answers.toml`), `R changes` lists them:
make one commit per finding on the review branch, each ending with the disclosure line REVIEW.md step 8
gives (`Written by an AI agent on <maintainer>'s review feedback.`), and push it to the PR author's branch, or post a PR
review saying it was written by an agent if that is not possible (REVIEW.md step 8). This is the one case
where the review agent edits code.

Findings the maintainer has put on hold (`[[hold]]`, REVIEW.md step 9) are left alone. When asked to look in
on reviews, run `R status --check-holds` and report any hold whose condition is met; releasing it is the
maintainer's call.

Three things that are easy to get wrong:

- Do not review a change this session wrote without saying so (`"authored_change": true`).
- Do not edit code while reviewing.
- When `submit` rejects a claim, fix the citation, or downgrade the claim to `inferred` and the verdict to
`unverified`. Never the reverse, and never `unverified` over a measured or traced blocker or
should-fix: that problem is the verdict, and `submit` rejects it.
1 change: 1 addition & 0 deletions .claude/skills/dagger-review
17 changes: 17 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ jobs:
- name: Test DaggerWebDash
run: julia -e 'using Pkg; Pkg.develop([PackageSpec(path=pwd()), PackageSpec(path="lib/TimespanLogging"), PackageSpec(path="lib/DaggerWebDash")]); include("lib/DaggerWebDash/test/runtests.jl")'

review-tool:
# The review tool (review/) is Python with no dependencies beyond git. Its
# tests take a few seconds, so they run on every push rather than behind a
# path filter (GitHub can filter only whole workflows by path). They mock
# `gh`, so they need no token. 3.11 is the oldest Python the tool supports.
name: Review tool (Python unit tests)
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run review/ unit tests
run: python3 -m unittest discover -s review/tests

benchmarks:
name: Benchmarks (vs master, ${{ matrix.suite }})
runs-on: ubuntu-latest
Expand Down
48 changes: 48 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,41 @@ Lessons learned the hard way while working on this codebase. Follow them, and
when you learn a new hard-won truth of your own, record it here as a new
lesson.

## Reviewing changes

When asked to review a change (a diff, a branch, a pull request), follow
`review/REVIEW.md`. It produces a fixed-format brief whose claims are checked
against the repository; do not improvise a different review format.

## Invariants

Rules about how Dagger is meant to be used that the code does not enforce or
state, as given by the maintainer. Code may rely on them; reviewers must not
report a change for relying on one (`review/review.py task` gives reviewers
this section verbatim). Each entry is one bullet starting with `- `.
`review/review.py promote` appends maintainer answers marked
`scope = "project"` here.

- **`execute!` is only ever called inside a Dagger task**, by the scheduler
(`Sch.do_task`). An `execute!` method may therefore rely on task-local
state (`get_tls()`, `sch_handle()`) without an `in_task()` guard, even
though `execute!` is listed in the manual as a processor extension point:
that listing is for *defining* methods, not for calling them directly.
- **A Datadeps argument whose aliasing describes no memory of its own
(`NoAliasing`) is read-only and passed by value.** Only `In` is permitted
for it; writing to it (`Out`/`InOut`, or a `move!`/`copyto!` into it) is
not. A `NoAliasing` argument's slot in another memory space is therefore a
by-value copy made by `move` (or the original argument itself, in its own
space), never an uninitialized buffer filled by a later copy task, and
nothing is ever copied back to it. A field dependency on a mutable object
(`Deps(X, InOut(:value))`) is not such a value: the field is memory inside
`X`, its aliasing must say so, and writing it is supported, from any worker
or rank. Like any other written argument, a field written in another memory
space is copied back to `X`'s owner afterwards.
- **Datadeps frees only slots it allocated itself.** User-provided data,
including an argument that serves as its own slot, is freed by the user or
by whatever originally allocated it, never by Datadeps' region-end frees.

## Lessons

1. **Record hard-won truths here.** When you discover something non-obvious
Expand Down Expand Up @@ -1024,6 +1059,19 @@ lesson.
task failure that left ranks on different operations. Compare the actual
Julia versions behind rolling CI labels such as `pre`.

99. **`NoAliasing` does not keep a value out of Datadeps' slot machinery.**
`type_may_alias` decides whether an argument goes through aliasing
analysis, and it looks only at the type's *fields*: a struct holding a
`Vector` answers `true` even when its `aliasing` method returns
`NoAliasing()`. Such values therefore reach `aliased_object!`, whose cache
is keyed by the aliasing value, and every `NoAliasing()` compares equal, so
before PR #792 a second distinct argument silently received the first
one's slot. A user declaring `NoAliasing` means "shares no memory with
anything", not "is interchangeable with every other such value". When
reasoning about which arguments Datadeps touches, check `type_may_alias`,
not `aliasing`. A single-process `spawn_datadeps` with two such values
reproduces it; it is not MPI-specific.

100. **An argument's write history must stay sorted by write number.**
`compute_remainder_for_arg!` walks `arg_history` backwards and treats each
entry as newer than the ones before it. It uses each entry both to choose
Expand Down
2 changes: 2 additions & 0 deletions review/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out/
__pycache__/
184 changes: 184 additions & 0 deletions review/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# Structured review for Dagger.jl

A way to accept or send back a change without reading every line of it, without having to take an
agent's word for anything.

A reviewing agent reads the whole diff and answers thirteen fixed questions. The tooling here makes its
answers checkable: facts that can be computed are computed by a script, every verdict must rest on one of
those facts or on cited lines with a verbatim quote, and a report that does not check out is rejected.
What comes back is a brief of about a screen: at most three findings to decide on first (each one defect,
however many categories raised it, with its severity and the lines to read), then one line per category,
and added/removed counts per file. Nits are counted, not listed.

From the main checkout (the worktree's own `review/` is the PR's copy of the tool, validator included,
so always run this one):

R="python3 $PWD/review/review.py"
$R start 123 --prefix jps # 0. worktree ../Dagger-123, branch jps/review/pr123
cd ../Dagger-123 # every later command runs from the worktree
$R collect # 1. evidence (script, deterministic)
$R task <category> # 2. per-category instructions for the agent
$R findings # 3. merge duplicate problem claims into findings
$R submit # 4. validate the agent's report, print the brief

Then, if the reviewers asked you something (the brief's "Questions for you"):

$R questions --write # stubs in <out>/answers.toml; fill them in
$R rerun # sends answers to the categories they affect
$R promote # copies `scope = "project"` answers to AGENTS.md

And if you want findings fixed rather than answered (`[[change]]` in answers.toml), an agent makes one
commit per finding and pushes it to the PR author's branch, or posts a PR review saying it was written by
an agent when it cannot push:

$R changes # the work list, commit messages, and where to push

Findings can also wait on someone or something; an agent can check the `--watch` conditions periodically:

$R hold 1 --until "@fda-tome's feedback" --watch comment:fda-tome
$R status --check-holds # every review's holds, and whether they are met

Each PR's review lives in its own worktree, with its state in `.review/` there, so several reviews can run
for days side by side; `$R status` lists them. Agents follow [`REVIEW.md`](REVIEW.md). Requires Python 3.11+ and git; `gh` only for `--pr`.

## The categories

Defined in [`categories.toml`](categories.toml), one rubric each in [`rubric/`](rubric/):

Necessity · Semantics · Compatible · Performance · Allocations · Type-stable · Heterogeneity ·
Genericity · Extensible · Applicable · Scalable · Documented · Tested

Verdicts are `pass`, `concern`, `fail`, `unverified` (could not be established; says what is missing) and
`na`. Some categories cannot `pass` on reading alone: Performance and Allocations need an attached
benchmark comparison, Tested needs CI results or coverage, Compatible and Documented need the static API
and docstring scan (always available). That gating is the `pass_requires_evidence` field.

## What is computed, and what is judged

`collect` writes `review/out/evidence.json`. No model is involved in producing it.

| Evidence | From |
|---|---|
| Lines added/removed per file and area; commits | `git diff` |
| Churn: whitespace-only, moved, comment-only and net new code lines | `git diff` |
| Public and internal definitions removed, changed, added; exports; struct layouts; new abstract types and generic functions | lexical scan of base and head |
| New public names without docstrings or manual entries; docstrings changed | lexical scan |
| Assertions added and removed; new test files no runner includes; edits to `test/allocations.jl` | `git diff`, `test/` |
| Sibling backends touched and not touched | [`backends.toml`](backends.toml) |
| Added blocks that duplicate existing code, including "same code, vendor name swapped" | 4-line shingles over `src/`, `ext/`, `lib/` |
| Red-flag constructs on added lines | [`patterns.toml`](patterns.toml) |
| `Project.toml` compat, dependency and version changes | TOML diff |
| PR description, linked issues; CI result per configuration, with absent configurations named, and checks in no configuration | `gh`, with `--pr` (the description, like the commit messages, is the author's own text: reviewers are shown it as the author's claims, not as evidence) |
| Coverage of the lines the change added | `--lcov` |
| Benchmark comparison | `--attach benchmarks=benchmark_results/summary.json` from `benchmark/ci.jl` |
| Anything else you can measure (a JET report, dispatch counts, a regression harness) | `--attach name=file.json` |

### Measurements a `pass` can rest on

Performance and Allocations cannot `pass` on reading alone, and of what is attached under `/external/`
only two shapes count as a measurement (anything else can be cited, but not passed on):

1. `benchmark/ci.jl`'s `summary.json`, provided it compared at least one job or metric. An empty suite is
a failed run.
2. Your own samples of one quantity before and after the change, as an object with `base` and `head`:

```json
{"unit": "s", "base": [41.2, 40.8, 41.5], "head": [38.9, 39.3, 39.0]}
```

Each of `base` and `head` is a number or a non-empty list of numbers (not booleans), in the same unit;
other keys, such as `unit` or a note, are kept and ignored. Several quantities sit side by side under
names, at most four levels below `/external/benchmarks` (or `/external/allocations`):

```json
{"precompile": {"base": [41.2, 40.8], "head": [38.9, 39.3]},
"first_spawn": {"base": [2.10, 2.05], "head": [2.30, 2.27]}}
```

Attached with `R attach benchmarks/load=times.json`, the brief lists each pair as "base/head samples
(2 base, 2 head)", and a `pass` cites `/external/benchmarks/load/precompile` (or `/external/benchmarks/load`).

The agent supplies the judgment: tracing code paths across processors, deciding whether duplication could
be shared, whether a semantic change is consistent. `submit` then enforces:

- every category has a verdict, and every verdict except `unverified` has a measured or traced claim;
- every evidence pointer resolves, and every cited quote is really at the cited lines of the cited file;
- `pass` is refused where the category's required evidence was not collected;
- `concern` and `fail` must mark which claims are the problem, each with a severity (blocker, should-fix,
nit), and only those claims' cited lines go on the brief's reading list;
- every problem claim belongs to exactly one finding;
- the worst supported severity decides the verdict, so a category with only nits passes;
- every `address`-level flag is dispositioned real or benign, and a real one blocks `pass`;
- the diff has not changed since evidence was collected.

The brief's "Tool facts" and "Files" sections are printed from the evidence directly, so those numbers
never pass through a model. Measurements the reviewer attached are listed apart from them, under
"Attached by the reviewer", with the file each came from and when.

## Limits

- The API and docstring scan is a line-oriented heuristic, not a Julia parser. It does not see definitions
generated by macros or `@eval`, and treats a name as public if it is exported, declared `public`, or
listed in a manual `@docs` block. Rubrics tell the reviewer to confirm what it reports.
- A valid citation proves the reviewer looked at those lines, not that its conclusion about them is right.
That is what calibration is for.
- Extensible, Applicable and Scalable are almost entirely judgment. Expect to read their flagged lines for
longer than the others.
- Nothing here runs tests, benchmarks or GPU jobs. It reports what was supplied and names what was not.

## Trusting it: calibration

[`calibration/`](calibration/README.md) holds changes with known defects and scores reviewers against
them, giving a catch rate per category for each harness and model. Ten seeded cases are included. Until
a category has a catch rate you are happy with, read the lines its findings cite.

## Making it yours

In rough order of value:

1. **Rubrics.** They are a first draft written from `AGENTS.md`, the docs and the code. The verdict
thresholds in particular are yours to set. Every time a review misses something that took judgment,
add a line.
2. **Patterns.** Every time a review misses something a regular expression could have caught, add it to
`patterns.toml`. Use `level = "address"` sparingly: each hit costs the reviewer a disposition.
3. **Calibration cases** from Dagger's own history.
4. **Evidence.** Attach more measurements, then tighten `pass_requires_evidence` so the category cannot
pass without them (Type-stable is the obvious candidate once an inference report exists).

To add a category: an entry in `categories.toml`, a file in `rubric/`, then
`python3 review/review.py schema`.

## Harnesses

Everything above is files and one CLI, so any agent with a shell can run it.

- **Codex** discovers the skill at `.agents/skills/dagger-review/`.
- **Claude Code** discovers the same skill through the symlink at `.claude/skills/dagger-review`.
- **Anything else** (including a harness with no skill support): tell it to follow `review/REVIEW.md`.
- **Headless**, for CI or a voice front end: run a review non-interactively when a PR opens and keep
`review/out/report.validated.json` and `brief.md` as artifacts or a PR comment. A front end then only
needs to fetch and read the brief; `review.py render --format text` re-renders one from the JSON.
[`report.schema.json`](report.schema.json) is provided for harnesses that can constrain output to a
schema; the validator remains the authority.

## Layout

review.py the CLI
reviewlib/ collector, validator, renderer, calibration scoring
REVIEW.md the procedure agents follow
categories.toml categories and their evidence requirements
rubric/ one rubric per category
patterns.toml lexical red flags
backends.toml backend families and CI configurations
report.schema.json generated from categories.toml
calibration/ known-defect cases, results
tests/ tests for the tooling: python3 -m unittest discover -s review/tests
out/ working files (ignored by git)

## Teaching the reviewers what you know

A fresh reviewer knows only what the code and the evidence say, so it reports reliance on an unwritten rule
as a bug. Two places fix that. Answers to its questions (`answers.toml`) settle a point for one review and
are re-sent to every category that raised the same finding. Rules that hold for all of Dagger belong in the
`## Invariants` section of `AGENTS.md`, which every reviewer is given verbatim; `review.py promote` moves
answers marked `scope = "project"` there, so a question answered once is not asked again.
Loading
Loading