Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

test(flaky): marathon census reds on 297f50c7 (gh telemetry in fixture HOME, /autoplan handoff) and two free flakes (GST-1793) (#4128)

Garry Tan52d6c46957db
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 000000000..38bbce8a0
--- /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 10202734c..2c82722d4 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 cc0728954..b0a4dc2f2 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 4ae26efe0..ead28775d 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 3c823dc42..293c8289b 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 2ed612a42..5b11d4047 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('<!-- gstack:office-hours:report:start -->', '## Relationship Closing\nYou prioritize clear demand evidence.\n\n<!-- gstack:office-hours:report:start -->');
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 1d4979a22..582034626 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 eaca23f36..615b6af5f 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);