Skip to main content

OutcomeContract

Struct OutcomeContract 

Source
pub struct OutcomeContract {
    pub description: String,
    pub allow_credentials: bool,
    pub checks: Vec<ContractCheck>,
}
Expand description

The verifiable definition of done for a coding session.

Fields§

§description: String

Human summary of what success means.

§allow_credentials: bool

Permit this contract’s runtime-owned checks to use credentials.

Default false. When true, check execution omits only the coder’s DenyCredentialAccess inspector; all other built-in and operator policy remains. This never changes the model’s shell policy.

§checks: Vec<ContractCheck>

Checks that must all pass. Evaluated through the same policy-gated shell inspector chain as the agent’s own calls, so a project deny_tool rule refuses a “check” exactly as it would a tool call. The credential posture differs — see the module docs.

Implementations§

Source§

impl OutcomeContract

Source

pub fn validate(&self) -> Vec<String>

Structural problems that make a contract unusable. Empty = valid.

Beyond pure structure (empty/duplicate names, assertion-less checks) this also rejects two failure modes seen live from small local models (issue #168 follow-up): the prompt’s literal placeholder name leaking through verbatim, and “toolchain-only” no-op commands like cargo --version that prove nothing about the change. Both pass the structural checks but make a contract that gates nothing, so they’re surfaced as validation issues to drive the repair loop rather than silently becoming the trust boundary.

Source

pub fn repair_cosmetic_names(&mut self)

Repair cosmetic naming problems weak local models commonly produce — the literal unique_snake_case_label placeholder leaking through, an empty name, or a duplicate — by assigning deterministic fallback labels (check_1, check_2, …, suffixed on collision).

Dogfooding finding (2026-07-12): a small local model repeatedly echoed the schema placeholder as a check name, and derive_contract’s bounded repair loop couldn’t coax a better one out of it in 3 attempts, so the entire coder session aborted before any coding over a name. A check’s NAME is cosmetic — the command is the trust boundary — so a naming slip must not be a hard failure. Substance problems (empty/toolchain-only/ assertion-less commands) are deliberately left for validate to drive the repair loop, since those DO make the contract gate nothing.

Source

pub fn strip_absolute_cd_prefixes(&mut self)

Strip a hallucinated absolute-path cd prefix from each check command.

Checks run at the worktree root — the runtime sets CWD. But the derivation model, trained on Docker-based coding harnesses, sometimes prefixes a check with cd /repo && … (or another absolute mount that does not exist here). That command then dies on cd: /repo: No such file or directory for EVERY check, so a correctly-solved task self-verifies as failed and the session ends “failed” — a false negative (surfaced by the coder A/B on a bytes2human fix the coder got right in one iteration). We drop only a leading cd <absolute> && / cd <absolute> ; (the runtime owns CWD, so it is redundant at best and wrong at worst); a relative cd subdir && … is a legitimate intra-repo move and is left untouched.

Source

pub fn strip_exit_masking_pipes(&mut self)

Drop a trailing output-limiting pipe (… | tail -20, | head -n 50, | cat) from each check command.

A shell pipeline exits with the status of its last command, so pytest … | tail -20 exits 0 no matter how badly pytest failed. The derivation model adds these to keep output short, and thereby makes the check structurally incapable of failing: expect_exit_zero ends up asserting that tail ran, which it always does. The coder then self-verifies green on broken code, reports needs_approval, and prints a merge command — which is the exact opposite of this runtime’s promise that success means “a real command exited 0”.

Worse, it is self-concealing: a masked check can never report the failure that would let the repair loop notice its command is wrong, so the session converges instantly on a lie. Surfaced by the coder A/B, where a gpt-5.4 arm derived python -m pytest tests/ -x -q 2>&1 | tail -20, went green in 31s without flask even importable, and lost every task to the manifest’s (unpiped) contract.

Only output filters are stripped — tail/head/cat exist purely to truncate and always succeed. A pipe into grep is left alone: its exit status is a real assertion (“output contains X”), which is a legitimate check the model may intend.

Source

pub fn render(&self) -> String

Render for prompts and CLI display.

Trait Implementations§

Source§

impl Clone for OutcomeContract

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutcomeContract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OutcomeContract

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OutcomeContract

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OutcomeContract

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OutcomeContract

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more