fix(flaky): repair the five paid gate detectors and the judged review/plan-review prose (GSTA-128)

Daily flaky pass over the 2026-10-27 Open ledger entries, paid cases first.

- ship-docsync-store (40458489644, 40477638211): docsync-observer admitted only
  `git branch --show-current`; both captured parents' fourth call was a read ending
  in `git branch -a`. Operand-free branch listings are now part of the read grammar.
- ship-docsync-completion (40465691803): the parent ran two /document-release
  dispatches and wrote the accepted second section into the report while the case
  compared the first. The contract now follows the last foreground dispatch.
- ship-local-hook-preservation (40467320097): the red reply delegated the guard to
  the repo owner ("have someone wire the guard in by hand"); toUser now reads a
  determiner-led phrasal object and owner/maintainer/someone + themselves.
- plan-design-finding-floor (x2): the pending menu asked to cover all 7 dimensions
  without the word "focus"; the picker now reads that question shape.
- Judge cases: plan-review headers no longer offer a "(or unverified)" branch the
  four-mode preflight can never print; /review's Scope Check is emitted in Step 3
  after the full diff read; the small-diff rule and the specialists record agree on
  State Machines; Step 5.8.2 names which post-fix rerun rule governs. Nearby prose
  tightened so review, ship and plan-eng-review stay at their parity caps; shrunk
  size pins lowered per the guard's own instruction.

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-27 14:11:17 +00:00
1 parent 3e4240a76f
commit 79ac33c96e
29 files changed
+1176 -143

No files matched your search

+22 -10
View File
@@ -5,7 +5,7 @@ import { CAPTURE_LONG_MS, CAPTURE_MS } from './helpers/eval-budgets';
import { runSkillTest } from './helpers/session-runner';
import { runId, describeIfSelected, testConcurrentIfSelected, createEvalCollector, recordE2E, finalizeEvalCollector, logCost } from './helpers/e2e-helpers';
import { describeE2ETier } from './helpers/e2e-gate';
import { docsDispatchIndex, parseDocsCompletion, vetDocsCompletion } from './helpers/docsync-contract';
import { docsDispatchIndices, parseDocsCompletion, vetDocsCompletion } from './helpers/docsync-contract';
import { fixtureDocs, repoSnapshot, changedFiles, DOC_PATH, preserveDocsEvidence, sawSpawnedMarker, childReportedSpawnedMarker, type DocsScenario } from './helpers/docsync-fixture';
import { observeDocsWrites, docsWriteFailures, docsShipPhase, docsToolFailures, docsCompletedRead, docsSessionOptions } from './helpers/docsync-observer';
import type { SkillTestResult } from './helpers/session-runner';
@@ -51,13 +51,16 @@ async function runShipDocs(testName: string, scenario: DocsScenario) {
if (!result) throw Error('missing native parent result');
logCost(testName, result);
const calls = result.toolCalls;
const dispatch = docsDispatchIndex(calls);
const dispatches = docsDispatchIndices(calls);
const dispatch = dispatches[0] ?? -1;
const publishCall = calls.findIndex(call => call.tool === 'Bash' && String(call.input?.command).includes(`bun ${publish}`));
let passed = false;
try {
expect(dispatch).toBeGreaterThanOrEqual(0);
expect(calls[dispatch].input.run_in_background).toBe(false);
if (publishCall >= 0) expect(dispatch).toBeLessThan(publishCall);
// The gate's attempt budget: an initial audit plus at most one re-audit, every child in the foreground.
expect(dispatches.length).toBeLessThanOrEqual(2);
for (const index of dispatches) expect(calls[index].input.run_in_background).toBe(false);
if (publishCall >= 0) expect(dispatches.at(-1)!).toBeLessThan(publishCall);
expect(result.exitReason).toBe('success');
expect(docsWriteFailures(observation!, scenario === 'current' || scenario === 'store' ? [] : [DOC_PATH], {
result, fixture, scripts: [publish], readOnly: scenario === 'current' || scenario === 'store',
@@ -77,18 +80,27 @@ async function runShipDocs(testName: string, scenario: DocsScenario) {
expect(changed).toEqual([]);
expect(output).not.toMatch(/Documentation(?: is|:) current/i);
} else {
const raw = JSON.parse(calls[dispatch].output.trimEnd().split('\n').at(-1)!);
const contract = parseDocsCompletion(calls[dispatch].output, raw.audit_id);
expect(JSON.stringify(calls[dispatch].input)).toContain(raw.audit_id);
expect(childReportedSpawnedMarker(result, calls[dispatch])).toBe(true);
// The parent accepts the last attempt; a rejected earlier attempt's edits stay in the tree (Blocked recovery preserves
// partial content), so the accepted contract owns only the paths no earlier attempt reported.
const contracts = dispatches.map(index => {
const raw = JSON.parse(calls[index].output.trimEnd().split('\n').at(-1)!);
const contract = parseDocsCompletion(calls[index].output, raw.audit_id);
expect(JSON.stringify(calls[index].input)).toContain(raw.audit_id);
expect(childReportedSpawnedMarker(result, calls[index])).toBe(true);
return contract;
});
const contract = contracts.at(-1)!;
const retained = contracts.slice(0, -1).flatMap(earlier => earlier.files_updated);
expect(sawSpawnedMarker(result)).toBe(true);
vetDocsCompletion(contract, {
settled: result.exitReason === 'success', markerSeen: sawSpawnedMarker(result),
headUnchanged: after.head === fixture.before.head, indexUnchanged: after.index === fixture.before.index,
candidateUnchanged: changed.every(p => p === DOC_PATH), readOnly: false,
changedPaths: changed, allowedDocs: [DOC_PATH],
changedPaths: changed.filter(p => !retained.includes(p)), allowedDocs: [DOC_PATH],
});
expect(contract.status).toBe(scenario === 'current' ? 'current' : 'updated');
expect(contract.status).not.toBe('blocked');
if (scenario === 'current') expect(contracts.map(attempt => attempt.status)).toEqual(contracts.map(() => 'current'));
else expect(contracts.some(attempt => attempt.status === 'updated' && attempt.files_updated.includes(DOC_PATH))).toBe(true);
expect(contract.files_reviewed).toContain(DOC_PATH);
expect(docsCompletedRead(result, path.join(fixture.repo, DOC_PATH), fixture, {
source: Buffer.from(fixture.before.contents[DOC_PATH], 'base64').toString('utf8'),