fix(evals): repair the five Opus gate reds from run 39161502626

- coverage audit: owned cd; followed by one && chain, wc -l on in-cwd files
- shared-libs: Claude Code 2.1.292 git --version probe, exact argv only
- ship hook: accept 'integrate the hook yourself' / 'combine ... by hand'
- qa-only: deadline starts only after the charter Write completes
- plan floor: tool-only parent session identifies the owned Create grant;
  floor runner fails fast with PERMISSION_DIALOG_UNANSWERED

Each repair replays its captured run as a free regression with negative
controls. HARNESS_VERSION stays 6 (re-recorded from main's 5).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-18 20:53:21 +00:00
1 parent d182b91397
commit e03bfeb060
19 files changed
+415 -24

No files matched your search

+13 -4
View File
@@ -138,6 +138,12 @@ function stagePieces(stage: string[], scope: ShellScope, alone: boolean): Piece[
}
if (name === 'grep' || name === 'ls') return [unknown()];
if (text === 'pwd' || text === 'wc -l') return [unknown(1, 1)];
if (name === 'wc' && args[0] === '-l' && args.length > 1) {
// One count line per literal in-cwd file, plus a total for several.
if (args.slice(1).some(operand => !scopedFile(operand, scope))) return undefined;
const lines = args.length - 1 + (args.length > 2 ? 1 : 0);
return [unknown(lines, lines)];
}
if (/^\[ -f [A-Za-z0-9_.\/-]+ \]$/.test(text)) return [unknown(0, 0)];
if (displayAwk) return [unknown()];
return undefined;
@@ -154,12 +160,15 @@ function commandPieces(command: unknown, scope: ShellScope): Piece[] | undefined
else lists.at(-1)!.at(-1)!.push(word);
}
if (lists.some(pipeline => pipeline.some(stage => !stage.length))) return undefined;
// One leading assertion of the recorded cwd. Mixed separators after it could
// run later relative reads elsewhere, so they stay conservatively unsupported.
// One leading assertion of the recorded cwd, followed by one uniform list.
// `cd CWD;` runs the list whether or not cd succeeds, exactly like an all-;
// list, so only it may precede an && chain. Other mixes (`cd CWD && A; B`)
// could run later relative reads elsewhere and stay unsupported.
if (lists[0]!.length === 1 && lists[0]![0]![0] === 'cd') {
const [, target, ...rest] = lists[0]![0]!;
if (rest.length || target === undefined || literal(target) !== scope.cwd || lists.length < 2 ||
new Set(separators.filter(separator => separator !== '||')).size !== 1 || separators[0] === '||') return undefined;
const [assertion, ...chain] = separators, kinds = new Set(chain.filter(separator => separator !== '||'));
if (rest.length || target === undefined || literal(target) !== scope.cwd || lists.length < 2 || assertion === '||' ||
kinds.size > 1 || (assertion !== ';' && kinds.size && !kinds.has(assertion!))) return undefined;
lists.shift(); separators.shift();
}
const pieces: Piece[] = [];
+4
View File
@@ -59,6 +59,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/codex-sandbox/**': ['test/codex-eval-recording.test.ts', 'test/codex-model-probe.test.ts', 'test/outside-review-result.test.ts', 'test/outside-voice-invocation.test.ts'],
'test/fixtures/context-bill/**': ['test/context-bill.test.ts', 'test/context-budget-ratchet.test.ts'],
'test/fixtures/context-budget.json': ['test/helpers/capture-context-budget.ts', 'test/test-value-bar.test.ts'],
'test/fixtures/coverage-audit-cd-chain.json': ['test/coverage-audit-evidence.test.ts'],
'test/fixtures/coverage-audit-parallel-column.json': ['test/coverage-audit-evidence.test.ts'],
'test/fixtures/coverage-audit-summary.json': ['test/coverage-audit-evidence.test.ts'],
'test/fixtures/cso-eval/**': ['scripts/cso-eval.ts', 'test/cso-eval.test.ts', 'test/cso-stack-cold-integration.test.ts', 'test/helpers/cso-eval-oracles.ts'],
@@ -144,6 +145,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/parity-baseline-v1.44.1.json': ['test/helpers/capture-parity-baseline.test.ts', 'test/parity-baseline-integrity.test.ts'],
'test/fixtures/parity-baseline-v1.64.1.0.json': ['test/parity-suite.test.ts', 'test/qa-lazy-sections.test.ts', 'test/skill-size-budget.test.ts'],
'test/fixtures/parity-baseline-v1.81.0.0.json': ['test/skill-size-budget.test.ts'],
'test/fixtures/plan-ceo-floor-toolonly-create.json': ['test/plan-create-toolonly-session.test.ts', 'test/plan-floor-permission.test.ts'],
'test/fixtures/plan-count-design-questionless-report.md': ['test/plan-count-empty-review.test.ts'],
'test/fixtures/plan-create-cropped-title-batching.json': ['test/plan-create-combined-permission.test.ts'],
'test/fixtures/plan-ceo-floor-unasked-decisions-872e154.json': ['test/plan-ceo-floor-interactive-boundary.test.ts'],
@@ -163,6 +165,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/session-update-heartbeat.sh': ['test/session-update-heartbeat.test.ts'],
'test/fixtures/shard-cli-parity/**': ['test/shard-cli-parity.test.ts'],
'test/fixtures/shard-equivalence/**': ['test/shard-engine-equivalence.test.ts'],
'test/fixtures/shared-libs-claude-version-probe.json': ['test/shared-libs-fixture.test.ts'],
'test/fixtures/shared-libs-no-change-ci-public.json': ['test/shared-libs-fixture.test.ts'],
'test/fixtures/shared-libs-plan-callers-fixes-behavior-local.json': ['test/shared-libs-plan-actor.test.ts'],
'test/fixtures/shared-libs-plan-callers-future-risk-37195203538.json': ['test/shared-libs-plan-actor.test.ts'],
@@ -173,6 +176,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/shared-libs-plan-callers-slash-scope-37174266054.json': ['test/shared-libs-plan-actor.test.ts'],
'test/fixtures/shared-libs-plan-callers-verbless-scope-37186854666.json': ['test/shared-libs-plan-actor.test.ts'],
'test/fixtures/shared-libs/**': ['test/shared-libs-checker-interface-evidence.test.ts', 'test/shared-libs-fixture.test.ts', 'test/shared-libs-plan-actor.test.ts', 'test/shared-libs-revalidation-prompt.test.ts', 'test/shared-libs-review-start-evidence.test.ts', 'test/shared-libs-source-reads.test.ts', 'test/shared-libs-stage-actor.test.ts'],
'test/fixtures/ship-local-hook-reply.json': ['test/ship-hook-actor.test.ts'],
'test/fixtures/ship-queue/gbrain-stamp-pair.json': ['test/helpers/ship-queue-fixture.ts', 'test/tree-receipt-gbrain-pair.test.ts'],
'test/fixtures/ship-triage/**': ['test/ship-triage-labels.test.ts'],
'test/fixtures/skill-md-size-allowlist.json': ['test/skill-md-size-guard.test.ts'],
@@ -410,6 +410,8 @@ export function currentFilePermissionEpoch(file: string | undefined, expected: s
if (!stat.isFile() || stat.size > MAX_RECORD_BYTES || transcript.status !== 'ready') return null;
const r = JSON.parse(fs.readFileSync(file,'utf8'));
const sessions = new Set([...transcript.calls.map(c=>c.sessionId),...transcript.assistantMessages.map(m=>m.sessionId)]);
// A parent that has only used tools so far (no text, no question) is identified by its public tool events.
if (!sessions.size) readPlanCountTranscript(config, cwd, event => sessions.add(event.sessionId));
const time = Date.parse(r.timestamp);
const validId = (id: unknown) => typeof id === 'string' && id.startsWith(r.sessionId+':') && identifier(id.slice(r.sessionId.length+1));
if (r.cwd !== cwd || r.expected !== expected || !identifier(r.sessionId) || sessions.size !== 1 || !sessions.has(r.sessionId) ||
+19 -5
View File
@@ -41,7 +41,8 @@ export interface PlanSkillFloorObservation {
| 'silent_write'
| 'exited'
| 'timeout'
| 'assessment_error';
| 'assessment_error'
| 'permission_unanswered';
summary: string;
/** Public current viewport for an accepted finding; terminal tail otherwise. */
evidence: string;
@@ -190,6 +191,7 @@ export async function runPlanSkillFloorCheck(opts: PlanSkillFloorOptions): Promi
since: 0, commandStartedAt: 0, targetDelivery: undefined, saveSnapshot: undefined, nativeCandidates: [],
validatedPendingQuestion: undefined, sampledAt: undefined, lastCheckpointAt: 0, lastCheckpointState: '',
artifactError: undefined, finished: false, started: false, start: 0, deadlineAt: 0, screenDeadlineAt: 0,
permissionUnansweredSince: undefined,
} as unknown as FloorRun;
return runPtySession<PlanSkillFloorObservation>({
driver, budgetMs: timeoutMs,
@@ -266,6 +268,8 @@ interface FloorRun {
start: number;
deadlineAt: number;
screenDeadlineAt: number;
/** When the current permission render was first left unanswered by this actor. */
permissionUnansweredSince: number | undefined;
}
async function floorStart(run: FloorRun, session: ClaudePtySession): Promise<undefined> {
@@ -388,19 +392,27 @@ async function floorTick(run: FloorRun, session: ClaudePtySession): Promise<PtyS
? planFloorDXPane(run.viewport, call) !== null : matchesNativePlanQuestion(run.viewport, call, run.planningDirectory));
run.pendingQuestion = matching.length === 1 ? matching[0] : undefined;
floorCheckpoint(run, session);
if (floorPermission(run, session)) return 'continue';
if (floorPermission(run, session)) {
const waited = run.permissionUnansweredSince === undefined ? 0 : driver.now() - run.permissionUnansweredSince;
return waited < PERMISSION_UNANSWERED_MS ? 'continue' : finish({ auqObserved: false, outcome: 'permission_unanswered',
summary: `PERMISSION_DIALOG_UNANSWERED: a Claude Code permission dialog stayed open for ${waited}ms without an owned grant`,
evidence: run.viewport.slice(-3000), elapsedMs: driver.now() - run.startedAt });
}
const question = floorQuestion(run, session, currentCalls);
if (question) return question;
return floorAssess(run, session, visible);
}
/** This actor answers only owned file grants; any other permission render fails fast with a named cause. */
const PERMISSION_UNANSWERED_MS = 20_000;
/** An authorized owned file write enables the review, but never supplies its
* finding question. True when an active permission render owns this tick. */
function floorPermission(run: FloorRun, session: ClaudePtySession): boolean {
const { fixture, viewport } = run;
const permissionIsActiveRender = !run.pendingQuestion &&
(isPermissionDialogVisible(viewport) || isCroppedEditPermissionVisible(viewport));
if (!permissionIsActiveRender) return false;
if (!permissionIsActiveRender) { run.permissionUnansweredSince = undefined; return false; }
// Exclude the permission's old render after approval.
const owned = currentFilePermissionBinding(run.ownedFilePermissions, fixture.cwd,
session.hermeticConfigDir, run.startedAt, run.transcript, viewport);
@@ -412,8 +424,10 @@ function floorPermission(run: FloorRun, session: ClaudePtySession): boolean {
catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error; }
ordinaryOwnedTarget = parent === fs.realpathSync(fixture.cwd) && (!target || target.isFile());
} catch { /* No authority for a linked, foreign, or unreadable target. */ }
if (owned && ordinaryOwnedTarget && owned.binding.guard(viewport, session.visibleText(), owned.epoch) === 'grant')
session.send('1\r');
const decision = owned && ordinaryOwnedTarget ? owned.binding.guard(viewport, session.visibleText(), owned.epoch) : null;
if (decision === 'grant') session.send('1\r');
// A grant or its lingering render is answered; anything else waits on no one.
run.permissionUnansweredSince = decision ? undefined : run.permissionUnansweredSince ?? run.driver.now();
return true;
}
+1 -1
View File
@@ -26,7 +26,7 @@ export function qaDeadlineShellPolicy(directory: string, guard: string, browse:
${allowed.slice(1).join('\n')}
Use Read/Glob for local inspection and Write only inside ${path.join(directory, 'qa-reports')}; the report and screenshots directories already exist. Memory files and learning stores outside that directory are not authorized. Write the initial charters and final report to the same caller-owned file ${path.join(directory, 'qa-reports/qa-only-report.md')}, not a separate charter file.
Every other Bash call must be exactly one invocation of bun ${quote(guard)}, with literal arguments, no outer assignments, substitutions, globs, pipes, redirects, prefixes, suffixes or shell operators. The exact runtime path ${quote(process.execPath)} may replace bun; no other launcher is accepted.
Start exactly once with: bun ${quote(guard)} start ${quote(file)} 30
Start exactly once, and only after you have read the workflow sections you need and your Write of the initial charter to ${path.join(directory, 'qa-reports/qa-only-report.md')} has completed; the 30-second deadline begins at start: bun ${quote(guard)} start ${quote(file)} 30
Then use bun ${quote(guard)} status ${quote(file)} or bun ${quote(guard)} run ${quote(file)} -- COMMAND ARGS. Use the absolute guard path directly, not $G.
For browser scripts, put all assignments, pipelines and scripts INSIDE the child: bun ${quote(guard)} run ${quote(file)} -- bash -c 'B="${browse}"; "$B" goto URL; "$B" snapshot -i'. Literal argv and single/double quoted literal arguments are accepted; expansions are only allowed inside the single-quoted child script.
Do not write, reset, replace, chmod or remove deadline.json, invoke the guard recursively, or print QA_DEADLINE receipts yourself. Browser cleanup also goes inside the guard; after expiry only local report bookkeeping is allowed. Fallback screenshots must be saved directly in the owned screenshots directory; retain them and write the report after expiry without new browser calls. This fixture does not accept a separate post-expiry shell copy from Aside's session directory; mark that artifact unavailable rather than launching new browser work.
+6 -1
View File
@@ -506,11 +506,16 @@ export function isInternalClaudeGitRequest(request: SourceRequest, commands: str
const [gc, gcAuto, maint, maintAuto, ...afterMaintenance] = tail;
const hostPrefixes = [[...head, ...tail],
[...head, '-c', 'format.pretty=medium', gc!, gcAuto!, maint!, maintAuto!, ...hooks292, ...afterMaintenance]];
// 2.1.292's version probe: core.askPass= first, no pathspec/quoting configs,
// and only --version after the hook list. It qualifies as this exact argv.
const versionProbe = ['-c', 'core.askPass=', ...head, '-c', 'format.pretty=medium', gc!, gcAuto!, maint!, maintAuto!, ...hooks292,
'-c', 'core.hooksPath=/dev/null', '-c', 'core.fsmonitor=', '--version'];
// Require direct process ancestry AND the exact observed host prefix AND no
// matching model request. A shell/model-issued unguarded Git call still fails.
return request.tool === 'git' && !!request.ppid &&
/(?:^|[/\\])claude(?:\.exe)?$/.test(request.parentExecutable || '') &&
hostPrefixes.some(prefix => JSON.stringify(request.args.slice(0, prefix.length)) === JSON.stringify(prefix)) &&
(hostPrefixes.some(prefix => JSON.stringify(request.args.slice(0, prefix.length)) === JSON.stringify(prefix)) ||
JSON.stringify(request.args) === JSON.stringify(versionProbe)) &&
!commands.some(command => command.includes('core.safecrlf=false') || command.includes('protocol.ext.allow=never'));
}
+1 -1
View File
@@ -130,7 +130,7 @@ export function shipHookFailures(fixture: ReturnType<typeof createShipHookFixtur
} else {
check(evidence.localHook === localPolicy, 'existing local policy changed');
check(evidence.interactions.length === 0, 'existing local policy requires manual integration, not consent to overwrite');
check(/manual/i.test(result.output), 'manual integration was not reported');
check(/manual|\bintegrat\w*\b[^.\n]{0,40}\byourself\b|\bcombine\b[^\n]{0,160}\bby hand\b/i.test(result.output), 'manual integration was not reported');
}
}
return { failures, evidence: { ...evidence, callback } };