Repository navigation
[BREAKING] [FIX]: Evaluate attack verdicts over final traces - #150
Merged
Spencer Schoenberg (spencrr) merged 10 commits intoNov 2, 2026
Merged
Spencer Schoenberg (spencrr) merged 10 commits into
Spencer Schoenberg (spencrr) merged 10 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
from
August 8, 2026 02:31
d80c55b to
84d0197
Compare
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
2 times, most recently
from
August 27, 2026 17:30
cdcad35 to
bedbf6b
Compare
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
2 times, most recently
from
September 8, 2026 22:46
3051684 to
4074ae9
Compare
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
4 times, most recently
from
October 1, 2026 00:59
3ee9e25 to
bcc3fd6
Compare
3 tasks done
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
from
October 8, 2026 02:14
bcc3fd6 to
bb58b64
Compare
Spencer Schoenberg (spencrr)
added a commit
that referenced
this pull request
Oct 9, 2026
<!-- This repository loosely follows the "Conventional Commits" specification for commit messages. See https://www.conventionalcommits.org/ for more information. --> <!-- Squash-merge commit messages must match: ^\[(FEAT|FIX|REFACTOR|STYLE|TEST|DOCS|CI|MAINT|META|REVERT)\]( \[BREAKING\])?:\s.+\(#\d+\) --> <!-- GitHub appends (#N) automatically during squash-merge; just use the [TAG]: description format for your PR title. --> <!-- If your PR is not yet ready for review, please mark it as [DRAFT]. --> ## Description <!-- What does this PR do? Provide a brief summary of the changes. --> <!-- Mention any relevant issues or pull requests with #<issue_number> --> <!-- Tag any relevant reviewers or teams using @<username> --> Adds the linear trace runner shared by attack and probe strategies. `run_trace_async` drives a conversation with an optional online `stop_when` check, keeps separate raw and annotated turn histories, and records `TraceEndReason`. `evaluate_final_trace_async` evaluates the final trace once. It reuses the latest online evaluation only when the evaluator, raw turns, manifest, and observability level are all identical. The runner does not own session lifetime, polarity, cleanup, or exception conversion; those remain strategy and `BaseExecution` responsibilities. Driver history receives a shallow copy, evaluator contexts contain annotation-free turns, and reused evaluator evidence is copied defensively. `EvaluationRecord`, `TraceRun`, `run_trace_async`, and `evaluate_final_trace_async` are exported from `rampart.core` for custom strategies and documented in the API reference. Built-in probes adopt them in #149 and XPIA in #150. ## Breaking changes <!-- If none, write "None". If breaking, describe the impact and migration path. --> None. This PR adds APIs and does not change existing strategies. ## Checklist - [x] `pre-commit run --all-files` passes - [x] Tests added or updated for changes <!-- Please describe what tests were added or updated --> — termination reasons, raw and annotated histories, stop behavior, exact-context reuse, changed observability and manifest, optional-evidence copying, post-run mutation, exceptions, and turn budgets - [x] Documentation updated
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
from
October 9, 2026 00:48
bb58b64 to
8bbadc9
Compare
3 tasks done
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
from
October 24, 2026 02:24
8bbadc9 to
1d23021
Compare
Spencer Schoenberg (spencrr)
marked this pull request as ready for review
October 26, 2026 22:44
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
from
October 26, 2026 22:44
1d23021 to
c804518
Compare
Spencer Schoenberg (spencrr)
requested review from
a team and
Nina Chikanov (nina-msft)
October 26, 2026 22:44
Remove the old reducers and helper now that both built-in strategies evaluate terminal traces. Keep explicit-scope stopping classification, provenance and extension documentation aligned with the shared runner.
Call evaluate_final_trace_async and describe XPIA verdict evidence as final-trace evaluation in code, tests, and extension guidance.
Explain the per-turn to final-trace verdict change, its single-trigger blast radius, automatic stopping defaults, LLM-judge cost trade-off, trial sampling impact, and replacements for removed helpers.
Type Attacks.xpia(stop_when=...) as Evaluator | StopWhen | None and default to StopWhen.AUTO, following the enum-over-Literal standard. StopWhen is a string enum, so its equal string value remains accepted at runtime. Export it from rampart.attacks and the top-level package.
Remove the XPIA upgrade note in line with the no-deprecation policy, keeping the stop_when reuse tip in the driver-budget note, and drop the pre-migration attack wording from the lifecycle overview.
Point the packaged onboarding skill at resolve_attack_verdict now that resolve_as_attack is gone, and describe XPIA stopping accurately. Document the observability_adjusted metadata key, note that StopWhen.AUTO applies to built-in evaluators only, cover XPIA in the compatibility rationale, and correct the phase count and diagram label.
Reference the fingerprint merged with the probe cadence change and narrow the rationale to the XPIA changes this PR makes.
ResponseScope still only quantifies the turns an evaluator sees, but under XPIA StopWhen.AUTO it also decides eligibility for automatic stopping, since only ANY_TURN detection is stable as the trace grows. Say so in the docs and docstrings, and state that TranscriptScope never affects stopping. Correct the compatibility rationale: the xdist envelope is unchanged by this PR, so it rejects older transport versions rather than older XPIA semantics; mixed installations remain unsupported. Add tests that non-ANY_TURN scopes run the whole sequence and that subclasses of built-in evaluators are not auto-stop eligible.
Spencer Schoenberg (spencrr)
force-pushed
the
dev/spencrr/trace-xpia-stopping
branch
from
October 29, 2026 21:46
c804518 to
799eea5
Compare
Spencer Schoenberg (spencrr)
requested a review
from Nina Chikanov (nina-msft)
October 29, 2026 21:47
Nina Chikanov (nina-msft)
previously approved these changes
Oct 30, 2026
Nina Chikanov (nina-msft)
left a comment
Contributor
There was a problem hiding this comment.
Approving. Two non-blocking documentation nits below; no code-level blockers found.
Negation swaps the stability flags, so a negated ALL_TURNS ResponseContains is also eligible for StopWhen.AUTO; the previous wording said only ANY_TURN qualified, contradicting the worked example above it. Say that TranscriptScope only affects stopping when a judge is passed explicitly as stop_when. Add an end-to-end test for the negated case.
Spencer Schoenberg (spencrr)
requested a review
from Nina Chikanov (nina-msft)
November 2, 2026 19:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
XPIA now evaluates the attack objective once over the final trace, separately from online stopping.
stop_whenaccepts an evaluator,None, or the defaultStopWhen.AUTO.StopWhen.AUTOreuses the verdict evaluator as the stop condition only when detection stays true as turns are appended:ToolCalled,SideEffectOccurred, andResponseContainswithResponseScope.ANY_TURN.StopWhenis exported fromrampart.attacksandrampart.When the stop and verdict evaluators are the same object, the latest online evaluation is reused if it already covers the final trace, so no duplicate judge call is made. Final verdict evidence is stored on
Result.final_trace_evaluation, trace completion usesTraceEndReason, and online stop evidence usesEvaluationPurpose.STOP_CHECK. Final evaluation runs inside the active session and injection stack. Observability downgrades are recorded without mutating response metadata, and cleanup failures discard otherwise successful verdict evidence and returnERROR.The list-based
resolve_as_attackand per-turnevaluate_turn_asynchelpers are removed because no built-in strategy uses them. The trace-contract declaration records a compatible change againstmain, which now includes the probe cadence change from #149.Breaking changes
StopWhen.AUTO, other evaluators, including LLM judges, no longer stop early. They are called once on the final trace, and adaptive drivers can run up tomax_turns. Pass the same evaluator asstop_whento restore per-turn early stopping without a duplicate final call.resolve_as_attack(eval_results=...)withresolve_attack_verdict(evaluation=...), and replaceevaluate_turn_asyncwithrun_trace_asyncplusevaluate_final_trace_async.Checklist
pre-commit run --all-filespassesStopWhenvalues; exact evaluator call counts; stable-evaluator classification and composition; cleanup ordering; zero and max turns; observability; metadata isolation; and summaries