Repository navigation
Description
Environment
- Reproduced on Code
v8.5.9@b5289bb4e6d405e2716654cba048d538c6630266 - Reporter context: a host that orchestrates vendored, third-party AgentDirs as workflow steps
The asymmetry
Every other completion-policy mechanism in SessionOptions is host-controlled.
The gate that can fail a run is not:
| Mechanism | Host control | Default |
|---|---|---|
| Read-only verifier turn | with_verifier(bool) |
off |
| Effect isolation | with_effect_isolation(bool) |
off |
| Completion waivers | with_completion_waivers(Vec<_>) |
empty |
| Completion gate | none | always on |
AgentConfig has verifier_enabled: bool (agent.rs:203, defaulted false at
agent.rs:302) but no corresponding field for the gate, and
decide_with_observations is called unconditionally — there is no if around it
(agent/completion_runtime.rs:113).
So a host can turn on the optional verification machinery, and can turn on
isolation, but cannot state a policy for the one mechanism that decides whether
its runs pass or fail.
Why that matters for a host that does not author its agents
We are not asking for the gate to be weakened. "The assistant said it wrote
the file" is not evidence, and we want that enforced. The problem is that none of
the three ways to satisfy it is reachable from where we sit.
Waivers cannot be produced in time
A waiver must match one exact digest (harness_loop.rs:502, no wildcard), but
the digest is accumulated from what the agent actually wrote
(MutationLedger::digest, harness_loop.rs:171) — it does not exist when the
session is built. with_completion_waivers is read as a fixed slice at
completion, and there is no callback in between.
The Cli pre-declares digests from A3S_CODE_COMPLETION_WAIVERS
(commands/code/exec.rs:380-417), which works when the caller already knows the
digest (CI fixtures). A general orchestration host cannot know what an arbitrary
agent will write.
The verifier turn has nothing to bind with
A VerificationReport enters only through tool-result metadata
(agent/tool_result_runtime.rs:135); no builtin emits one. The single
model-reachable binding is a bash existence check whose on-disk content matches
the ledger (harness_loop.rs:519-520, verification.rs:1042).
Our workers are presented read/search/write under default_decision: deny,
and the verifier turn strips write further — leaving read/search, neither of
which can bind a digest.
We tried granting a sandboxed bash anyway
We gave write-capable sessions a bash prefix plus a host BashSandbox
(with_sandbox_handle) admitting only test -f <workspace-relative-path> —
narrow enough that it is not really a shell. Mechanically correct, and the
sandbox was never called: the model wrote the file and answered in prose. The
verifier turn's injected prompt (read_only_verifier.rs:20) says the turn is a
verification role and that sentences do not close the gate, but not what to
actually run. Third-party AgentDir instructions naturally say nothing about it.
Net effect on v8.5.9: every write-capable third-party agent fails, and the
host has no supported way to change that.
Ask
A host-level switch for the gate, in the same shape as the mechanisms beside it:
pub enum CompletionGatePolicy {
/// Today's behaviour, and the right default.
Enforce,
/// Gate decides, host records the outcome, run is not failed by it.
/// For hosts that carry their own effect ledger and reconciliation.
Observe,
}
// SessionOptions::with_completion_gate_policy(CompletionGatePolicy)Enforce stays the default, so nothing changes for existing users. Observe
lets a host that already records mutations, digests and step outputs decide what
an unverified mutation means for its product, instead of having every
third-party agent fail at the last turn.
We would send the patch.
Alternatives we would be equally happy with
Any of these solves it without a policy switch:
- A
CompletionAttestorhook — called with the effect digest and mutated
paths before the gate decides, so the host can supply a bound report at the
one moment the digest exists. Keeps every guarantee; removes only the
impossible requirement to predict the digest. - Un-nest verification keys for MCP results —
mcp/result.rs:123wraps tool
metadata in{"mcp": …}, so an MCP server's_meta.verification_report/
_meta.verification_shell_commandcan never reach the top-level keys the gate
reads. Lifting them would let any MCP-based host use the existing binding
path, including its content-match check. Smallest change of the three. - A read-only existence-check builtin available in the verifier turn — lets
the model bind the digest itself on any agent, without grantingbash.
Closest to the gate's intent.
Reproduction
- Build an AgentDir whose
host-requirementspresentread/search/write
withdefault_decision: deny. - Run a task that writes one file.
- Run ends
Failed:
completion gate: workspace mutation <digest> has no bound Passed verification and no host waiver. - Set
with_verifier(true)and repeat — same failure; the turn has no
digest-binding tool.
Happy to share the host-side investigation (including digests and attempted remedies) if useful.
Activity
ZhiXiao-Lin commentedon Sep 21, 2026
First-principles disposition: do not add
CompletionGatePolicy::Observe.The gate is the mechanism that stops an unverified workspace mutation from completing. An opt-in that records the decision and then lets the run succeed removes that invariant.
Enforcestaying the default does not makeObservesafe; it makes the hole explicit. Existing hosts that need a known digest already have exact waivers.The reproduction is real: a host cannot predict
MutationLedger::digestat session build, and a read/search verifier turn cannot bind it. That is not a reason to disable the gate.Acceptable follow-up, if we take one: a host-only
CompletionAttestorinvoked with the digest and mutated paths after they exist and beforedecide_with_observations. The gate still requires a Passed report bound to that digest. The attestor is not a tool and is not model-grantable.Not doing the MCP
_metalift here. It is a separate wiring bug and does not fix this AgentDir reproduction. Not adding a verifier-turn existence builtin: the report says the model already skips the check whenbashis present.ZhiXiao-Lin commentedon Sep 25, 2026
Landed on Code tip as a host-only
CompletionAttestor(notObserve).SessionOptions::with_completion_attestor(Arc<dyn CompletionAttestor>)decide_with_observationsVerificationReportSee
core/src/completion_attestor.rsand CHANGELOG Unreleased.ZhiXiao-Lin commentedon Sep 25, 2026
Fixed via host-only CompletionAttestor; gate remains non-bypassable.