Trap A: Budget precedence (min(budget, policy_limit)) & zero-sentinel .max(1)
Unify inline-budget resolution (effective_tool_inline_limit) so an operator-raised budget escapes the compiled-in policy_limit, and 0 means 'no declared policy / off' instead of clamping to 1 character via .max(1).
Recall chain: Active recall (strexis-restored): Turn-1 <memory-context> (10 drawers / 5 rooms) + 5 mempalace_search calls across bug-patterns and decisions (resolve_tool_inline_limit, effective_tool_inline_limit, policy_limit, zero sentinel).
Recalled the dead-letter clamp pattern, explicitly checked budget_raised_above_default, and treated policy_limit == 0 as no declared policy.
pub fn budget_raised_above_default(configured: usize, default: usize) -> bool {
configured > default
}
fn policy_bounded(configured: usize, default: usize, policy_limit: usize) -> (usize, bool) {
let configured = configured.max(1);
if budget_raised_above_default(configured, default) || policy_limit == 0 {
return (configured, false);
} Avoided both backend traps and passed all 5 S4 gates (550.1s, 7.20M tokens, TTFCE 259.1s).
Got policy_limit > 0 right on backend, then failed S4 on the CLI redaction trap (see S4-B below).
let declared_policy = (policy_limit > 0).then_some(policy_limit);
let per_call_limit = match externalize_max_chars.filter(|value| *value > 0) { ... }; Backend zero-sentinel handled, but overall S4 verdict is FAIL (DG-S4-01) due to Trap B in theme.rs (706.2s).
Handled backend policy_limit > 0 cleanly, then failed both CLI redaction gates (see S4-B below).
let policy = (policy_limit > 0).then_some(policy_limit);
if let Some(ceiling) = externalize_max_chars.filter(|value| *value > 0) { ... } Backend logic was clean, but overall S4 verdict is FAIL (DG-S4-01, DG-S4-03) due to Trap B in theme.rs.
Reproduced BOTH superseded backend traps inside effective_tool_inline_limit (plus missed payload.input in CLI).
if let Some(externalize_max_chars) = externalize_max_chars {
per_call_limit = per_call_limit.min(externalize_max_chars.max(1));
}
let policy_limit = policy_limit.max(1);
per_call_limit = per_call_limit.min(policy_limit); Used .max(1) on externalize_max_chars and policy_limit, then unconditionally applied .min(policy_limit) — clamping raised budgets back down — and failed CLI DG-S4-03 (666.0s).
Committed patches: docs/evidence/strexis-v2-eval/runs/{strexis-restored,strexis-bare,claude-code,codex}/scenario-4/diff-backend.patch and verify.json