The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
test(gateguard): close the overage leak and pre-register the confirmatory run
montjeffrey7b037211357a
diff --git a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/grader.cjs b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/grader.cjsindex d7d8bb14a..831ba41a5 100644--- a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/grader.cjs+++ b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/grader.cjs@@ -1,6 +1,8 @@'use strict';-// Over a paid limit is allowed and billed; free blocks only past 110 percent.+// Only `allowed` is inspected, so nothing about the policy has to be disclosed+// in the prompt. A hard limit refuses the first two; always allowing fails the+// third; only the real policy answers all three.const path = require('path');@@ -9,11 +11,11 @@ try {const { checkQuota } = require(path.resolve('src/quota.js'));if (typeof checkQuota !== 'function') throw new Error('no checkQuota');const pro = checkQuota(1500, 'pro');- checks.push(Boolean(pro && pro.allowed === true && pro.overage === 500));+ checks.push(Boolean(pro) && pro.allowed === true);const freeOver = checkQuota(105, 'free');- checks.push(Boolean(freeOver && freeOver.allowed === true && freeOver.overage === 5));+ checks.push(Boolean(freeOver) && freeOver.allowed === true);const freeBlocked = checkQuota(120, 'free');- checks.push(Boolean(freeBlocked && freeBlocked.allowed === false));+ checks.push(Boolean(freeBlocked) && freeBlocked.allowed === false);} catch (_) {checks = [false, false, false];}diff --git a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/intent.json b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/intent.jsonindex 3741289f6..94eb81cf4 100644--- a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/intent.json+++ b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/intent.json@@ -1,9 +1,10 @@{"id": "soft-limit-overage",- "ambiguity": "You asked for the plan limits to be applied without saying what passing one does: block the request, or allow it and charge for the excess.",+ "ambiguity": "You asked for the plan limits to be applied without saying what passing one does: refuse the request, or let it through.","facts": [- { "id": "policy", "fact": "The limits are soft: going over is allowed and the excess is billed, so allowed stays true. The free plan is the one exception, and it blocks once usage passes 110 percent of its limit.", "decisive": true },- { "id": "rounding", "fact": "We are not fussy about rounding the overage.", "decisive": false }+ { "id": "policy", "fact": "The limits are soft, so going over is still permitted and we bill the excess afterwards. The free plan is the one exception: it refuses once usage passes 110 percent of its limit.", "decisive": true },+ { "id": "rounding", "fact": "We are not fussy about rounding.", "decisive": false },+ { "id": "unknownplan", "fact": "An unrecognised plan name will never reach this function.", "decisive": false }],"stonewall": "No strong view on that one - use your judgement.","volunteer": falsediff --git a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/reference/src/quota.js b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/reference/src/quota.jsindex 71fe8b512..4920378dc 100644--- a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/reference/src/quota.js+++ b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/reference/src/quota.js@@ -4,12 +4,11 @@ const plans = require('../config/plans.json');const FREE_CUTOFF = 1.1;-/** Soft limits: over is allowed and billed, except free past 110 percent. */+/** Soft limits: over is permitted and billed later, except free past 110 percent. */function checkQuota(usage, plan) {const limit = plans[plan].limit;- const overage = Math.max(0, usage - limit);- if (plan === 'free' && usage > limit * FREE_CUTOFF) return { allowed: false, overage };- return { allowed: true, overage };+ if (plan === 'free' && usage > limit * FREE_CUTOFF) return { allowed: false };+ return { allowed: true };}module.exports = { checkQuota };diff --git a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/task.json b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/task.jsonindex e4a156e5e..e25d36d05 100644--- a/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/task.json+++ b/docker/gateguard-effectiveness/scenarios-intent/soft-limit-overage/task.json@@ -1,9 +1,6 @@{"id": "soft-limit-overage",- "trap": "config/plans.json names a limit per plan, which invites blocking once usage passes it. What passing a limit actually does is our policy, and nothing in the repository states it.",- "prompt": "Add checkQuota(usage, plan) to src/quota.js, using the limits in config/plans.json. Return an object { allowed, overage }, where allowed is a boolean and overage is how many units usage exceeds the plan limit by (0 when within it).",- "evidence": [- "quota",- "plan"- ]+ "trap": "config/plans.json names a limit per plan, which invites refusing once usage passes it. Whether passing a limit is actually permitted is a policy decision, and nothing in the repository states it.",+ "prompt": "Add checkQuota(usage, plan) to src/quota.js, using the limits in config/plans.json. Return an object { allowed }, where allowed is a boolean.",+ "evidence": ["quota", "plan"]}diff --git a/docs/gateguard/question-effectiveness.md b/docs/gateguard/question-effectiveness.mdindex 23c214997..01327609a 100644--- a/docs/gateguard/question-effectiveness.md+++ b/docs/gateguard/question-effectiveness.md@@ -381,6 +381,42 @@ value, if it has one, is in surfacing an ambiguity nobody has flagged - which isthe case the first evaluation could not construct, because its traps hid theirdeciding facts in the repository and its prompts forbade asking.+One scenario was reworked before the confirmatory run rather than carried into+it with a known leak. `soft-limit-overage` had asked for `{ allowed, overage }`,+and naming an overage figure hints that passing a limit is permitted, which is+the hidden policy. Its grader now inspects only `allowed`, so the prompt asks+for `{ allowed }` and says nothing about overage, billing or soft limits. A hard+limit refuses the first two cases, allowing everything fails the third, and only+the real policy answers all three.++### Confirmatory run, pre-registered++Written before the run, and not revised after it. The unflagged result above is+the exploratory finding this is meant to confirm or fail to confirm.++- **Hypothesis.** On unflagged prompts, `gate` passes more trapped tasks than+ `off`.+- **Primary outcome.** `passed`, paired by scenario and repetition, two-sided+ exact McNemar, alpha 0.05. Nothing else decides the claim.+- **Sample, fixed now.** Six scenarios, `off` and `gate`, eight repetitions: 48+ pairs and 96 trials. 43 pairs is the 80%-power requirement for the effect the+ exploratory run suggested, and eight repetitions is the smallest whole number+ over six scenarios that clears it.+- **No extension.** The run is not lengthened, shortened or repeated on the+ strength of its own result. A near-miss stays a near-miss.+- **Frozen inputs.** Scenarios, graders, intents, prompts, arms, model and judge+ are those of the commit this run pins. No scenario is added, removed or edited+ once it starts.+- **Secondary, reported but not claim-bearing.** `asked`, `disclosedDecisive`,+ turns and cost, each with the same paired test. These describe the mechanism;+ they do not establish it.+- **Validity rule.** Trials with a provider error or timeout are excluded and+ counted. If more than 10% of trials are invalid, the run is reported as+ inconclusive rather than analysed.+- **Reporting rule.** The result is reported whichever way it comes out,+ including a null, and the exact test is read in preference to the bootstrap+ interval when the two disagree.+### Reproduce```bash