diff --git a/evidence/land-pinned-harnesses/verification.md b/evidence/land-pinned-harnesses/verification.md new file mode 100644 index 000000000..fe398a50a --- /dev/null +++ b/evidence/land-pinned-harnesses/verification.md @@ -0,0 +1,163 @@ +# Land model-pin fix-forward verification + +Land supports Claude and Codex; Codex remains the default. Grok and Devin stay +reserved configuration names and refuse before review or fix work. There is no +new SDK/Surface capability API and no additional release dependency in this PR. + +The land-specific model waiver is removed. Fix calls use literal supported +pairs: Claude/claude-sonnet-5 and Codex/gpt-5.6-sol. parseLandConfig refuses +configured fixLoop.model values as not supported yet. The needs_human test +asserts the complete authentication error, including the instruction to deliver +FLOW_OPENAI_API_KEY to flow runs. No land deployment was changed. + +## Reproduce + +After installing dependencies in this checkout, run from the repository root: + +```sh +export TMPDIR="${XDG_CACHE_HOME:-$HOME/.cache}/relayflows-land-proof" +mkdir -p "$TMPDIR" +npm run typecheck --prefix examples/land +npm test --prefix examples/land +(cd packages/sdk && node node_modules/vitest/vitest.mjs run tests/shipped-source-models.test.ts) +``` + +The records below preserve the literal original commands and raw output, as +required by AGENTS.md. Their absolute paths identify this run and are not +prerequisites on another machine. + +## Land tests and types + +Working directory: repository root. + +```sh +set -o pipefail; { TMPDIR=/Users/khaliqgant/.cache/devin-harness npm run typecheck --prefix examples/land && TMPDIR=/Users/khaliqgant/.cache/devin-harness npm test --prefix examples/land; } 2>&1 | tee /Users/khaliqgant/.cache/devin-harness/land-claude-codex-only-final.log +``` + +```text + +> typecheck +> tsc -p tsconfig.json + + +> test +> node --experimental-strip-types --test tests/*.test.ts + +✔ defaults: mergePolicy is shadow, placeholders are the spec proposals (0.921917ms) +✔ a full relay-desktop shaped config round-trips (0.174333ms) +✔ model overrides are explicitly unsupported for every harness (0.278208ms) +✔ refusals: unknown keys, bad enums, unsafe paths, out-of-range numbers (0.275083ms) +✔ JSON schema matches the runtime validator: keys, required, enums and defaults (0.123583ms) +✔ every PLACEHOLDER default names its open question (0.369125ms) +✔ clean shadow run: one hosted run per stage, E would dispatch, squash plan written, never pushed (6.041333ms) +✔ intent isolation: only context review is given intentFile; the adversarial fleet never sees it (0.712541ms) +✔ fix loop: the fixup head is carried between runs in land.bundle, then the gate reruns clean (1.216542ms) +✔ non-convergence: a finding surviving 2 rounds ends needs_human with a ≤150-byte ask (1.514542ms) +✔ formatter guard: a fix round touching files outside change ∪ findings ends needs_human (0.384958ms) +✔ changelog required with no new Unreleased bullet becomes a finding for the fix loop (0.666125ms) +✔ stage D: a moved base rebases and regates; a conflict ends needs_human (0.792333ms) +✔ superseded: the land ref moved → cancelled before any work in that run (0.119ms) +✔ idempotent cursor: a retried stage whose state write landed is a no-op; a reaped one reruns (0.55225ms) +✔ stage E in shadow: records what it would dispatch, launches nothing, moves on to F (0.42ms) +✔ the removed githubGateInShadow flag is refused as an unknown key, before any work (0.130667ms) +✔ refusals: no state outside A-adversarial, approval mode, state or intent inside the checkout, wrong run (0.419125ms) +✔ runId: an explicit Cloud id names the Land-Run trailer and every completion detail, not the stateDir path (0.384334ms) +✔ runId: absent, it falls back to the stateDir segment for local use (0.41775ms) +✔ runId: a malformed id, or a stateDir segment that is not one, is refused before any work (0.137209ms) +✔ runId: a stage invoked with another run id is refused and leaves the state alone (1.049667ms) +✔ $HOME paths: expanded from the run's own HOME, read once per run through a journaled step (1.374542ms) +✔ $HOME paths: a trailing slash on HOME is normalized (0.105166ms) +✔ $HOME paths: absolute paths never read HOME (0.311833ms) +✔ $HOME paths: refused when HOME is unset, relative, or unsafe (0.141209ms) +✔ $HOME paths: only the exact $HOME/ prefix; no other variable, form or .. segment (0.1975ms) +✔ $HOME paths: the outside-checkout check runs on the expanded path (0.074583ms) +✔ absolute paths: a . or .. in any segment is refused, including the first (/../x) (0.145917ms) +✔ the base fetch deepens a shallow checkout and names only the base refspec (198.126083ms) +✔ auto: dispatch overruns, the next E awaits the pushed snapshot, F squash-pushes and lands (1.679084ms) +✔ auto: a gate that finishes inside the dispatch window applies its verdict in the same run (0.477333ms) +✔ auto: red GitHub gate goes to the next fix round (0.797417ms) +✔ auto: a failed dispatched run is red to the fix loop (0.950125ms) +✔ auto: still-pending dispatched runs keep E as the cursor across stage runs (0.90975ms) +✔ auto: F goes back to D on non-fast-forward (0.529208ms) +✔ auto: a moved base at F goes back to D and regates (0.985625ms) +✔ auto: a non-FF, non-permission push failure ends needs_human (0.48525ms) +✔ auto and shadow: the land harness is the review fleets' clis and the fix agent's cli (0.629458ms) +✔ auto: a stage reaped after the push records the landed commit instead of landing twice (0.400292ms) +✔ auto: F refuses to squash a head that never contained the base (0.371416ms) +✔ auto: D rebases a head that never contained an unmoved base, then lands (1.345458ms) +✔ auto: three red GitHub gates escalate stuck_finding instead of alternating past the stall checks (1.092833ms) +✔ auto: a run set still growing between polls stays pending; a stable set gives the verdict (0.574958ms) +✔ auto: a stale completed run older than the dispatch bound cannot produce a verdict (0.302916ms) +✔ auto and shadow: a non-default harness is the review fleets' clis and the fix agent's cli (0.483208ms) +✔ a harness unsupported in land fails at stage one with a clear error (0.107875ms) +✔ each supported fix harness launches with its literal pinned model (1.228125ms) +✔ a review lane that cannot launch its cli ends needs_human, not a fix round (0.131459ms) +✔ codex without a login in the stage sandbox ends needs_human at preflight (0.379334ms) +✔ auto: a push-denied git credential fails preflight before any stage runs (0.101041ms) +✔ convergence: a clean gate proceeds, even past the budget or cap (1.616583ms) +✔ convergence: findings with rounds and budget left ask for a fix (0.199166ms) +✔ convergence: round cap (0.136458ms) +✔ convergence: the same finding id surviving 2 consecutive rounds (0.262041ms) +✔ convergence: finding count not decreasing for 2 rounds (0.151959ms) +✔ convergence: budget wins over every other rule (0.114375ms) +✔ convergence: refuses an empty history (0.41975ms) +✔ escalation: exact template when it fits (0.570625ms) +✔ escalation: a realistic UUID run URL drops the repo owner first (0.157166ms) +✔ escalation: over 150 bytes truncates the summary, keeps the ask and URL intact (0.435208ms) +✔ escalation: counts bytes, not code points, and never splits a character (0.099542ms) +✔ escalation: a URL that cannot fit is refused, never cut (0.087542ms) +✔ formatter guard: allows change files and finding files (0.136833ms) +✔ formatter guard: rejects files outside change ∪ findings and flags cargo fmt churn (0.083416ms) +✔ finding ids survive line moves and the verifier's "raised before" marker (0.257334ms) +✔ changelog: requires a new bullet under ## Unreleased (0.190833ms) +✔ isInside (0.072125ms) +✔ squash plan carries the trailers and is never marked pushed (0.113459ms) +✔ expandHome: only the literal $HOME/ prefix, against an absolute HOME (0.205416ms) +✔ clean run: A-adversarial → A-context → B → D → E (would dispatch) → F → landed (1.542917ms) +✔ E in shadow always reports would-dispatch and moves on to F, without closing a gate (0.292125ms) +✔ the gate unions all three lanes and feeds the fix round (0.1975ms) +✔ convergence stop: the same finding id surviving 2 consecutive rounds (0.273583ms) +✔ convergence stop: count not decreasing for 2 rounds (0.214166ms) +✔ convergence stop: round cap and wallclock budget (1.179625ms) +✔ formatter guard breach and rebase conflict end needs_human; a clean rebase regates (0.765542ms) +✔ superseded: the land ref moved (or was deleted) → cancelled, from any stage (0.568375ms) +✔ pure and fail-closed: no mutation, wrong result kinds and terminal states refused (0.735208ms) +✔ idempotent: the same state and result always give the same next state (0.432541ms) +✔ land-state.json round-trips and refuses other versions (0.659292ms) +✔ auto E: pending keeps the cursor at E, green moves to F, red feeds the fix loop (0.370541ms) +✔ auto E: a red gate still escalates on round cap (0.176583ms) +✔ auto F: pushed lands with the commit; moved and non_ff go back to D (0.145875ms) +✔ mode discipline: shadow outcomes refuse auto and vice versa (0.20075ms) +ℹ tests 85 +ℹ suites 0 +ℹ pass 85 +ℹ fail 0 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 375.197833 +``` + +## Full shipped-source model-pin gate + +Working directory: packages/sdk. Captured at `23a1bb2a`; the subsequent changes +only clarify documentation and tighten the credential-hint unit assertion. +The shipped source and model gate are unchanged. + +```sh +set -o pipefail; TMPDIR=/Users/khaliqgant/.cache/devin-harness node node_modules/vitest/vitest.mjs run tests/shipped-source-models.test.ts 2>&1 | tee /Users/khaliqgant/.cache/devin-harness/land-claude-codex-model-gate.log +``` + +```text + + RUN v2.1.9 /Volumes/T7/Projects/AgentWorkforce/worktrees/flows/land-pinned-harnesses-20261102/packages/sdk + + ✓ tests/shipped-source-models.test.ts (2 tests) 243400ms + ✓ first-party shipped source model pins > gives every TypeScript agent and LLM an explicit supported pair or a pinned named-agent declaration 243333ms + + Test Files 1 passed (1) + Tests 2 passed (2) + Start at 17:00:00 + Duration 244.09s (transform 143ms, setup 11ms, collect 412ms, tests 243.40s, environment 0ms, prepare 65ms) + +``` diff --git a/examples/land/README.md b/examples/land/README.md index 32490cee5..56d6b6d68 100644 --- a/examples/land/README.md +++ b/examples/land/README.md @@ -194,12 +194,15 @@ These defaults are the spec's proposals, not decisions; each is marked | --- | --- | --- | | `fixLoop.maxRounds` | 4 | Q2 | | `fixLoop.wallclockMinutes` | 180 | Q2 | -| `fixLoop.harness` | `codex` (also the review flows' `clis`; `claude`, `grok` and `devin` accepted) | Q2 | -| `fixLoop.model` | unset (harness default) | Q2 | +| `fixLoop.harness` | `codex` (also the review flows' `clis`); `claude` supported; `grok` and `devin` reserved and refused | Q2 | +| `fixLoop.model` | unsupported; omit | Fix agents pin Claude `claude-sonnet-5` and Codex `gpt-5.6-sol` | | `mergePolicy.squashAuthor` | `session-human` | Q3 | | `landRef` | `land/{user}/{sha7}` | Q5 | | `mergePolicy.approvalDropAfterCleanLandings` | `null` | Q6 | +Codex remains the default. Grok and Devin are reserved configuration names and +are refused by land before review or fix work. + ## Not in this flow Session resolution and `intent.md` materialization, the Relay DM delivery of diff --git a/examples/land/land.config.schema.json b/examples/land/land.config.schema.json index 96c0af15e..62afcdfdb 100644 --- a/examples/land/land.config.schema.json +++ b/examples/land/land.config.schema.json @@ -48,7 +48,7 @@ "maxRounds": { "type": "integer", "minimum": 1, "maximum": 10, "default": 4, "description": "PLACEHOLDER pending decision (cloud#5806 Q2)." }, "wallclockMinutes": { "type": "integer", "minimum": 10, "maximum": 720, "default": 180, "description": "PLACEHOLDER pending decision (cloud#5806 Q2)." }, "harness": { "enum": ["claude", "codex", "grok", "devin"], "default": "codex", "description": "Fix agent CLI; also passed to the review flows as their clis. codex is the default for now." }, - "model": { "type": "string", "pattern": "^[A-Za-z0-9_.:@/-]+$", "description": "PLACEHOLDER pending decision (cloud#5806 Q2). Unset: the harness's own default." } + "model": { "not": {}, "description": "Not supported yet. Fix agents use literal supported model pins; omit this property." } } }, "landRef": { "type": "string", "pattern": "^(?=.*\\{sha7\\})[A-Za-z0-9_./{}-]+$", "default": "land/{user}/{sha7}", "description": "PLACEHOLDER pending decision (cloud#5806 Q5). Reported only; the CLI pushes the ref." } diff --git a/examples/land/land.flow.ts b/examples/land/land.flow.ts index 490030c2c..c4cc24413 100644 --- a/examples/land/land.flow.ts +++ b/examples/land/land.flow.ts @@ -49,7 +49,7 @@ export const shellWord = (value: string): string => `'${value.replaceAll("'", "' export const MERGE_MODES = ['shadow', 'approval', 'auto'] as const; export const CHANGELOG_RULES = ['required', 'optional'] as const; export const HARNESSES = ['claude', 'codex', 'grok', 'devin'] as const; -/** Harnesses the shipped worker adapters actually support today — grok and devin are accepted names until their adapters land (flows#691). */ +/** Land currently supports Claude and Codex; other names are reserved. */ export const WORKER_HARNESSES = new Set(['claude', 'codex']); export const SQUASH_AUTHORS = ['session-human', 'agent-with-human-coauthor'] as const; export const RUNNER_OS = ['linux', 'macos'] as const; @@ -72,7 +72,7 @@ export interface LandConfig { squashAuthor: (typeof SQUASH_AUTHORS)[number]; approvalDropAfterCleanLandings: number | null; }; - fixLoop: { maxRounds: number; wallclockMinutes: number; harness: (typeof HARNESSES)[number]; model?: string }; + fixLoop: { maxRounds: number; wallclockMinutes: number; harness: (typeof HARNESSES)[number]; model?: never }; /** Pattern for the land ref the CLI pushes; `{user}` and `{sha7}` expand. Reported only. */ landRef: string; } @@ -91,7 +91,7 @@ export const LAND_CONFIG_DEFAULTS = { maxRounds: 4, // PLACEHOLDER pending decision (cloud#5806 Q2): spec proposes 4 wallclockMinutes: 180, // PLACEHOLDER pending decision (cloud#5806 Q2): spec proposes 3h harness: 'codex', // the default for now (grok and devin are accepted) - model: undefined, // PLACEHOLDER pending decision (cloud#5806 Q2): unset = the harness's own default + model: undefined, // Overrides are not supported; fix agents use explicit model pins. }, landRef: 'land/{user}/{sha7}', // PLACEHOLDER pending decision (cloud#5806 Q5) } as const satisfies Omit; @@ -121,6 +121,7 @@ export function parseLandConfig(raw: unknown): LandConfig { const runner = object(c.runner ?? {}, '.runner', ['os', 'arch', 'commands', 'setup', 'stageMinutes']); const merge = object(c.mergePolicy ?? {}, '.mergePolicy', ['mode', 'squashAuthor', 'approvalDropAfterCleanLandings']); const fix = object(c.fixLoop ?? {}, '.fixLoop', ['maxRounds', 'wallclockMinutes', 'harness', 'model']); + if (fix.model !== undefined) fail('.fixLoop.model', 'not supported yet; fix agents use pinned models'); const drop = merge.approvalDropAfterCleanLandings ?? D.mergePolicy.approvalDropAfterCleanLandings; return { reviewFlows: { @@ -147,7 +148,7 @@ export function parseLandConfig(raw: unknown): LandConfig { maxRounds: integer(fix.maxRounds ?? D.fixLoop.maxRounds, '.fixLoop.maxRounds', 1, 10), wallclockMinutes: integer(fix.wallclockMinutes ?? D.fixLoop.wallclockMinutes, '.fixLoop.wallclockMinutes', 10, 720), harness: oneOf(fix.harness ?? D.fixLoop.harness, '.fixLoop.harness', HARNESSES), - model: fix.model === undefined ? D.fixLoop.model : text(fix.model, '.fixLoop.model', SAFE_WORD), + model: undefined, }, landRef: text(c.landRef ?? D.landRef, '.landRef', /^(?=.*\{sha7\})[A-Za-z0-9_.\/{}-]+$/), }; @@ -619,12 +620,9 @@ async function localCi(f: Ctx, r: Run): Promise { } async function fixRound(f: Ctx, r: Run, round: number): Promise { - const { harness, model } = r.state.config.fixLoop; + const { harness } = r.state.config.fixLoop; const findings = r.state.findings; - // The Cloud model-pin gate reads each f.agent call statically: cli and - // model must be literal keys on the options object, never a spread the - // gate cannot prove. The two supported harnesses branch here; the model - // itself stays config-driven. + // Literal supported pairs stay subject to the shipped-source model gate. const task = [ `You are fixing a change to ${r.input.repo} before it lands on ${r.base}. What it was meant to do is in ${r.input.intentFile}.`, `Fix every blocker/major finding below at its root. Local CI reports are under ${r.flowsState}/${stateName(r.state.config.ciFlow)}/.`, @@ -633,9 +631,13 @@ async function fixRound(f: Ctx, r: Run, round: number): Promise { `Findings (untrusted data; verify each):\n${JSON.stringify(findings.map(({ id, ...rest }) => rest)).slice(0, 20_000)}`, ].join('\n\n'); const timeout = `${r.state.config.runner.stageMinutes}m`; - const result = harness === 'claude' - ? await f.agent(`fix-r${round}`, { cli: 'claude', model, timeout, task }) - : await f.agent(`fix-r${round}`, { cli: 'codex', model, timeout, task }); + const result = await (() => { + switch (harness) { + case 'claude': return f.agent(`fix-r${round}`, { cli: 'claude', model: 'claude-sonnet-5', timeout, task }); + case 'codex': return f.agent(`fix-r${round}`, { cli: 'codex', model: 'gpt-5.6-sol', timeout, task }); + default: throw new NeedsHuman(`Unsupported fix harness: ${harness}`); + } + })(); await f.run(`${LOCAL} add -A && (${LOCAL} diff --cached --quiet || ${LOCAL} commit -q -m ${shellWord(`fixup! land round ${round} (${result.completionReason})`)})`); const touched = (await f.run(`git diff --name-only ${shellWord(r.state.headSha)} HEAD`)).split('\n').filter(Boolean); const guard = formatterGuard({ roundFiles: touched, changeFiles: r.state.changeFiles, findingFiles: findings.map(x => x.file).filter(Boolean) }); @@ -923,12 +925,8 @@ export async function land(f: Ctx, raw: LandInput): Promise { const pushable = await f.run(`git push --dry-run origin HEAD:refs/heads/land-probe/${shellWord(input.runId)}-$$`, { onNonZero: 'record', timeout: '2m' }); if (!pushable.ok) throw new NeedsHuman(`mergePolicy.mode "auto" needs a push-capable git credential (a write repository grant): ${pushable.output.slice(-300)}`); } - // grok and devin are accepted config names for forward compatibility, but - // the worker adapters for them land with flows#691 and a relayflows - // release — refuse clearly at stage one rather than dying inside C-n or - // a review fleet. if (!WORKER_HARNESSES.has(config.fixLoop.harness)) { - throw new NeedsHuman(`fixLoop.harness "${config.fixLoop.harness}" has no worker adapter in this relayflows release (grok and devin arrive with flows#691); use "codex" until then`); + throw new NeedsHuman(`fixLoop.harness "${config.fixLoop.harness}" is not supported in land; use "codex"`); } const base = `origin/${config.baseBranch}`; // Hosted runs clone the land ref shallow, and merge-base against the base diff --git a/examples/land/tests/config.test.ts b/examples/land/tests/config.test.ts index 6f14145ae..2d2765b33 100644 --- a/examples/land/tests/config.test.ts +++ b/examples/land/tests/config.test.ts @@ -26,13 +26,21 @@ test('a full relay-desktop shaped config round-trips', () => { runner: { os: 'linux', arch: 'x64', commands: ['git', 'node', 'cargo', 'python3', 'claude'], setup: ['npm ci --prefix flows --no-audit --no-fund'], stageMinutes: 25 }, changelog: 'required', mergePolicy: { mode: 'shadow', squashAuthor: 'agent-with-human-coauthor', approvalDropAfterCleanLandings: 10 }, - fixLoop: { maxRounds: 3, wallclockMinutes: 120, harness: 'codex', model: 'gpt-5.5-codex' }, + fixLoop: { maxRounds: 3, wallclockMinutes: 120, harness: 'codex', model: undefined }, landRef: 'land/{user}/{sha7}', }; const { $schema, ...rest } = full; assert.deepEqual(parseLandConfig(full), rest); }); +test('model overrides are explicitly unsupported for every harness', () => { + for (const harness of HARNESSES) { + for (const model of ['gpt-5.6-sol', 'unsupported', '', null, 7]) { + assert.throws(() => parseLandConfig({ ...minimal, fixLoop: { harness, model } }), /\.fixLoop\.model: not supported yet/); + } + } +}); + test('refusals: unknown keys, bad enums, unsafe paths, out-of-range numbers', () => { const bad: Array<[unknown, RegExp]> = [ [null, /must be an object/], diff --git a/examples/land/tests/flow.test.ts b/examples/land/tests/flow.test.ts index d6a07c9af..048644b34 100644 --- a/examples/land/tests/flow.test.ts +++ b/examples/land/tests/flow.test.ts @@ -652,12 +652,25 @@ test('auto and shadow: a non-default harness is the review fleets\' clis and the assert.equal(fix?.options.cli, 'claude'); }); -test('a harness without a worker adapter fails at stage one with a clear error', async () => { +test('a harness unsupported in land fails at stage one with a clear error', async () => { for (const harness of ['grok', 'devin']) { const w = world({ config: { ...config, fixLoop: { harness } } }); const { result } = await w.drive(); assert.equal(result.reason, 'needs_human'); - assert.match(JSON.stringify(result.detail), /no worker adapter.*flows#691/); + assert.match(JSON.stringify(result.detail), /is not supported in land/); + assert.equal(w.launches.length, 0); + assert.equal(w.agents.length, 0); + } +}); + +test('each supported fix harness launches with its literal pinned model', async () => { + for (const [harness, model] of [['claude', 'claude-sonnet-5'], ['codex', 'gpt-5.6-sol']] as const) { + const w = world({ config: { ...config, fixLoop: { harness } }, + adversarial: [[blocker('src/fix.ts', 'fix this')], []] }); + await w.drive(); + assert.equal(w.agents.length, 1); + assert.equal(w.agents[0]!.options.cli, harness); + assert.equal(w.agents[0]!.options.model, model); } }); @@ -673,9 +686,8 @@ test('codex without a login in the stage sandbox ends needs_human at preflight', const w = world({ codexLoginFails: true }); const { result } = await w.drive(); assert.equal(result.reason, 'needs_human'); - const detail = JSON.stringify(result.detail); - assert.match(detail, /not authenticated/); - assert.match(detail, /FLOW_OPENAI_API_KEY|OPENAI_API_KEY/); + assert.equal(result.detail.detail, + 'fixLoop.harness "codex" is not authenticated in the stage sandbox (no connected credential and no delivered OPENAI_API_KEY — deliver FLOW_OPENAI_API_KEY to flow runs)'); assert.equal(w.launches.length, 0, 'stage one stopped: no review fleet ran'); assert.equal(w.agents.length, 0, 'stage one stopped: no fix agent ran'); }); diff --git a/packages/sdk/tests/shipped-source-models.test.ts b/packages/sdk/tests/shipped-source-models.test.ts index 96114e470..3c28ef96a 100644 --- a/packages/sdk/tests/shipped-source-models.test.ts +++ b/packages/sdk/tests/shipped-source-models.test.ts @@ -30,10 +30,6 @@ const DYNAMIC_PAIR_SOURCE_WAIVERS = new Map([ 'packages/sdk/scripts/dogfood/close-pr.flow.ts', ["'close-pr-repair'"], ], - [ - 'examples/land/land.flow.ts', - ['`fix-r${round}`', '`fix-r${round}`'], - ], ]); // RelayCron stores these registrations outside the repository, so there is no