Skip to content

Adversarial harness: record runtime provenance in every live record - #155

Merged
vsn411 merged 4 commits into
secfoo-com:mainfrom
RiccardoBifulco:fix/154-runtime-provenance
Nov 20, 2026
Merged

vsn411 merged 4 commits into
secfoo-com:mainfrom
RiccardoBifulco:fix/154-runtime-provenance

Conversation

@RiccardoBifulco

@RiccardoBifulco RiccardoBifulco commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #154

Why

The #152 evaluation's runtime (Ollama version, model digest, context, sampling) lived only in a hand-written setup.json; nothing tied it to the 32 runs, and the steps from trial files to api.jsonl/summary.md were not reproducible via the tool.

What

  • --live: each record gets runtime_provenance for Ollama (/api/version, model digest from /api/show with /api/tags fallback, Modelfile default options, loaded context length from /api/ps), probed before and after each case so a mid-run change shows as a mismatch. API records also carry response_models (model id the provider returned) and request_options. Only loopback is probed and recorded as loopback; scrub_evidence still applies; probe failures are recorded as probe_error.
  • --combine a.jsonl b.jsonl -o out.jsonl: order-preserving byte-for-byte concatenation (no overwrite). --records X --summary summary.md writes the summary to a new file.
  • Docs updated (ADVERSARIAL_EVAL.md, 2026-11-19 README). The published records are untouched; they predate this.

Tests

Fake loopback Ollama server (version/digest/context end up in the record, including through live_records), non-loopback refusal, order-stable combine, and a CLI test rebuilding the published api.jsonl and summary.md byte-for-byte from split trials.

pytest on the adversarial/evidence tests: 102 passed. Full suite: failures in tests/test_sensor (also failing on main) and a few tests/test_web diagram tests unrelated to this change. Ruff reports no new findings in touched files.

…--summary

Live API records against Ollama now carry runtime version, full model digest,
model default options and loaded context length (probed before and after each
case, loopback only). API records also store the provider-returned model id and
the request option names. --combine concatenates trial artifacts byte-for-byte
in order and --summary writes the replay summary to a new file, so the
published artifact and summary can be rebuilt from documented steps.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 10:32

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Satyanarayana Vuppala and others added 3 commits November 20, 2026 11:36
- Probe loopback directly: ignore proxy settings from the environment and
  refuse redirects, so no other host sees or answers the probe.
- Match untagged model names against Ollama's ':latest' listing.
- Record (not raise) truncated or non-object responses, and record a
  failed post-run probe as probe_error_after.
- Keep repeated Modelfile parameters (stop) as a list; never write
  NaN/Infinity into the JSONL.
- Skip a missing provider model id instead of recording the string 'None'.
- --summary refuses an existing file with a usage error, not a traceback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vsn411

vsn411 commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks @RiccardoBifulco, and welcome! This is a well-built first contribution. Every item in #154 is covered. The fake loopback Ollama server is the right way to test this, and the test that rebuilds the published api.jsonl and summary.md byte-for-byte from split trials is excellent.

In review I found a few robustness gaps in the probe. Rather than send you round another iteration, I pushed fixes to your branch, each with a regression test that fails without the fix:

  • Proxy and redirects. urllib.request.urlopen honours http_proxy/HTTP_PROXY from the environment, so with a proxy configured the "loopback only" probe actually went to the proxy, which could see it and answer for a different server. A loopback server could also redirect the probe off-host. The probe now uses an opener with no proxies and no redirects.
  • Untagged model names. ollama_chat/llama3 is listed by Ollama as llama3:latest, so the digest and context length came back None. Matching now includes :latest.
  • Probe errors that escaped. A truncated response (http.client.IncompleteRead) or a non-object JSON body raised HTTPException/TypeError/AttributeError, which aren't in the except and would stop the whole live run. Those are now recorded as probe_error. A failed post-run probe is now kept as probe_error_after; before, it just looked like None.
  • Modelfile parameters. Ollama repeats stop once per stop sequence, and setdefault kept only the first; repeated names now become a list. Values such as inf/nan would also have been written as Infinity/NaN, which isn't valid JSON, so non-finite numbers stay strings.
  • Smaller fixes:
    • A missing provider model id is skipped instead of being recorded as the string "None".
    • --summary on an existing file gives a usage error instead of a traceback.
    • I also merged main into the branch, which the branch rules require.

Docs updated to match. Full suite passes locally (1821 passed). Merging once CI is green. Thanks again!

@vsn411
vsn411 merged commit 0b151aa into secfoo-com:main Nov 20, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

Leaderboard update

RiccardoBifulco now has 3 points (rank #9). 22 more to reach Bronze.

Full leaderboard

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.

Adversarial harness: record runtime provenance in every live record

3 participants