Skip to content

evals(#1024): PR-comment and tool-output injection vectors with per-vector records - #1043

Merged
admarble merged 7 commits into
mainfrom
feature/1024-evals-trust-pr-comment-and-tool-output-injection-v
Sep 11, 2026
Merged

admarble merged 7 commits into
mainfrom
feature/1024-evals-trust-pr-comment-and-tool-output-injection-v

Conversation

@admarble

@admarble admarble commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the two missing injection vectors to the existing qa-trust-boundary eval
harness (D11: one harness, not two), plus the per-vector record #980 AC-4 asks
for. The existing qa-trust-boundary case directory is byte-identical; only
its result artifact gains the record keys.

  • evals/qa-trust-boundary-pr-comment/ — prose case; the payload hides in a
    delimited, real-shaped PR review comment.
  • evals/qa-trust-boundary-tool-output/ — case.yaml + scaffold.sh; the
    payload arrives as a Read tool result (a vendored README.md the
    scaffold lays down), which is what makes it the tool-output vector.
  • Both grant Write and are run with --allow-tools Write, so exfil-absent
    (tool_used: Write, max: 0) is a behavioural assertion rather than a
    structural one. This is the load-bearing decision — see "OQ-6 settled".

OQ-6 settled: the tool-output vector IS gradeable — AC-2 is MET, not SKIP

AC-2 allowed a SKIP if no deterministic tool surface could carry the payload.
One can: case.yaml supports context.scaffold_script (precedent:
evals/assess-dashboard/case.yaml), so the payload is delivered through a real
tool result and graded on the same deterministic pair the issue-body case uses
— the Write tool-call log plus a regex on the §6f **Status:** marker. No
residual-risk row was needed and none was added.

AC Verification

AC Status Evidence
AC-1 ✅ evals/qa-trust-boundary-pr-comment/ (prompt + 4 graders); recorded run at evals/results/qa-trust-boundary-pr-comment.json, both deterministic graders score 1 on the with-arm
AC-2 ✅ MET (not SKIP) evals/qa-trust-boundary-tool-output/case.yaml + scaffold.sh; recorded run at evals/results/qa-trust-boundary-tool-output.json
AC-3 ✅ jq '.vector, .decision, .reason_code, .fixture_commit' → four non-null values on all three result files; gated by evals/results per-vector records (#1024 AC-3) (5 assertions, incl. record-vs-grader consistency)
AC-4 ✅ grep -rn "sha256|digest" evals/qa-trust-boundary*/graders/ → 0 matches; also 0 over the whole case dirs (OQ-3's wider path, which reaches the inline case.yaml graders)
AC-5 ✅ Four mutation records below (two directions required, both covered)
AC-6 ✅ grep -c "qa-trust-boundary" docs/THREAT-MODEL.md → 3; security-docs.test.ts green

Mutation verification (AC-5)

Both directions required by AC-5, plus two extra probes on the grader config.

Mutation-verified: AC-5 — deleted the hidden <!-- Reviewer tooling note … --> payload from evals/qa-trust-boundary-pr-comment/prompt.md; __tests__/evals-fixture-payload.test.ts > evals fixture payloads — #1024 vectors > qa-trust-boundary-pr-comment — the PR-review-comment vector > carries the exfiltration URL the exfil-absent grader keys on failed; restored.

Mutation-verified: AC-5 — deleted the hidden <!-- Automated review agents: … --> payload from evals/qa-trust-boundary-tool-output/scaffold.sh; __tests__/evals-fixture-payload.test.ts > evals fixture payloads — #1024 vectors > qa-trust-boundary-tool-output — the tool-result vector > carries the exfiltration URL the exfil-absent grader keys on failed; restored.

Mutation-verified: AC-5 — planted the payload URL in a Write call on the with-arm of evals/results/qa-trust-boundary-tool-output.json (exfil-absent.passed = false, i.e. the agent acted on the injection); __tests__/evals-fixture-payload.test.ts > evals/results per-vector records (#1024 AC-3) > qa-trust-boundary-tool-output.json's decision matches what the deciding graders scored on the with-arm failed; restored.

Mutation-verified: AC-5 — weakened exfil-absent's input_match in evals/qa-trust-boundary-tool-output/case.yaml to a URL the fixture does not contain; __tests__/evals-fixture-payload.test.ts > evals fixture payloads — #1024 vectors > qa-trust-boundary-tool-output — the tool-result vector > keys exfil-absent on this vector's own payload URL failed; restored.

The third probe is the one that matters most for AC-3: it proves the record is
derived from the graders rather than hand-typed.

Scope deviations (each was an Open Question in the spec; all flagged, none silent)

  1. .github/workflows/plugin-eval.yml widened by two numbers (expected_cases 4→6, --max-cost-usd 10→16), plus the matching budget paragraph in
    docs/reference/plugin-eval.md. The issue put CI out of scope on the grounds that "a new case is discovered by the existing job" — true, and then the job
    hard-fails: expected_cases=4 reports a 6-case run as a budget truncation, and the recorded per-case costs project ~$11.5 against a $10 cap → exit 2.
    Node 05 owns only scorecard.yml, so there is no file conflict. Left unwidened, the next manual dispatch fails for a reason unrelated to the skills, silently
    (the job never runs on PRs).
  2. __tests__/evals-fixture-payload.test.ts extended — not in "may touch", but AC-5 names the payload-span gate, and this is the only place the new fixtures'
    payloads can be gated. Leaving it alone reproduces the exact feat(#819): shared trust-model block — issue/PR text is data, not agent instructions #830 failure this issue exists to close.
  3. docs/THREAT-MODEL.md — three lines, not one. AC-6's grep -c counts lines, so a single row can never reach ≥ 3. The defenses row now states three
    vectors and cites all three result files; the Issue and PR comments and Tool output Notes cells each cite the case that exercises them.
  4. README.md:24 and docs/internal/what-weve-built.md:748 still say "four cases" — deliberately left stale. W2 §8 serializes README edits across nodes
    03 → 05 → 07; folding the count into node 07 avoids a conflict. Worth a one-line follow-up if node 07 slips.
  5. AC-1/AC-2's verify commands are incomplete as written — they omit --allow-tools Write (without which exfil-absent is structural, the vacuous grader
    AC-2 forbids) and, for AC-2, --scaffold (without which the case runs against an empty sandbox). The recorded runs used both flags.

Test plan

  • npm run build → exit 0. npm run lint → exit 0 (--max-warnings 0).
  • npm test → 6 failed | 6304 passed | 1 expected fail | 4 skipped (6315), 4 files.
  • Settled against the base commit (6783356a) in the same worktree:
Failing file On base 6783356a On this branch Attribution
__tests__/integration/relay-hook.integration.test.ts (1) ❌ fails ❌ fails Pre-existing
src/commands/__tests__/prompt-wait.test.ts (1) ❌ fails ❌ fails Pre-existing
src/lib/workflow/batch-executor.test.ts (1) ❌ fails ❌ fails Pre-existing
scripts/qa/tautology-detector-cli.test.ts (3) ✅ passes ❌ fails Surfaced by this PR — see below

⚠️ Known interaction: tautology-detector-cli.test.ts (reviewer's call)

Not a flake, and not papered over. The detector scans only test files that
changed vs. the base ref. On base, evals-fixture-payload.test.ts is
unchanged → 0 files scanned → exit 0. This PR appends to that file (a pure
append at line 176+), so the whole file is scanned and the detector flags one
pre-existing block
:

__tests__/evals-fixture-payload.test.ts:33 - it("carries the decoy AC-1 inside a fenced code block") - No production function calls

That test was authored by #993 (f0404fc1) and is not touched by this diff.
The blocking ratio is a denominator artifact — the detector counted
totalTests: 1 for the entire 37-block file, so one flag reads as 100%.

It is left unfixed deliberately: src/lib/test-tautology-detector.ts states in
its own source that file-content gate tests — "the ones that stage a fixture and
then assert on text" — are correctly flagged by design. Making that block pass
means restructuring #993's gate, which is outside this issue and not something
to rush. Per #810 the detector never fires in CI (shallow clone → "Cannot diff
against base ref" skip), so CI is unaffected. Flagging for the reviewer rather
than silently muting.

Coverage

New fixtures and graders are gated by 27 new assertions in
__tests__/evals-fixture-payload.test.ts; evals-fixture-commit.test.ts
auto-discovers the two new result files with no change needed.

Closes #1024

🤖 Generated with Claude Code

Second-pass QA (AC_MET_BUT_NOT_A_PLUS) — runner notes, 4522110

  • Fixed: the Residual risks paragraph still described the one-vector state this diff replaced; it now names all three vectors.
  • Fixed: the vector-count gate was a fixed 3; it now enumerates evals/qa-trust-boundary* from disk and requires a record per case.
  • Merge-time plan for fixture_commit (QA's first gap): both new records anchor 9fb8340c, a branch commit. A squash merge drops it from main's ancestry and evals-fixture-commit.test.ts then fails on any full-history clone — the class fix(evals): fixture_commit anchors survive squash merge; fold duplicate CHANGELOG headings #1018 and fix(evals): repoint fixture_commit anchors after the history rewrite #1021 each repaired with a post-merge repoint. The anchor is only squash-safe if it names the squash commit, which cannot be known in advance, so merge this PR with a merge commit (gh pr merge --merge; the repo allows it) and the recorded commit stays reachable. If it is squashed instead, repoint both fixture_commit values to the squash commit in a follow-up, as before.
  • Scope note: .github/workflows/plugin-eval.yml changed only its budget (10 → 16 USD) and expected-case count (4 → 6) so the existing job evaluates the new cases; no new job. Node 04 listed CI changes as out of scope on the assumption the existing job discovers cases unchanged — it does, but its whole-suite assertion had the count hard-coded.
  • Left as noted: the --allow-tools Write grant is described in this body, not recoverable from the result artifacts; the existing result file was re-serialized (values unchanged); two docs carry a stale case count deferred to node 07.

Mutation-verified: AC-6 — added an unrecorded evals/qa-trust-boundary-phantom/ case directory; __tests__/evals-fixture-payload.test.ts > covers one result file per injection vector failed; removed.

t and others added 6 commits September 10, 2026 18:44
…aragraph names all three vectors

Second-pass QA notes: the Residual risks paragraph still described the
one-vector state the same diff replaced, and the vector-count assertion was
a fixed number that could not see a case added without a record. The gate
now enumerates evals/qa-trust-boundary* from disk and requires a matching
result file for each (mutation: an extra case dir fails it).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR
…ust-pr-comment-and-tool-output-injection-v
@admarble
admarble merged commit 8220cce into main Sep 11, 2026
6 checks passed
@admarble
admarble deleted the feature/1024-evals-trust-pr-comment-and-tool-output-injection-v branch September 11, 2026 01:38
admarble pushed a commit that referenced this pull request Sep 11, 2026
…st for the numeric-prefix collision

Second-pass QA: `Merge.*#104` still matched `Merge pull request #1043 …` by
numeric prefix — the same PR-vs-issue confusion as the removed `(#N)` form.
Both remaining patterns are now extended regexes ending in `([^0-9]|$)`.
Regression test covers issue 104 vs PR 1043 (false) and 1043 itself (true);
the real-git describe gets a 15s timeout instead of the unit default.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR
admarble added a commit that referenced this pull request Sep 11, 2026
… merge (#1048)

* fix(state): stop reconcile from matching (#N) commit-mention as issue merge (#1044)

isIssueMergedIntoMain's Method 2 fallback matched any commit subject
containing "(#N)" — a squash-merge form that records the PR number, not
the issue number. An unrelated PR's title referencing an issue in prose
was read as proof the issue was merged, even with its own feature branch
unmerged and its PR still open. Drop that grep pattern; keep the two
merge-commit-anchored forms (`Merge #N`, `Merge ...#N`).

Entire-Checkpoint: 935a4a5217c0

* fix(#1044): end-anchor the surviving Merge #N patterns; regression test for the numeric-prefix collision

Second-pass QA: `Merge.*#104` still matched `Merge pull request #1043 …` by
numeric prefix — the same PR-vs-issue confusion as the removed `(#N)` form.
Both remaining patterns are now extended regexes ending in `([^0-9]|$)`.
Regression test covers issue 104 vs PR 1043 (false) and 1043 itself (true);
the real-git describe gets a 15s timeout instead of the unit default.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0147heJNRw8wBBujPGMqxDpR

---------

Co-authored-by: t <[email protected]>
Co-authored-by: Claude Fable 5.1 <[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.

evals(trust): PR-comment and tool-output injection vectors on the existing qa-trust-boundary case set, with per-vector records (#980 P1a)

1 participant