From 52d6c46957db0c93e26a29a80b1a0fd698a7f3d7 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 7 Nov 2026 07:25:35 -0800 Subject: [PATCH] test(flaky): marathon census reds on 297f50c7 (gh telemetry in fixture HOME, /autoplan handoff) and two free flakes (GST-1793) (#4128) * test: pin GH_TELEMETRY=0 in hermetic eval env; office-hours handoff accepts /autoplan (flaky pass 2026-11-07) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: release-cut slow cases get the 30 s free-suite timeout; ruled-notes grant names both shas after review_loop_grant (flaky pass 2026-11-07) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * changelog: flaky pass 2026-11-07 fragment Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: record the hermetic-env.ts GH_TELEMETRY pin as non-behavioral at HARNESS_VERSION 6 (flaky pass 2026-11-07) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: pre-landing review fixes Review-Finding: p1/specialist-batched#1 reader=testing Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- changelog.d/capy-flaky-2026-11-07.md | 1 + .../test/helpers/hermetic-env.ts.json | 2 +- test/helpers/hermetic-env.ts | 4 ++++ test/helpers/office-hours-completion.ts | 2 +- test/hermetic-wiring.test.ts | 21 +++++++++++++++++++ test/office-hours-completion.test.ts | 19 ++++++++++++++--- test/release-cut.test.ts | 4 ++-- test/ship-finish-ruled-notes.test.ts | 2 +- 8 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 changelog.d/capy-flaky-2026-11-07.md diff --git a/changelog.d/capy-flaky-2026-11-07.md b/changelog.d/capy-flaky-2026-11-07.md new file mode 100644 index 0000000000..38bbce8a0a --- /dev/null +++ b/changelog.d/capy-flaky-2026-11-07.md @@ -0,0 +1 @@ +- **Flaky pass 2026-11-07: the two marathon census reds on 297f50c7 are repaired, and two free tests stop failing at random.** Eval children now run gh with `GH_TELEMETRY=0`, because gh 2.103 records a telemetry device-id under `$HOME/.local/state/gh`, and `autoplan-ceo-only` counted that file as a stray write in its fixture HOME (marathon 42371706491). The office-hours completion check accepts the next skills the handoff menu offers now that `/autoplan` is the default recommendation (#4108), and it rejects the retired `/plan-eng-review`. The ruled-notes chain test names both shas after `review_loop_grant`, so a short sha made only of digits no longer reads as a phone number to the approval scanner (Free Tests 42345572767). The two slowest release-cut cases get the free suite's 30-second per-test timeout, so a bare local `bun test` stops timing out at 5 seconds. No threshold, trial count, case kind or model budget changed. diff --git a/scripts/harness-pins/test/helpers/hermetic-env.ts.json b/scripts/harness-pins/test/helpers/hermetic-env.ts.json index 10202734c7..2c82722d4c 100644 --- a/scripts/harness-pins/test/helpers/hermetic-env.ts.json +++ b/scripts/harness-pins/test/helpers/hermetic-env.ts.json @@ -1 +1 @@ -{"blob":"cc072895461dc52ea317d1beff72121342420d30","since":6} +{"blob":"b0a4dc2f24a694c7f2c67889ddc8141297b7d540","since":6,"nonBehavioral":"GH_TELEMETRY=0 only stops gh writing its own telemetry device-id under HOME; gh stdout, stderr and exit codes are byte-identical with and without it (checked with gh 2.103.0: auth status and --version), so no model-visible input changes. The one verdict it touches is a HOME stray-write detector counting gh's own state file, which gh releases before 2.103 never wrote."} diff --git a/test/helpers/hermetic-env.ts b/test/helpers/hermetic-env.ts index cc07289546..b0a4dc2f24 100644 --- a/test/helpers/hermetic-env.ts +++ b/test/helpers/hermetic-env.ts @@ -24,6 +24,9 @@ * + DISABLE_AUTOUPDATER=1 (pinned in both branches; the scrub drops the * workflow's copy and every PTY screen otherwise shows the updater's * "no write permission to npm prefix" failure) + * + GH_TELEMETRY=0 (gh 2.103 records a telemetry device-id under + * $HOME/.local/state/gh, a stray write in every fixture HOME; run + * 42371706491's autoplan-ceo-only) * + per-test overrides spread LAST * * Escape hatch: EVALS_HERMETIC=0 restores the legacy contaminated env @@ -144,6 +147,7 @@ export function buildHermeticEnv( } if (!out.TERM) out.TERM = 'xterm-256color'; out.DISABLE_AUTOUPDATER = '1'; + out.GH_TELEMETRY = '0'; Object.assign(out, hermeticVars); for (const [k, v] of Object.entries(overrides ?? {})) if (v !== undefined) out[k] = v; return out; diff --git a/test/helpers/office-hours-completion.ts b/test/helpers/office-hours-completion.ts index 4ae26efe02..ead28775d3 100644 --- a/test/helpers/office-hours-completion.ts +++ b/test/helpers/office-hours-completion.ts @@ -223,7 +223,7 @@ export function validateOfficeHoursCompletion(evidence: OfficeHoursCompletionEvi const handoff = sectionBody(evidence.output, ['handoff', 'handoff — the relationship closing', 'handoff - the relationship closing']) || sectionBody(evidence.output, ['relationship closing']); if (!substantive(handoff)) fail('REPORT.md lacks a substantive Handoff'); - if (!/\/plan-(?:ceo|eng|design|devex)-review\b/.test(handoff)) fail('Handoff lacks the next-skill recommendation'); + if (!/\/(?:autoplan|plan-(?:ceo|design|devex)-review)\b/.test(handoff)) fail('Handoff lacks the next-skill recommendation'); if (!/\b(?:declined|deferred|not now|later)\b/i.test(handoff)) fail('Handoff does not record the declined downstream launch'); // The caller separately checks actual tool calls for downstream launch; // recording the user's choice here is not proof that it was respected. diff --git a/test/hermetic-wiring.test.ts b/test/hermetic-wiring.test.ts index 3c823dc422..293c8289bf 100644 --- a/test/hermetic-wiring.test.ts +++ b/test/hermetic-wiring.test.ts @@ -17,6 +17,7 @@ import { describe, test, expect } from 'bun:test'; import * as fs from 'fs'; import * as path from 'path'; import * as os from 'os'; +import { spawnSync } from 'child_process'; import { buildHermeticEnv, getHermeticDirs, hermeticSkillsConfigDir } from './helpers/hermetic-env'; const ROOT = path.resolve(import.meta.path, '..', '..'); @@ -101,6 +102,26 @@ describe('hermetic wiring tripwire', () => { expect(read('test/helpers/hermetic-env.ts')).toContain('DISABLE_AUTOUPDATER=1 (pinned in both branches'); }); + test('the hermetic branch pins GH_TELEMETRY=0, and a gh spawn under it leaves the fixture HOME empty (smoke)', () => { + // autoplan-ceo-only's HOME diff failed on gh 2.103's telemetry device-id + // (run 42371706491). The pin assertions guard that fix. The gh spawn is a + // smoke check only: an offline `gh auth status` in a fresh HOME does not + // write device-id even without the pin, so it cannot fail on unfixed code. + const base = { PATH: process.env.PATH ?? '/usr/bin', EVALS_HERMETIC: '1', GH_TELEMETRY: 'log' }; + expect(buildHermeticEnv(base, {}).GH_TELEMETRY).toBe('0'); + expect(buildHermeticEnv(base, {}, { GH_TELEMETRY: 'log' }).GH_TELEMETRY, 'per-test override stays last').toBe('log'); + const gh = Bun.which('gh'); + if (!gh) return; + const home = fs.mkdtempSync(path.join(os.tmpdir(), 'hermetic-gh-home-')); + try { + const env = buildHermeticEnv(base, {}, { HOME: home, XDG_STATE_HOME: path.join(home, '.local', 'state') }); + spawnSync(gh, ['auth', 'status'], { env, stdio: 'ignore', timeout: 15_000 }); + expect(fs.readdirSync(home, { recursive: true }).map(String)).toEqual([]); + } finally { + fs.rmSync(home, { recursive: true, force: true }); + } + }); + test('claude runners gate --strict-mcp-config on isHermeticEnabled()', () => { // Zero MCP servers for hermetic children; EVALS_HERMETIC=0 must restore // operator MCP along with the operator env (the flag may not be diff --git a/test/office-hours-completion.test.ts b/test/office-hours-completion.test.ts index 2ed612a42a..5b11d4047e 100644 --- a/test/office-hours-completion.test.ts +++ b/test/office-hours-completion.test.ts @@ -39,7 +39,7 @@ Observe Lee reconcile an event unaided and time the existing workflow. Disposition: CONCERNS_RECORDED The reviewer completed one round. Two unresolved reviewer concerns remain: pricing and the source-only default. ## Handoff -Lee's missing-booking worry gives this pilot a concrete correctness test. Next: /plan-eng-review after observing the workflow. The user declined launching it now and will run a review later. +Lee's missing-booking worry gives this pilot a concrete correctness test. Next: /autoplan after observing the workflow. The user declined launching it now and will run a review later. `; function completed(): OfficeHoursCompletionEvidence { return { @@ -391,6 +391,19 @@ describe('office-hours fixture completion', () => { const noDecline = report.replace('The user declined launching it now and will run a review later.', 'The design is ready for that next review.'); expect(() => validateOfficeHoursCompletion({ ...completed(), output: noDecline })).toThrow('declined downstream launch'); }); + + test('accepts every next skill the handoff menu offers and rejects the retired /plan-eng-review', () => { + // #4108 moved the default recommendation to /autoplan; run 42371706491 failed a + // correct /autoplan handoff against the old list. + const menu = fs.readFileSync(path.join(import.meta.dir, '..', 'office-hours', 'sections', 'design-and-handoff.md'), 'utf8'); + const offered = [...menu.matchAll(/^[A-C]\) Run (\/[\w-]+) now/gm)].map(match => match[1]); + expect(offered).toEqual(['/autoplan', '/plan-ceo-review', '/plan-design-review']); + for (const skill of offered) { + expect(() => validateOfficeHoursCompletion({ ...completed(), output: report.replace('Next: /autoplan', `Next: ${skill}`) })).not.toThrow(); + } + const retired = report.replace('Next: /autoplan', 'Next: /plan-eng-review'); + expect(() => validateOfficeHoursCompletion({ ...completed(), output: retired })).toThrow('next-skill recommendation'); + }); }); describe('office-hours reviewer finding preservation', () => { @@ -850,7 +863,7 @@ describe('office-hours mechanical review evidence', () => { const { evidence, artifacts } = structured(); evidence.output = evidence.output.replace('', '## Relationship Closing\nYou prioritize clear demand evidence.\n\n'); expect(() => checkArtifacts(evidence, artifacts)).not.toThrow(); - evidence.output = evidence.output.replace('/plan-eng-review', 'another discussion'); + evidence.output = evidence.output.replace('/autoplan', 'another discussion'); expect(() => validateOfficeHoursCompletion(evidence)).toThrow('next-skill recommendation'); }); @@ -917,7 +930,7 @@ You prioritize accounting for missing bookings over adding features; observe Lee ## Approval The actual selected approval is APPROVED with reviewer concerns recorded, not claimed fixed. ## Handoff -Next: /plan-eng-review after observing the workflow. The user declined launching it now and will run a review later. +Next: /autoplan after observing the workflow. The user declined launching it now and will run a review later. `; fs.mkdirSync(path.dirname(evidence.designPath), { recursive: true }); fs.writeFileSync(evidence.designPath, evidence.designContent); diff --git a/test/release-cut.test.ts b/test/release-cut.test.ts index 1d4979a224..582034626a 100644 --- a/test/release-cut.test.ts +++ b/test/release-cut.test.ts @@ -914,7 +914,7 @@ describe('release-cut: the security exception', () => { expect(next.plan.notes).toContain('2 versions since v1.0.4'); expect(next.plan.notes).not.toContain('- **1.0.4**'); expect(next.plan.notes).not.toContain('Security release'); - }); + }, 30_000); // Value: protects=a finishing security cut keeps its tag's recorded evidence (no live re-check that a removed label or a gh failure can break), a tag that // recorded a security cut but never moved stable cannot pass the floor without an explicit verified --security, and the advisory path counts only npm @@ -1052,7 +1052,7 @@ describe('release-cut: the regression exception', () => { const other = planRelease({ repo: f.repo, ref: later, git: f.git, gh: f.gh, now: () => moved.at + 3 * H, regression: '#93: worked in v1.0.4: other' }); expect(other.ok).toBe(false); if (!other.ok) expect(other).toMatchObject({ code: 'REFUSED_REGRESSION', message: 'tag v1.0.6 records the regression reason "#93: forged"; run it again with that same reason so the tag and the notes agree' }); - }); + }, 30_000); // Value: protects=an undatable stable and the very first cut stay closed to a regression claim (FLOOR_UNKNOWN is security-only; nothing earlier worked // before stable existed); fails_when=a regression cut moves a stable whose last move cannot be dated, or anchors to no release; why_new=the security diff --git a/test/ship-finish-ruled-notes.test.ts b/test/ship-finish-ruled-notes.test.ts index eaca23f367..615b6af5f2 100644 --- a/test/ship-finish-ruled-notes.test.ts +++ b/test/ship-finish-ruled-notes.test.ts @@ -294,7 +294,7 @@ describe('finish chains contiguous fix-check rows (GST-1627)', () => { // seam=finish's per-row grant match test('one grant naming both links\' stop heads counts for one link, and the chain refuses', () => { const { f, passHead, reviewed, reviewedBase, fc3 } = mergeShape({ grantFc3: false }); - const g = run(f, 'gstack-approvals', ['add', '--ask', `Owner grant: one scoped fix-check after ${passHead.slice(0, 12)} (review_loop_grant ${fc3.slice(0, 12)})`, '--words', 'one scoped fix-check', '--by', 'gstack minder (GSTA-36)', '--scope', 'this /ship invocation', '--json']); + const g = run(f, 'gstack-approvals', ['add', '--ask', `Owner grant: one scoped fix-check (review_loop_grant ${passHead.slice(0, 12)}, review_loop_grant ${fc3.slice(0, 12)})`, '--words', 'one scoped fix-check', '--by', 'gstack minder (GSTA-36)', '--scope', 'this /ship invocation', '--json']); expect(g.status, g.stderr).toBe(0); logLink(f, fc3); const r = finishAfterAudit(f, reviewed, reviewedBase);