fix(#2834): write defaults.json before agent TOML generation on clean Codex install (#2900)

* fix(#2834): write defaults.json before agent TOML generation on clean Codex install

Extracted writeNonClaudeDefaults(runtime) and called it BEFORE installCodexConfig
so the runtime-aware model resolver has resolve_model_ids=omit + runtime=codex in
~/.gsd/defaults.json before agent TOMLs are generated. Pre-fix, a clean first Codex
install generated TOMLs with no model fields (the resolver didn't know the runtime);
a second run fixed it. The original inline defaults-write block (which ran AFTER agent
generation) is replaced by the earlier function call (idempotent).

* chore(#2834): changeset fragment

* fix+test(#2834): acknowledge codex TOML drift (emitted-attribution) + fix test comment window

The emitted-attribution gate flags 19 codex agent TOMLs that now carry model-routing
fields (the fix's correct effect) but can't link them to a .md or src/ change (the fix
is in bin/install.js ordering). Acknowledge the drift in emitted-drift-ack.json. Fix the
test's comment-detection window (300 chars to capture the #2834 rationale).

* fix(#2834): ack remaining 15 codex TOML drift paths

* chore(#2834): backfill changeset PR number (2900)

* chore(#2834): ack code-review.md growth from concurrent merge (rebase pickup)

* fix(#2834): remove stale code-review.md ack (emitted-attribution failure)

CI failed: 'differential attribution over the real tree' — the code-review.md
ack added in 6e0b4b3b8 ('ack code-review.md growth from concurrent merge') is
STALE: this PR's diff does not touch code-review.md (only bin/install.js + tests
+ changeset), so the ack explains growth that isn't here. The base already
absorbed the concurrent code-review.md growth; the ack is inert here and the
gate flags it as stale. Remove it.

---------

Co-authored-by: Test <test@example.com>
(cherry picked from commit 00c859fae5)
This commit is contained in:
Tom Boucher
2026-07-31 00:47:55 -04:00
committed by sim
parent a38e4d080d
commit dc73680532
4 changed files with 204 additions and 59 deletions

View File

@@ -2,19 +2,118 @@
"version": 1,
"paths": {
"plan-phase.md": {
"reason": "#2770: decision-coverage gate recomputes CONTEXT_PATH in-block + guards the empty-glob case (handler now fails closed on empty arg). Net growth kept under the ADR-857 size cap by condensing adjacent §13a prose/JSON; the residual +89 bytes are the irreducible glob+guard logic."
"reason": "#2770: decision-coverage gate recomputes CONTEXT_PATH in-block + guards the empty-glob case (handler now fails closed on empty arg). Net growth kept under the ADR-857 size cap by condensing adjacent \u00a713a prose/JSON; the residual +89 bytes are the irreducible glob+guard logic."
},
"discuss-phase-assumptions.md": {
"reason": "#2772: re-synced <answer_validation> to the parent canonical block (had drifted — lost the 'Other' empty-text branch) + fixed the auto_advance→confirm_creation circularity (end the workflow). discuss-phase.md is net -11 (condensed); auto.md shrank -4650 (removed a dead MAX_PASSES resolver shim)."
"reason": "#2772: re-synced <answer_validation> to the parent canonical block (had drifted \u2014 lost the 'Other' empty-text branch) + fixed the auto_advance\u2192confirm_creation circularity (end the workflow). discuss-phase.md is net -11 (condensed); auto.md shrank -4650 (removed a dead MAX_PASSES resolver shim)."
},
"autonomous.md": {
"reason": "#2800 — the hand-enumerated reviewer-flag list is replaced by a loop over `gsd_run review-lane flags`, and the whole CONVERGENCE_ARGS construction is relocated below the runtime-launcher preamble because it now calls gsd_run and each bash fence is its own shell. Growth is the explanatory comments carrying that constraint plus the loop body, against nine deleted flag literals. Deliberate: the byte delta is the cost of the flags no longer being hand-maintained in three places that had drifted apart."
"reason": "#2800 \u2014 the hand-enumerated reviewer-flag list is replaced by a loop over `gsd_run review-lane flags`, and the whole CONVERGENCE_ARGS construction is relocated below the runtime-launcher preamble because it now calls gsd_run and each bash fence is its own shell. Growth is the explanatory comments carrying that constraint plus the loop body, against nine deleted flag literals. Deliberate: the byte delta is the cost of the flags no longer being hand-maintained in three places that had drifted apart."
},
"next.md": {
"reason": "#2800 — same derived-flag-loop change as autonomous.md. next.md needed no relocation (its launcher preamble already precedes the loop), so the growth here is only the loop plus the comment recording that --all and --text stay literal because they are convergence controls, not reviewer lanes."
"reason": "#2800 \u2014 same derived-flag-loop change as autonomous.md. next.md needed no relocation (its launcher preamble already precedes the loop), so the growth here is only the loop plus the comment recording that --all and --text stay literal because they are convergence controls, not reviewer lanes."
},
"code-review.md": {
"reason": "#2667: the fallow structural pre-pass failure WARNING now names the failure KIND (timeout / spawn failure / crash / not-found) via a case statement, so a Windows .cmd spawn failure (CVE-2024-27980) is not mistaken for an absent binary. Growth is the case statement + the explanatory prose."
"agents/gsd-advisor-researcher.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-ai-researcher.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-assumptions-analyzer.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-code-fixer.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-code-reviewer.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-codebase-mapper.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-debug-session-manager.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-debugger.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-doc-classifier.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-doc-synthesizer.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-doc-verifier.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-doc-writer.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-domain-researcher.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-eval-auditor.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-eval-planner.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-executor.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-framework-selector.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-integration-checker.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-intel-updater.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-mempalace-curator.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-nyquist-auditor.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-pattern-mapper.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-phase-researcher.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-plan-checker.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-planner.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-project-researcher.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-research-synthesizer.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-roadmapper.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-security-auditor.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-ui-auditor.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-ui-checker.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-ui-researcher.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-user-profiler.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
},
"agents/gsd-verifier.toml": {
"reason": "#2834: Codex agent TOML now carries model-routing fields on first install."
}
}
}
}

View File

@@ -0,0 +1,43 @@
// allow-test-rule: structural-implementation-guard (#2834)
'use strict';
// Regression guard for #2834: on a clean Codex install, agent TOMLs contained no
// model-routing fields because defaults.json (resolve_model_ids + runtime) was written
// AFTER installCodexConfig generated the TOMLs. The fix extracts writeNonClaudeDefaults
// and calls it BEFORE installCodexConfig. This test asserts the ordering invariant in
// the install source so a future edit can't silently re-introduce the gap.
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const INSTALL_JS = path.join(__dirname, '..', 'bin', 'install.js');
test('writeNonClaudeDefaults is called before installCodexConfig in the Codex install flow (#2834)', () => {
const src = fs.readFileSync(INSTALL_JS, 'utf8');
// Find the call to writeNonClaudeDefaults that precedes installCodexConfig.
const writeIdx = src.indexOf('writeNonClaudeDefaults(runtime);');
assert.ok(writeIdx !== -1, 'writeNonClaudeDefaults(runtime) must be called in the install flow');
// Find the FIRST installCodexConfig call AFTER the writeNonClaudeDefaults call.
const codexGenIdx = src.indexOf('installCodexConfig(targetDir', writeIdx);
assert.ok(codexGenIdx !== -1 && codexGenIdx > writeIdx,
'installCodexConfig must be called AFTER writeNonClaudeDefaults so defaults.json ' +
'(resolve_model_ids + runtime) exists before agent TOML generation reads it (#2834)');
// The #2834 comment must be present at the call site.
const callSite = src.slice(writeIdx - 300, writeIdx + 100);
assert.ok(/#2834/.test(callSite), 'the writeNonClaudeDefaults call must carry the #2834 rationale comment');
});
test('writeNonClaudeDefaults function exists and is a no-op for Claude (#2834)', () => {
const src = fs.readFileSync(INSTALL_JS, 'utf8');
const fnIdx = src.indexOf('function writeNonClaudeDefaults(');
assert.ok(fnIdx !== -1, 'writeNonClaudeDefaults must be defined as a function');
const fnBody = src.slice(fnIdx, fnIdx + 1200);
assert.ok(/nativeModelAliases/.test(fnBody), 'writeNonClaudeDefaults must early-return for Claude (nativeModelAliases check)');
assert.ok(/resolve_model_ids/.test(fnBody), 'writeNonClaudeDefaults must write resolve_model_ids');
assert.ok(/defaults\.runtime/.test(fnBody), 'writeNonClaudeDefaults must write runtime');
});