Skip to content

Add correctness specialist - #3

Merged
wojtekszkutnik merged 2 commits into
initial-review-agentfrom
specialist/correctness
Aug 2, 2026
Merged

wojtekszkutnik merged 2 commits into
initial-review-agentfrom
specialist/correctness

Conversation

@wojtekszkutnik

Copy link
Copy Markdown
Contributor

The general "does this code do what it claims" lens. 100 lines.

What it ports

From gstack/review/checklist.md and the Step 4 critical pass:

  • SQL & Data Safety — interpolation into raw(), extra(), RawSQL, cursor.execute even when the value is already cast to int; bulk writes that bypass save(), signals and full_clean.
  • Race Conditions & Concurrency — read-check-write with no unique constraint, a status change that is not a conditional UPDATE ... WHERE status = <old>, .save() without update_fields.
  • Shell Injection — subprocess(shell=True) with an f-string, os.system, eval, exec.
  • Type Coercion at Boundaries, Time Window Safety, Column/Field Name Safety, Async/Sync Mixing — the informational categories no other lens picked up.

The taxonomy is good and ports wholesale. Wording is retargeted from Rails to Django 6 / Django Ninja / Aurora / React 19.

What it adds that the source lacked

The source is a flat list of what to look for. It never says what to ignore, which is where the noise came from.

1. An evidence bar. Quote both ends — where the bad value is produced and where it is used. One citation is half a finding. For a race, both sides plus the interleaving. For a boundary, the index. For a coercion, both types and the operation that mixes them. Ends with the required worked bad-vs-good example.

2. A failure-scenario requirement, promoted to a rule in the header. Name one input and two outputs: what this code returns for it, and what it should. It sits above the checklist rather than inside the evidence bar because it has to frame every check, not qualify the write-up.

3. A "Not a finding" section. Eight entries. Four are routing to the lens that already owns the defect; four are the false-positive classes measured in the literature and in this repo's own record.

What the research turned up

The over-correction taxonomy quantifies exactly where this lens fails. "Are LLMs Reliable Code Reviewers? Systematic Overcorrection in Requirement Conformance Judgement" classifies 11 patterns of LLMs wrongly rejecting correct code. Four account for 87.2%, and two of those are mine: Logic Error (broad algorithmic claims with no counterexample) at 48.2% and Boundary Error (off-by-one claims that are not off by one) at 13.2%. That 61% is quoted in "Why this exists" and is the justification for leading with the counterexample rule instead of burying it. Four more of its classes became "Not a finding" entries verbatim in substance — Added Requirement → validation the spec never asked for, Imagined Runtime → "this could throw", Assumed Type → a null check on a producer that cannot return null, Precision Error → floating-point imprecision that changes no decision. Its first mitigation recommendation — "require rationales to cite concrete counterexample inputs/outputs" — is the rule as written.

Aurora read replicas make read-after-write a nameable interleaving on this stack. AWS's replication guidance is explicit: replicas update asynchronously and you must transact any read requiring read-after-write consistency on the writer. So a read routed to the replica straight after a write returns the pre-write row — a task enqueued before commit is the usual shape. resource-limits already asks the performance question ("does this force the writer when the replica would do?"); this is the correctness half, and nothing owned it.

Independent adversarial refutation is the mechanism, and Stage 3 already has it. Refute-or-Promote (arXiv 2604.19049) gates each finding behind an adversarial stage requiring reproducible trigger conditions plus a concrete counterexample before promotion. mattpocock/skills#566 proposes the same shape as a skeptic skill — every finding goes to a blind sub-agent whose only job is to refute it, and it gets the bare claim, never the reviewer's reasoning. mattpocock/skills#582 argues the same from the other direction: subagent findings are unverified leads, not results. All three converge on what reference/verification.md already does with Filter 2, so this file adds nothing there — it just makes sure a finding arrives carrying what the refuter needs, which is the input and the two outputs.

Also read and folded in: addyosmani/agent-skills#436 and PR #441, the likelihood-axis proposal _schema.md already implements — the file names a triggering condition on each check rather than asserting risk. obra/superpowers#1955 contributes the sharpest field note in the set: a plan hard-coded a stale real-world constant and the test passed, because it encoded the same stale constant. That is a green suite proving a bug, and it is why "a pattern this file already used before the diff" is a "Not a finding" but a wrong constant is not.

Scope boundaries against the eleven existing lenses

Enum & Value Completeness splits, and the line is drawn in the file. The source deliberately requires reading outside the diff — grep the sibling values, read every consumer. That is coherence's "incomplete sweeps and missed call sites", and it is always-on, so duplicating it wastes both budgets. What stays here is the half visible in the hunk: an if/elif, match or dict dispatch that does not cover a value present in the diff. If finding the uncovered value needs a grep, it is coherence.

Also not mine Owner
The same event delivered twice; retries; dedup keys idempotency — I own two concurrent callers of one path
A swallowed exception; a default that hides absence silent-failure — I own the wrong answer, not the missing signal
N+1 and slow paths performance
Model output parsed without validation llm-pipeline — I own the same sinks for request, webhook and third-party-diff input
A missing bound, cap, timeout or lock scope resource-limits
Rounding, currency, proration money
A missing tenant filter tenancy
A constraint the spec never asked for spec-drift

Injection sinks stay here per the brief. When security lands it will overlap on SQL and shell; Stage 3 dedupes on path:line and collapses them when the fix is the same.

Ports the CRITICAL categories from gstack review/checklist.md — SQL & Data
Safety, Race Conditions & Concurrency, Shell Injection — plus the
INFORMATIONAL ones nobody else owns: Type Coercion at Boundaries, Time Window
Safety, Column/Field Name Safety, Async/Sync Mixing.

Adds the three halves the source lacked:

- An evidence bar. Quote both ends — where the bad value is produced and where
  it is used. One citation is half a finding.
- A failure-scenario requirement, raised to a counterexample rule in the header
  so it frames every check: name one input and two outputs, what the code
  returns and what it should. No input, no finding.
- A "Not a finding" section, eight entries, four of them routing to the lens
  that already owns the defect.

Research changed three things.

The over-correction taxonomy for LLM code review (arXiv 2603.00539) measures
where these findings go wrong: unsupported "logic error" claims are 48.2% of
false rejections and phantom off-by-one claims another 13.2%. That 61% is
quoted in "Why this exists" and is why the counterexample rule leads the file
rather than sitting in the evidence bar.

Four more of its named classes became "Not a finding" entries — Added
Requirement, Imagined Runtime, Assumed Type, Precision Error — as validation
the spec never asked for, "this could throw", a null check on a producer that
cannot return null, and floating-point imprecision that changes no decision.

Aurora read replicas are asynchronous, so a read routed to the replica straight
after a write returns the pre-write row. AWS's own guidance is to transact
read-after-write on the writer. That is a nameable interleaving on this stack
and no other lens has it.

Scope drawn against the eleven existing lenses. Enum & Value Completeness
splits: tracing a new value to consumers outside the diff is coherence, an
uncovered branch visible in the diff is here. Redelivery is idempotency, this
lens owns two concurrent callers of one path. Swallowing is silent-failure,
this lens owns the wrong answer. N+1 is performance. Model output as untrusted
input is llm-pipeline.

Claude-Session: https://claude.ai/code/session_011pBqTHPZrXbQnRCuFBybsX
@greptile-apps

greptile-apps Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

Greptile Summary

Adds a correctness specialist focused on concrete counterexamples and evidence-backed checks.

  • Covers boundary behavior, state transitions, type coercion, concurrency, data safety, and framework semantics.
  • Defines exclusions intended to reduce unsupported or duplicate findings.

Confidence Score: 4/5

The PR is not ready to merge because the existing Stage 2 instructions still prevent the new correctness specialist from running.

The specialist file is present, but SKILL.md continues to classify correctness as unwritten and instructs the dispatcher to always skip it, so the feature introduced by this PR remains unreachable.

Files Needing Attention: SKILL.md

Important Files Changed

Filename Overview
specialists/correctness.md Adds the specialist checklist and now accurately describes Decimal/float failures and asynchronous Django ORM usage.

Reviews (2): Last reviewed commit: "Fix two factual errors and an exemplar t..." | Re-trigger Greptile

Comment thread specialists/correctness.md Resolved
Comment thread specialists/correctness.md Resolved
Comment thread specialists/correctness.md Resolved
@wojtekszkutnik

Copy link
Copy Markdown
Contributor Author

Blocking: the lens is inert as merged. Greptile's specialists/correctness.md:5 thread is the merge gate; its :45 Decimal and :61 async-ORM claims are also correct. All three verified against the code, none restated here.

Required: README.md:78 — the sweep stopped at SKILL.md. README still lists correctness under "Not yet written — SKILL.md dispatches these and the files do not exist", omits it from "Written:" at :53, and :84 still reads "security and correctness are among the missing lenses". After merge the file is in the tree and three README claims are false.

Required: specialists/correctness.md:12 — the leading rule is "Name one input and two outputs: what this code returns for it, and what it should", and neither worked example supplies the second. :14 gives limit=0 → "returns the whole table"; :99 gives → "raises TypeError and the run never reaches finalize". Both stop at one output. A specialist copying either exemplar emits the unsupported logic-error claim the rule exists to block. Add the should-clause to both.

Required: specialists/correctness.md:88 — "Redelivery is idempotency; you own two concurrent callers" is not the line idempotency.md draws. specialists/idempotency.md:28 already owns it: "Check-then-act is not atomic. if not exists(...): create(...) between two workers creates two. Look for the unique constraint, the select_for_update" — same check, same fix as :63 here. On any webhook or queue diff both lenses fire on one line. Narrow one file.

Reviewer items: 3 open on Greptile's threads, all verified, none rebutted.

wojtekszkutnik added a commit that referenced this pull request Aug 2, 2026
All seven specialist PRs (#3-#9) drew the same coherence finding from
their own reviews: the lens lands, and SKILL.md still says it is 'not
written yet - so today they always skip' while README lists it under
'Not yet written' with a stale count. Seven independent reviews, one
finding, which is the lens doing its job.

It is a workflow bug, not seven authoring bugs. Each agent was told to
write its file and open a PR and never told to sweep the dispatch table
- and seven parallel branches editing SKILL.md would have conflicted
anyway. One commit on the base closes it across all seven.

Adds correctness, testing and maintainability to always-on; the other
four already had conditional rows. Drops the not-written prose and the
stale eleven count. Also replaces the merge-gate warning: the real
reason not to gate on it is that it has never been run end to end, not
that lenses are missing.
Greptile, :45 - Decimal mixed with float does not become float, it
raises TypeError. The finding is the float() someone added to silence
that.

Greptile, :61 - 'a Django ORM call inside async def raises
SynchronousOnlyOperation' is overbroad. aget, acreate and async for are
the supported path on Django 6, so the finding is a sync call where an
async one exists.

Own review, :12 - the rule demands one input and two outputs and the
worked example supplied one. Added the expected output.
@wojtekszkutnik
wojtekszkutnik merged commit ba68ff4 into initial-review-agent Aug 2, 2026
2 checks passed
@wojtekszkutnik
wojtekszkutnik deleted the specialist/correctness branch August 2, 2026 09:03

@prelint-staging prelint-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

The leading rule mandates "two outputs: what this code returns for it, and what it should" (line 12), but the worked example at line 14 gives only one (limit=0 → "returns the whole table") and the e...

specialists/correctness.md:14

Warning

The "Not a finding" entry reads "Redelivery is idempotency; you own two concurrent callers." specialists/idempotency.md lines 28–31 already own exactly that: "Check-then-act is not atomic.

specialists/correctness.md:88

2 finding(s) posted as inline comments.

Comment thread specialists/correctness.md Resolved
Comment thread specialists/correctness.md Resolved
wojtekszkutnik added a commit that referenced this pull request Aug 2, 2026
prelint, PR #3: 'Redelivery is idempotency; you own two concurrent
callers' collided head-on with idempotency.md:28-31, which already owns
check-then-act between two workers - same check, same fix, same
scenario. Both lenses would fire on one line of any webhook handler.

Split by what is wrong rather than by who runs it. The missing
atomicity mechanism is idempotency, including check-then-act.
correctness owns the case where the mechanism exists and the logic
through it is still wrong: a lock taken after the read it protects, a
guard on the wrong key, a state machine admitting an order it cannot
handle. If the fix is 'add the constraint', it is not correctness.

prelint, PR #3: the evidence-bar exemplar gave one output while the
rule at :12 demands two. I fixed the first example and missed this one
- the same incomplete sweep, one commit later.
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.

1 participant