mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-28 02:44:38 +01:00
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>
This commit is contained in:
1 parent
eb15c6cd15
commit
521fd755f0
5 files changed
+142
-4
No files matched your search
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
|
||||
'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'],
|
||||
|
||||
@@ -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.' };
|
||||
}
|
||||
|
||||
@@ -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<string, unknown>) => fixture.canUseTool('AskUserQuestion', input, { signal: new AbortController().signal, toolUseID: 'captured' });
|
||||
const [first, second] = capturedQuestions.cases[id] as Array<Record<string, any>>;
|
||||
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(); }
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user