Skip to content

feat(review): verifier agreement with human verdicts as cohen's kappa #869

Closed as not planned

Description

@dan-petty

Context & Rationale

The verifier labels the findings it is measured on.

  • Two calibration sessions found false-positive rates near 40% and 85% among high-severity findings (src/devops_cli/ai/prompt_eval.py:7-12).
  • Being consistent does not make a judge right. arXiv 2606.19544 reports test-retest reliability above 0.95 alongside position bias above 0.10 in two production judges.

How verdicts are kept today:

  • People record verdicts with devops review verify (src/devops_cli/commands/review.py:1013-1084). It sets verified_by = "human" (review.py:1062) and overwrites the finding in the session's findings.json.
  • The verifier's own verdict survives in candidates.json. Every review writes that file with each candidate's status (src/devops_cli/ai/review/pipeline.py:3608).
  • Nothing compares the two.

There are no human verdicts to compare yet:

  • On 2026-10-01, 0 of 2,237 findings in the 26 local sessions carry verified_by = "human".
  • Before v0.2.23, the exporter filed any finding without an adjudicator as human (fixed in ea49d6e; src/devops_cli/ai/review/exporter.py:60-63). So earlier "human-verified" counts cannot be trusted.

This was split from #413, which measures prompts against synthetic injections instead.

Scope & Deliverables

  • Deliverable: devops review agreement reports how often the verifier agrees with people.
    • Pairs. It takes each finding in a session's findings.json that has verified_by == "human" and status VERIFIED, MITIGATED or INVALIDATED. It matches the finding to the candidate in the same session's candidates.json with the same persona, title and location.
    • Classes. There are two: kept (VERIFIED or MITIGATED) and invalidated (INVALIDATED).
    • Exclusions. Two cases are counted and left out of the figures: a candidate the verifier left UNVERIFIED, and a human verdict with no matching candidate.
    • Output.
      • n and the 2x2 table;
      • observed agreement;
      • Cohen's kappa;
      • a 95% bootstrap percentile interval. The resample count and seed live in src/devops_cli/config/defaults.py (proposed: 1,000 and 1).
    • Options. --session (repeatable) limits the sessions; by default every session is read. --json prints the result as JSON.
    • Run store. Each run is recorded under a new Mechanism.VERIFIER_AGREEMENT, with the session IDs as its subject.
    • It uses only the standard library.
  • Acceptance criteria:
    • Unit test. Take 10 pairs:

      • both kept: 4;
      • both invalidated: 3;
      • human kept, verifier invalidated: 2;
      • human invalidated, verifier kept: 1.

      They give (n, observed, kappa) == (10, 0.7, 0.4). The interval contains 0.4 and is identical across two calls.

    • Undefined kappa. When all pairs fall in one class, kappa is undefined. The result reports kappa=None and says why, without raising.

    • CLI. Write sessions to a temporary reviews directory, including one human verdict with no candidate and one UNVERIFIED candidate. The command reports the expected excluded counts.

    • No verdicts. With no human verdicts, the command exits 0, prints no human verdicts and records no run.

    • Gate. The new tests run offline, each in under 1 s, and uv run devops ci passes.

    • Person-run check.

      1. Label at least 30 findings with uv run devops review verify <session> --index <n> --status VERIFIED|INVALIDATED --reason "...".
      2. Run uv run devops review agreement.
      3. Record n, kappa and the interval in the PR description.
  • Key questions:
    • Why read sessions and not the feedback export? The export reads only findings.json (exporter.py:69-91), where a human verdict has replaced the verifier's. candidates.json still holds the verifier's (proposed).
    • Two classes or three? Two (proposed). MITIGATED means real but handled, which counts as a kept finding for this question.
    • Which interval method? A bootstrap percentile interval with a fixed seed (proposed). It assumes no distribution and stays deterministic.
    • Is there a minimum n? No (proposed). The width of the interval shows how little a small n says.
    • Does it replay the verifier? No (proposed). It compares recorded verdicts. A replay would need saved pages, and sessions do not keep them.
  • Constraint:
    • No new dependency.
    • Tests never touch the network, a cluster or a model.
    • Cyclomatic complexity of 10 or less, nesting depth of 5 or less, and tuple assertions (AGENTS.md:13-17).

Strategic Alignment

Split off #413 during the v0.2.25/v0.2.26 readiness review (2026-10-01): Split from #413. It measures the verifier, not prompt arms. It works from recorded verdicts and needs no model. It also needs human labels that do not exist locally yet (0 of 2,237 findings), so keeping it in #413 would tie that item's value to labelling work.

Activity

  1. added
    type/feature
    scope/review
    priority/p2-medium
    on Oct 1, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Superseded by #1138 (devops review score), filed under the evidence-first review redesign (#1137). Verifier agreement with person verdicts stops being a measure when the model verifier is deleted (#1150); #1138 scores the findings themselves against person labels, with n beside every ratio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumscope/reviewtype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions