Skip to content

Commit 45fb3bb

Browse files
committed
[REFACTOR]: Clarify stop-check naming in the trace runner
Rename TraceRun.latest_online_evaluation to latest_stop_check, matching EvaluationPurpose.STOP_CHECK, and describe the final-trace evaluator as producing evidence rather than the safety status.
1 parent ab186d4 commit 45fb3bb

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

‎rampart/core/trace.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
@dataclass(frozen=True, kw_only=True, eq=False)
2929
class EvaluationRecord:
30-
"""One online evaluation and the exact context it judged.
30+
"""One stop-condition check and the exact context it judged.
3131
3232
Args:
3333
evaluator: Evaluator object that produced the result. Identity is the
@@ -43,7 +43,7 @@ class EvaluationRecord:
4343

4444
@dataclass(kw_only=True)
4545
class TraceRun:
46-
"""A completed linear trace and its latest online evaluation.
46+
"""A completed linear trace and its latest stop-condition check.
4747
4848
``turns`` is the driver/report view and may carry online evidence.
4949
``raw_turns`` is the evaluator view and never carries framework-produced
@@ -55,15 +55,16 @@ class TraceRun:
5555
manifest: Agent capabilities used to create evaluator contexts.
5656
turns: Annotated history passed to prompt drivers and results.
5757
raw_turns: Annotation-free history passed to evaluators.
58-
latest_online_evaluation: Most recent stop-condition evaluation.
58+
latest_stop_check: Most recent ``stop_when`` evaluation, or None when
59+
no stop condition was configured.
5960
"""
6061

6162
trace_end_reason: TraceEndReason
6263
observability_level: ObservabilityLevel
6364
manifest: AppManifest | None = None
6465
turns: list[Turn] = field(default_factory=list[Turn])
6566
raw_turns: list[Turn] = field(default_factory=list[Turn])
66-
latest_online_evaluation: EvaluationRecord | None = None
67+
latest_stop_check: EvaluationRecord | None = None
6768

6869

6970
def _evaluation_context(
@@ -166,7 +167,7 @@ async def run_trace_async(
166167
manifest=manifest,
167168
)
168169
evaluation = await stop_when.evaluate_async(context=context)
169-
run.latest_online_evaluation = EvaluationRecord(
170+
run.latest_stop_check = EvaluationRecord(
170171
evaluator=stop_when,
171172
context=context,
172173
result=evaluation,
@@ -190,10 +191,10 @@ async def evaluate_final_trace_async(
190191
evaluator: Evaluator,
191192
run: TraceRun,
192193
) -> EvalResult | None:
193-
"""Evaluate the final raw trace, reusing an identical online judgment.
194+
"""Evaluate the final raw trace, reusing an identical stop-condition check.
194195
195196
Args:
196-
evaluator: Evaluator responsible for the final verdict.
197+
evaluator: Evaluator applied to the final trace.
197198
run: Completed trace from :func:`run_trace_async`.
198199
199200
Returns:
@@ -207,7 +208,7 @@ async def evaluate_final_trace_async(
207208
if not run.raw_turns:
208209
return None
209210

210-
record = run.latest_online_evaluation
211+
record = run.latest_stop_check
211212
if (
212213
record is not None
213214
and record.evaluator is evaluator

‎tests/unit/core/test_trace.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def test_driver_exhaustion_returns_raw_turns_async(self) -> None:
6161
assert run.trace_end_reason is TraceEndReason.DRIVER_EXHAUSTED
6262
assert [turn.response.text for turn in run.turns] == ["r1", "r2"]
6363
assert run.turns == run.raw_turns
64-
assert run.latest_online_evaluation is None
64+
assert run.latest_stop_check is None
6565

6666
async def test_turn_budget_is_a_normal_termination_async(self) -> None:
6767
run = await run_trace_async(
@@ -183,8 +183,8 @@ async def test_changed_observability_requires_new_judgment_async(self) -> None:
183183

184184
result = await evaluate_final_trace_async(evaluator=evaluator, run=updated_run)
185185

186-
assert run.latest_online_evaluation is not None
187-
assert run.latest_online_evaluation.result.outcome is EvalOutcome.NOT_DETECTED
186+
assert run.latest_stop_check is not None
187+
assert run.latest_stop_check.result.outcome is EvalOutcome.NOT_DETECTED
188188
assert result is not None
189189
assert result.outcome is EvalOutcome.UNDETERMINED
190190

@@ -278,7 +278,7 @@ async def test_empty_trace_skips_evaluator_async(self) -> None:
278278
(EvalOutcome.NOT_DETECTED,),
279279
],
280280
)
281-
async def test_reuses_identical_latest_online_evaluation_async(
281+
async def test_reuses_identical_latest_stop_check_async(
282282
self,
283283
outcomes: tuple[EvalOutcome, ...],
284284
) -> None:
@@ -291,14 +291,14 @@ async def test_reuses_identical_latest_online_evaluation_async(
291291
stop_when=evaluator,
292292
manifest=AppManifest(name="agent"),
293293
)
294-
online_result = run.latest_online_evaluation
295-
assert online_result is not None
294+
stop_check = run.latest_stop_check
295+
assert stop_check is not None
296296

297297
result = await evaluate_final_trace_async(evaluator=evaluator, run=run)
298298

299-
assert result == online_result.result
300-
assert result is not online_result.result
301-
assert result.evidence is not online_result.result.evidence
299+
assert result == stop_check.result
300+
assert result is not stop_check.result
301+
assert result.evidence is not stop_check.result.evidence
302302
assert evaluator.evaluate_async.await_count == 1
303303

304304
async def test_non_firing_stop_reuses_final_prefix_without_extra_call_async(

0 commit comments

Comments
 (0)