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
//! The failure modes the contract names, and the process exit codes it assigns.
// llmlint: ignore-file[invalid_states_unrepresentable] the run and node a failure names
// are `String`s because `RunId`/`NodeId` newtypes are public items `docs/contract.md`
// does not name, and minting one is the interface drift the interface-only stage forbids
// (see AGENTS.md). Revisit when the engine owns a run registry to validate against.
/// What can go wrong driving a run.
///
/// The variants are the failures `docs/contract.md` distinguishes, and they
/// carry the exit codes it assigns: [`EXIT_QUEUED`], [`EXIT_REFUSED`], and
/// [`EXIT_NOTHING_DRIVING`].
/// The result of anything in this crate that can fail.
pub type Result<T> = Result;
/// The run settled, or the reply's every edit was applied.
pub const EXIT_SUCCESS: i32 = 0;
/// The reply's edits are accepted and durable but not yet reconciled.
pub const EXIT_QUEUED: i32 = 1;
/// The reply was malformed, or an edit was refused.
pub const EXIT_REFUSED: i32 = 2;
/// Nothing is driving the run — the state to intervene in.
pub const EXIT_NOTHING_DRIVING: i32 = 3;
/// The interface-only refusal.
///
/// `EX_SOFTWARE`, kept clear of every code the contract already spends: `0`,
/// `1`, and `2` are `reply`'s applied / queued / refused verdicts and `3` is
/// "nothing is driving the run". It goes away with the implementation.
pub const EXIT_NOT_IMPLEMENTED: i32 = 70;