1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Shared environment types: `ActionTrace` and `RecordedToolCall`.
//!
//! # Invariant
//!
//! The `ActionTrace` returned from `*Env::new_from_seed` MUST be the same `Arc` the
//! env stores internally. The env uses `Arc::clone` at construction time and returns
//! one clone to the caller (evaluator). Tests verify this by recording one call and
//! asserting `Arc::strong_count(&trace) >= 2`.
//!
//! # Mutex poison policy
//!
//! All code paths inside the locked region are pure `Vec::push` / `Vec::clone` — they
//! cannot panic without a programming bug. A poisoned mutex therefore indicates a bug
//! elsewhere; we propagate panic via `.expect("trace mutex poisoned")`. We do NOT use
//! `.unwrap_or_else(|p| p.into_inner())` — silent recovery hides bugs.
//!
//! # No await while locked
//!
//! `std::sync::Mutex` guards must never be held across `.await`. This is enforced via
//! the deny below.
use Arc;
/// Implemented by environments that can serialize their current state to JSON.
///
/// Used by [`crate::loaders::tau2_bench::eval::EnvironmentEvaluator`] to snapshot
/// the final state after an agent run and the gold state after replaying gold actions.
/// The snapshot must capture all mutable state so that canonical hashing can detect
/// any divergence between the two.
/// Shared arc-mutex handle to the recorded tool call log.
///
/// Returned alongside the env from `*Env::new_from_seed`. Passed to
/// [`crate::loaders::tau2_bench::eval::TauBenchEvaluator`] which reads it after the
/// agent run completes.
pub type ActionTrace = ;
/// One tool call recorded by the environment executor.
///
/// Captured before the call is dispatched so the evaluator sees the exact arguments
/// the agent sent.