Skip to content

fix(review): make the code-review pass its own step, gated at submit - #1080

Merged
max-sixty merged 10 commits into
mainfrom
fix/issue-1079
Aug 31, 2026
Merged

max-sixty merged 10 commits into
mainfrom
fix/issue-1079

Conversation

@tend-agent

@tend-agent tend-agent commented Aug 29, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The required /tend-ci-runner:code-review pass is still skipped in a
meaningful share of review sessions because it is embedded inside the manual
review step's depth-calibration prose. That can remove the intended independent
signal before Tend posts a verdict.

Solution

  • make the code-review pass its own numbered, sequential step
  • require the session to state that pass's result before submission
  • retain it for draft and self-authored PR paths
  • rerun it when a safe re-target adds a delta, while leaving step-1 trivial
    close-outs exempt from the full-review path
  • keep the result in session output so an empty-body APPROVE remains empty
  • preserve current-main author-readiness, deduplication, and posting-preflight
    safeguards while renumbering downstream references

Closes #1079.

Verification

  • wt test after merging current main (833 Python tests, 32 worker tests,
    TypeScript typecheck)
  • pre-commit run --all-files
  • 67 focused review-state, preflight, and contract tests after final cleanup
  • independent review found the sequential compliance gate acceptable

This was written by Codex on behalf of @max-sixty

The mandate lived as a bolded paragraph inside step 4, whose surrounding
text is all depth-calibration, so sessions read it as one more calibration
knob rather than a discrete action. Split it into `### 5. Second pass` and
renumber the rest, and require the review to say what the pass returned
before it can be submitted.

Closes #1079

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The renumbering audit inside SKILL.md checks out — I tallied every step N reference against the base and each one shifts consistently (5→6, 6→7, 7→8, 8→9), the draft-mode list and the steps 2–7 trivial-exit range both map correctly, and no control-flow path reaches submit while bypassing the new gate. Two things outside that audit:

A stale step reference survives in TODO.md. The renumbering swept SKILL.md only, but the paragraph beginning "Revisit when one of those moves" in TODO.md says cutting over to the built-in would cost "a prompt reshape plus a per-harness branch in the review skill's step 4". That branch belongs in step 5 now — step 4 no longer mentions the pass at all. Whoever revisits that decision lands on depth-calibration prose and has to re-derive where the invocation actually lives.

The gate's second sentence is in tension with step 5. See the inline suggestion — as written, the grammatical antecedent of "Say it in the session, not the review body" is "its confirmed findings", which reads as an instruction to keep the pass's findings out of the review. That's the opposite of step 5's "fold its findings into the review you submit in step 6", and a session taking the literal reading would state real findings in its own output and then post the empty-body APPROVE — the outward action #1079 documents. The clarification is small enough that the mechanism survives it intact.

Otherwise the shape is right: this is the mechanism #937 pre-registered, it's a restructure plus one paragraph rather than new machinery, and the two wrong outward actions in #1079 put it squarely in the "prevents a wrong outward action" bucket that CLAUDE.md says complexity has to earn.

…'s step ref

The gate's second sentence read as an instruction to keep the pass's findings out of the review, contradicting step 5's fold-them-in. Name the statement as the thing that stays in the session.

TODO.md's built-in-code-review note still cited the review skill's step 4 for the per-harness branch; the pass lives in step 5 now.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Both review points are addressed in 2dd0aa4.

Stale TODO.md reference — the built-in-code-review note now cites the review skill's step 5 for the per-harness branch, not step 4. I swept the rest of the repo for cross-references into the review skill's numbering and found none beyond that one line; the other step N hits in plugins/ all refer to their own skills' steps.

Gate antecedent — applied the suggestion as written; see the inline reply.

uv run pytest — 729 passed. uvx pre-commit run --files plugins/tend-ci-runner/skills/review/SKILL.md TODO.md clean.

Sweep used for the cross-reference check
grep -rn "step [0-9]" plugins/tend-ci-runner/skills/running-in-ci/
grep -rn "review skill" --include='*.md' plugins/ .claude/ | grep -iE "step"

The only in-tree hit is SKILL.md:192's own "submit in step 6". The released marketplace copy of running-in-ci carries a "(review skill, step 9)" citation, but that paragraph was already rewritten in-tree and no longer names a step, so nothing there needs renumbering with this PR.

# Conflicts:
#	plugins/tend-ci-runner/skills/review/SKILL.md
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Measured the pre-fix skip rate on tend itself, since this PR names "the adopter-side skip rate over the next few review-runs windows" as the verification it needs. This is the baseline to compare against.

Window 2026-08-29T07:48Z → 2026-08-30T07:48Z. 33 tend-review runs, all with session logs; 24 posted something (a review body or an approval). 7 of those 24 ran no /tend-ci-runner:code-review pass — 29%, which reproduces the ~1-in-4 rate #1079 reported from a second adopter, here on tend's own repo.

All 33 sessions ran the released skill, and the release does not carry this PR: the mount at 0.1.22 still has ### 4. Review / ### 5. Submit, so the mandate is still the bolded paragraph inside step 4. Nothing here is evidence about the fix — it is the number the fix has to move.

Per-session evidence

Counted by Skill tool-uses naming code-review in each run's session JSONL, cross-checked against the posting call in the same log. The four full-review skips were each checked for the subagent path this PR's description names: all four show only Bash plus the two environment Skill loads (running-in-ci, running-tend), no Task/Agent tool-use, and no mention of the pass anywhere in the assistant text — so they are genuine skips, not a pass run through a different tool.

Posted a full review body, no pass (4):

Run PR
33279093420 #1082
33279665975 #1082
33296060001 #1090
33296431588 #1090

Posted an empty-body approval only, no pass (3): 33264173133 (#1078), 33279979513 (#1082), 33294518307 (#1084).

The shape is worth noting for step 6's precondition: every skip is a follow-up session on a PR an earlier session had already reviewed with the pass — #1078, #1082, #1084 and #1090 each had a first session that ran it. No first-look review skipped. That is the case the submit-time precondition has to cover, because a session re-reviewing an increment is exactly the one that reads the mandate as a depth knob it has already satisfied.

None of the seven produced a wrong outward action that I can find: the four full reviews were substantive and the three approvals all landed on PRs that merged green.

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-walked every step N reference in the merged file against the new headers and against the prose #1104 and #1107 brought in — they all resolve, and TODO.md is the only cross-file referent. Three things on the gate itself.

The gate is unconditional, but two approve paths can never satisfy it. See the inline suggestion. Step 1's trivial-increment approve and the dedup rule's "resolves the last open one" approve both send the session to step 6 for the POST recipe while explicitly skipping steps 2–7, so no step 5 pass ran — and "a review that reaches this point without it is not submittable" reaches them as written. A session reading it literally either runs a full code-review pass on a trivial increment, contradicting the "Do NOT proceed to steps 2–7" it just followed, or posts nothing and leaves the PR in exactly the limbo those paths exist to clear.

the standard step 4 sets narrowed silently. The mid-review bullet under A push mid-review re-targets the review that begins "Review the delta to the standard step 4 sets — it is new code" is untouched by this PR, but its referent shrank: step 4 used to carry the pass mandate, so a re-targeted delta was covered by it, and now step 4 is manual checks only. Whether a delta should get its own pass is a real call — re-running it per mid-review push costs a pass per push — but as it stands the PR settles it by omission. It's outside the diff, so it isn't in the inline set; either widening the reference to steps 4–5 or saying outright that the delta doesn't re-run step 5 would close it.

Nothing pins the new structure. cd91ef1 renumbers test_review_approval_gates_on_author_stated_readiness's comments, but no test asserts what this PR actually ships — that the pass is its own step, and that step 6 carries the gate. test_cross_file_contracts.py is where that convention lives, and #1079's failure mode is the mandate drifting back into surrounding prose, which is the thing a header assertion would catch.

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three points from the review on cd91ef1 are closed: the gate now names the exempt close-out paths, the mid-review re-target bullet re-runs step 5, and test_review_second_pass_is_a_submit_precondition pins the header split. I re-walked every step N reference in the merged file against the new headers — they all resolve — and TODO.md's "Revisit when one of those moves" paragraph is still the only cross-file referent, which this PR updates.

One thing 32a7df4 left behind: it widened the assertion to cover both close-out paths but not the docstring above it, so the test now documents a narrower exemption than it asserts. Suggestion inline.

@max-sixty
max-sixty merged commit 558b6db into main Aug 31, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/issue-1079 branch August 31, 2026 01:36
max-sixty pushed a commit to max-sixty/leaf that referenced this pull request Aug 31, 2026
Automated nightly regeneration of tend's workflow files.

**tend version:** 0.1.22 → 0.1.24

## Notable changes

- **Conflicted bot PRs are now repaired on the frequent poll**
(max-sixty/tend#1108). `tend-notifications` gains a `conflict_count`
boot gate: it runs a GraphQL scan for open bot PRs whose `mergeable` is
not `MERGEABLE`, skips ones already carrying a `tend-conflict-deferred`
marker for the current head, and boots the agent when either
notifications or conflicts are outstanding. This is the bulk of the
workflow-body diff.
- **A multi-line adopter prompt now survives generation**
(max-sixty/tend#1103). Block scalars gain explicit indentation
indicators — `prompt: |` becomes `prompt: |2`, likewise `sandbox_setup:`
— so a prompt or setup script whose first line is itself indented no
longer changes meaning. This repo's `sandbox_setup:` (the Playwright
headless-shell install) is regenerated under the new form.
- **Review gating tightened** (max-sixty/tend#1087, max-sixty/tend#1107,
max-sixty/tend#1080). `APPROVE` is gated on the author stating merge
readiness rather than on the draft flag alone; the posting preflight is
bound to the outward action; and the code-review pass becomes its own
step, gated at submit.
- **`uv` is provisioned for agent sessions** (max-sixty/tend#1109), and
pre-check setup guards are preserved through regeneration
(max-sixty/tend#1106).
- Experimental Gist-backed Claude memory (max-sixty/tend#1110) — off
unless configured.

Full upstream range:
max-sixty/tend@0.1.22...0.1.24

## Also in this PR

`tend init` now writes `.github/actionlint.yaml` — a `concurrency.queue`
ignore scoped by glob to `**/.github/workflows/tend-*.yaml`. This repo
carried the same accommodation as a blanket `-ignore` arg on the
actionlint pre-commit hook, which suppressed that schema error
everywhere, including in workflows this repo owns. The generated file
replaces it, so the false positive stays ignored on the generated
workflows and a real one in `ci.yaml` or `publish-site.yaml` now fails.

Verified by running `pre-commit run actionlint --all-files` in the
regeneration worktree with the blanket arg removed and the generated
config in place: passed.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Aug 31, 2026
Nightly regeneration of tend's workflow files, picking up two upstream
releases.

**tend version:** 0.1.22 → 0.1.24

### Notable changes

- **The frequent poll now repairs conflicted bot PRs**, not just unread
notifications — the `tend-notifications` boot gate gained a GraphQL
query that test-merges open bot PRs and looks for deferral markers in
recent comments, so a conflicted PR wakes the queue instead of waiting
for the nightly sweep
([max-sixty/tend#1108](max-sixty/tend#1108)).
- **Review gating tightened**: `APPROVE` is now conditioned on the
author stating merge readiness rather than the draft flag alone, the
posting preflight is bound to the outward action, and the code-review
pass became its own step gated at submit
([max-sixty/tend#1087](max-sixty/tend#1087),
[max-sixty/tend#1107](max-sixty/tend#1107),
[max-sixty/tend#1080](max-sixty/tend#1080)).
- **Generator fixes that change this repo's YAML**: an adopter's
`prompt:` may now span more than one line (the `|2` block-indent markers
in the diff), pre-check setup guards are preserved, and the
`concurrency.queue` actionlint ignore is written out
([max-sixty/tend#1103](max-sixty/tend#1103),
[max-sixty/tend#1106](max-sixty/tend#1106),
[max-sixty/tend#1095](max-sixty/tend#1095)).
- **`uv` is provisioned for agent sessions**, and Gist-backed Claude
memory ships as experimental
([max-sixty/tend#1109](max-sixty/tend#1109),
[max-sixty/tend#1110](max-sixty/tend#1110)).
- Pinned harness versions moved with the releases: Claude 2.1.251, Codex
0.151.0, uv 0.12.7.

### A second commit, outside the usual regen

`tend init` now also writes `.github/actionlint.yaml` (the
`concurrency.queue` ignore from max-sixty/tend#1095). The nightly recipe
stages only `.github/workflows` and `.config`, so it landed untracked
and would be re-created on every future run — the second commit tracks
it. This repo runs no actionlint job or pre-commit hook, so the file is
inert here; it only suppresses a false positive for anyone linting these
workflows locally.

Full compare: max-sixty/tend@0.1.22...0.1.24

---------

Co-authored-by: worktrunk-bot <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 1, 2026
… output (#1127)

`code-review`'s Output section is written for a subagent invocation —
"return the findings to the caller". Run inline, which is what happens
whenever the review session doesn't spawn a subagent, there is no
separate caller: the session *is* the caller, so "return to the caller"
collapses into "emit as my message", and a session that has just
produced what reads as its deliverable ends the turn. The review never
posts and the findings survive only in the session log — the failure
[reported on
#1079](#1079 (comment)),
three occurrences in nine days on a downstream adopter, most recently on
a substantive diff carrying two `CONFIRMED` findings.

This names the inline case in the output contract — the findings go to
the caller's next step, not to the reader — and adds the reciprocal at
the call site, so `review` step 5 names step 6 as what follows rather
than leaving the pass's return as the last instruction in view.

Verified: `uv run pytest` (882 passed), `pre-commit` on both changed
files. No test pins either file's text.

<details><summary>Why this shape rather than another round of "run the
pass"</summary>

#937 and #1080 established that re-wording a mandate doesn't move
stochastic compliance; #1080's gate (step 6 states what the pass
returned) is the mechanism that did. This failure sits *upstream* of
that gate — the session ends before reaching step 6, so a precondition
at step 6 can't fire. The fix isn't a stronger instruction to continue,
it's removing the instruction that reads as terminal: "return to the
caller" is accurate for a subagent and literally impossible to satisfy
inline, and the session resolves the impossibility by treating its own
message as the return.

That also bounds the change: two sentences correcting a contract that is
wrong for one of its two execution modes, not a new gate.

Reported occurrences, all downstream: diffplug/dormouse#493 round 5,
plus diffplug/dormouse#440 and diffplug/dormouse#443. The first is
post-#1080, which is what makes it visible — with the pass promoted to
its own numbered step, its output is a step deliverable, so a session
mistaking it for *the* deliverable now stops with a fuller-looking
result.

</details>

---------

Co-authored-by: tend-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

review: sessions still skip the mandated code-review second pass in ~1 of 4 reviews post-#937

2 participants