From 521fd755f08aee5d4223d705bb435e5f14b3aa2b Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 19 Oct 2026 04:22:33 +0000 Subject: [PATCH] fix(evals): investigate boundary fixture identifies the owner question by its continue/abort options Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- CHANGELOG.md | 1 + ...nvestigate-owned-question-39195396438.json | 85 +++++++++++++++++++ test/helpers/free-fixtures-data.ts | 1 + test/helpers/workflow-boundaries-fixture.ts | 14 ++- test/workflow-boundaries-fixture.test.ts | 45 +++++++++- 5 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/investigate-owned-question-39195396438.json diff --git a/CHANGELOG.md b/CHANGELOG.md index e93c9d517e..e7967f426c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The second Opus gate (run 39161502626) went 127/132. Each of the five reds is no - **plan-ceo-finding-floor:** Opus saved its D1 decision to the owned working plan before printing any text, as the 0D Save step requires. The permission check identified the parent session only from text or questions, so it never granted that Create and the run timed out after 600 s. A parent with only tool events is now identified by them, still as exactly one session that owns the pending Write. The floor runner also fails within 20 s with `PERMISSION_DIALOG_UNANSWERED` when a permission dialog gets no owned grant. - **plan-ceo-finding-floor, Edit menu** (3 of 10 measured trials): after that Create, Opus edited the plan and the cropped Edit menu stayed unanswered. Twice Claude Code showed the menu before publishing the Edit, and once three Edits were pending at once, so the check found no single published Edit. The plan's own PreToolUse input now covers an unpublished Edit, as it already did for Write, and the visible diff must match exactly one pending Edit on the owned plan. An Edit to another file, a diff matching none or several pending Edits, and a foreign session are still refused. - **shared-libs-review-index-flags** (the fourth gate, run 39173752116): the skip-worktree review read all three evidence files in one `for f in ; do echo "=== $f"; cat -n "$f"; done` loop. A loop over literal paths now counts as reading a file only when its output names that file. A loop over a variable list, a file missing from the output, a path outside the repo and the existing loop with no path in its output are still rejected. +- **investigate-owned-abort and investigate-owned-ending-error** (the slot gate, run 39195396438): both actors asked their one continue/abort question in their own words ("go ahead … or stop now?") with exactly a Continue and an Abort option. The fixture recognized the question only by the words continue, proceed or abort in its text, refused it, then refused the re-ask as a second question. It now identifies the question by its two options' meanings. A second question, a question before the lock is acquired, an option set without an abort choice, three or more options and options whose descriptions contradict their labels are still refused. ### If you… - **…compare pass rates across the switch:** Fable trials carry `harness_version: 5` and Opus trials `6`; they are separate series. diff --git a/test/fixtures/investigate-owned-question-39195396438.json b/test/fixtures/investigate-owned-question-39195396438.json new file mode 100644 index 0000000000..ae2a6e1213 --- /dev/null +++ b/test/fixtures/investigate-owned-question-39195396438.json @@ -0,0 +1,85 @@ +{ + "source": "E2E Evals run 39195396438 slice 14 (job 117879605168) at eb15c6cd: both actors asked one continue/abort question in their own words; the fixture refused it, then refused the re-ask as a second question.", + "cases": { + "investigate-owned-ending-error": [ + { + "questions": [ + { + "question": "Scope lock is on src/ and owned by this run. Should I go ahead and change value() in src/value.js to return 2 and run the verifier, or stop here?", + "header": "Proceed?", + "multiSelect": false, + "options": [ + { + "label": "Continue", + "description": "Change return 1 to return 2 in src/value.js, then run bash ./verify.sh" + }, + { + "label": "Abort", + "description": "Make no edits and release this run's scope lock" + } + ] + } + ] + }, + { + "questions": [ + { + "question": "Continue or abort?", + "header": "Proceed?", + "multiSelect": false, + "options": [ + { + "label": "Continue", + "description": "Make the fix and run the verifier" + }, + { + "label": "Abort", + "description": "Stop and release the scope lock" + } + ] + } + ] + } + ], + "investigate-owned-abort": [ + { + "questions": [ + { + "question": "Edits are now locked to src/. Should I go ahead and change value() in src/value.js to return 2 instead of 1, then run the verifier, or stop now?", + "header": "Proceed?", + "multiSelect": false, + "options": [ + { + "label": "Continue", + "description": "Change the return value from 1 to 2 in src/value.js, then run bash ./verify.sh" + }, + { + "label": "Abort", + "description": "Make no edits, release the scope lock and stop" + } + ] + } + ] + }, + { + "questions": [ + { + "question": "Continue or abort?", + "header": "Proceed?", + "multiSelect": false, + "options": [ + { + "label": "Continue", + "description": "Edit src/value.js to return 2, then run the verifier" + }, + { + "label": "Abort", + "description": "Stop without editing and release the scope lock" + } + ] + } + ] + } + ] + } +} diff --git a/test/helpers/free-fixtures-data.ts b/test/helpers/free-fixtures-data.ts index 891c6579bb..8833a0ab41 100644 --- a/test/helpers/free-fixtures-data.ts +++ b/test/helpers/free-fixtures-data.ts @@ -126,6 +126,7 @@ export const FREE_FIXTURES: Readonly> = { 'test/fixtures/impeccable-captures.meta.json': ['test/design-detect-contract.test.ts', 'test/impeccable-fixtures.test.ts'], 'test/fixtures/impeccable-detect-dom-sample.json': ['test/impeccable-fixtures.test.ts'], 'test/fixtures/impeccable-detect-help.txt': ['test/impeccable-fixtures.test.ts'], + 'test/fixtures/investigate-owned-question-39195396438.json': ['test/workflow-boundaries-fixture.test.ts'], 'test/fixtures/judge-calibration/**': ['scripts/judge-calibration.ts', 'test/judge-calibration.test.ts'], 'test/fixtures/judge-panel-replay-2026-10-05.json': ['test/judge-panel-median.test.ts'], 'test/fixtures/module-size-ratchet.json': ['test/helpers/module-size.ts', 'test/module-size-ratchet.test.ts'], diff --git a/test/helpers/workflow-boundaries-fixture.ts b/test/helpers/workflow-boundaries-fixture.ts index 1a03882c28..aa38f27873 100644 --- a/test/helpers/workflow-boundaries-fixture.ts +++ b/test/helpers/workflow-boundaries-fixture.ts @@ -150,11 +150,19 @@ already isolated to this fixture. Do not change them.`; } if (tool === 'AskUserQuestion') { const owner = read(boundary).match(/gstack-freeze-v1:([a-f0-9]{32})/)?.[1]; - const questions = input.questions as Array<{ question: string; options: Array<{ label: string }> }>; + const questions = input.questions as Array<{ question: string; options: Array<{ label: string; description?: string }> }>; const question = questions?.[0]; + const options = Array.isArray(question?.options) ? question.options : []; + // The declared question is identified by its two options' meanings, not its wording. + const proceed = options.filter(option => /\b(continue|proceed)\b/i.test(option.label)); + const stop = options.filter(option => /\b(abort|stop|cancel)\b/i.test(option.label)); + const means = (option: { description?: string } | undefined, contrary: RegExp) => + Boolean(option) && (typeof option!.description !== 'string' || !contrary.test(option!.description)); + const declared = options.length === 2 && proceed.length === 1 && stop.length === 1 && proceed[0] !== stop[0] + && means(proceed[0], /\b(abort|stop|cancel|no edits?|without edit\w*)\b/i) && means(stop[0], /\b(continue|proceed)\b/i); const abort = id === 'investigate-owned-abort'; - const choice = question?.options?.find(option => (abort ? /\b(abort|stop|cancel)\b/i : /\b(continue|proceed)\b/i).test(option.label)); - if (!owner || questions?.length !== 1 || !choice || !/continue|proceed|abort/i.test(question.question)) { + const choice = abort ? stop[0] : proceed[0]; + if (!owner || questions?.length !== 1 || !declared || !choice) { interactions.push({ tool, disposition: 'unsupported-question', input, owner }); return { behavior: 'deny', message: 'Ask only whether to continue or abort, after scope acquisition.' }; } diff --git a/test/workflow-boundaries-fixture.test.ts b/test/workflow-boundaries-fixture.test.ts index 6a860d6af3..1f53b86b43 100644 --- a/test/workflow-boundaries-fixture.test.ts +++ b/test/workflow-boundaries-fixture.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from 'bun:test'; +import { describe, expect, test } from 'bun:test'; import * as fs from 'node:fs'; import * as os from 'node:os'; import * as path from 'node:path'; @@ -12,6 +12,7 @@ import { E2E_TIERS, E2E_TOUCHFILES } from './helpers/touchfiles-data'; import { PR_PROFILE_CASE_IDS, PR_PROFILE_FILES } from '../scripts/test-pr-profile'; import { applyHollowShardGuard, buildRunManifest, computePaidCaseSelection, DEFAULT_SHARD_TIMEOUT_MS, expectedPrCaseCount, prProfileTestNamePattern, resolvePaidShardBudget, retriesForFiles, verifySliceResults, type SliceResult } from '../scripts/test-paid-shards'; import { CAPTURE_MS } from './helpers/eval-budgets'; +import capturedQuestions from './fixtures/investigate-owned-question-39195396438.json'; const cases: BoundaryCase[] = ['investigate-owned-completion', 'investigate-owned-abort', 'investigate-owned-ending-error']; const files = ['test/skill-e2e-investigate-owned-completion.test.ts', 'test/skill-e2e-investigate-owned-termination.test.ts']; @@ -354,3 +355,45 @@ test('F9 manifest rejects skipped, missing and hollow actor coverage', () => { const hollow = { ...result.outcomes[1], executedTests: 0, skippedTests: 2, shard: 1, groupPid: null }; expect(applyHollowShardGuard([hollow], { evalsAll: false, requireExecuted: true })[0].status).toBe('passed-empty'); }); + +// Gate 39195396438 slice 14: each actor asked its single continue/abort question in its own +// words, with exactly a Continue and an Abort option. +describe('captured owner questions from run 39195396438', () => { + const declared = (id: 'investigate-owned-abort' | 'investigate-owned-ending-error') => { + const fixture = createBoundaryFixture(id); + const acquire = () => spawnSync('bash', ['-c', 'bash "$HOME/.claude/skills/gstack/freeze/bin/freeze-state.sh" acquire "src"'], + { cwd: fixture.repo, env: fixture.env, encoding: 'utf8', timeout: 10000 }); + const ask = (input: Record) => fixture.canUseTool('AskUserQuestion', input, { signal: new AbortController().signal, toolUseID: 'captured' }); + const [first, second] = capturedQuestions.cases[id] as Array>; + return { fixture, acquire, ask, first: structuredClone(first), second: structuredClone(second), + close: () => fs.rmSync(fixture.root, { recursive: true, force: true }) }; + }; + + for (const [id, answer] of [['investigate-owned-abort', 'Abort'], ['investigate-owned-ending-error', 'Continue']] as const) + test(`${id}: the captured question is answered once and the re-ask is refused`, async () => { + const f = declared(id); + try { + expect(f.acquire().status).toBe(0); + const decision = await f.ask(f.first); + expect(decision.behavior).toBe('allow'); + if (decision.behavior !== 'allow') return; + expect(decision.updatedInput!.answers).toEqual({ [f.first.questions[0].question]: answer }); + const hook = await f.fixture.preToolUse({ hook_event_name: 'PreToolUse', session_id: 'captured', transcript_path: path.join(f.fixture.root, 'transcript'), + cwd: f.fixture.repo, tool_name: 'AskUserQuestion', tool_input: f.second, tool_use_id: 'second' }, 'second', { signal: new AbortController().signal }); + expect((hook as any).hookSpecificOutput.permissionDecision).toBe('deny'); + expect((await f.ask(f.second)).behavior).toBe('deny'); + } finally { f.close(); } + }); + + test.each(['before acquisition', 'no abort choice', 'three options', 'swapped meanings'])('%s is still refused', async shape => { + const f = declared('investigate-owned-abort'); + try { + if (shape !== 'before acquisition') expect(f.acquire().status).toBe(0); + const options = f.first.questions[0].options; + if (shape === 'no abort choice') options[1] = { label: 'Proceed later', description: 'Change the value after the verifier' }; + if (shape === 'three options') options.push({ label: 'Skip', description: 'Leave the lock in place' }); + if (shape === 'swapped meanings') [options[0].description, options[1].description] = [options[1].description, options[0].description]; + expect((await f.ask(f.first)).behavior).toBe('deny'); + } finally { f.close(); } + }); +});