fix(codex): retire deprecated web-search flag behind one CODEX_WEB_SEARCH_FLAG constant (#2525)

codex >=0.144 deprecates the legacy --enable-based web_search_cached
spelling (web search is on by default; --enable <FEATURE> now means
-c features.<name>=true, verified against codex 0.147.0's exec --help).
Every gstack codex invocation now passes -c 'web_search="cached"' instead.

The flag previously lived inline at 19 raw sites. Per ENG-OV11a the 10
template-inline sites (autoplan/SKILL.md.tmpl x4, codex/SKILL.md.tmpl x6)
convert to a shared {{CODEX_WEB_SEARCH_FLAG}} token first, so ONE resolver
constant (CODEX_WEB_SEARCH_FLAG in scripts/resolvers/constants.ts) now
covers all sites: review.ts x5, design.ts x3, the token resolver in
utility.ts, and the tool-map helper comment.

codex/SKILL.md.tmpl's web-search prose guarantee is corrected: the -c form
explicitly overrides a top-level web_search config (the legacy flag yielded
to it), and native codex review disables web search regardless of
configuration, so the flag is a no-op on the default Review path.

test/codex-web-search-flag.test.ts is the safety net: repo-wide grep
tripwires assert NO rendered SKILL.md/section/golden and NO source file
carries the deprecated spelling, and that the token resolves in rendered
output.

Fixes #2525

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-16 10:59:34 -07:00
co-authored by Claude Fable 5
parent 08bff7ef25
commit a9ca914f43
23 changed files with 154 additions and 51 deletions
+20
View File
@@ -44,6 +44,26 @@ export const OPENAI_LITMUS_CHECKS = [
'Would design feel premium with all decorative shadows removed?',
];
/**
* Web-search flag for every codex invocation (#2525).
*
* codex >=0.144 deprecated the legacy `--enable`-based web_search_cached
* spelling (web search is on by default; the deprecation notice says to set
* `web_search` to "live", "indexed", "cached", or "disabled" at the top
* level), and `--enable <FEATURE>` now means `-c features.<name>=true`
* (verified on 0.147.0), so the legacy spelling is headed for hard
* rejection. This is the ONE source
* of truth: resolvers interpolate it directly and templates reference it via
* the {{CODEX_WEB_SEARCH_FLAG}} token — never write the flag inline.
*
* Semantics note: unlike the legacy flag (which yielded to an existing
* top-level `web_search` in config.toml), the -c form explicitly overrides
* it. Deliberate: gstack wants deterministic cached search for review
* invocations. Native `codex review` disables web search regardless of
* configuration, so on that path the flag is a harmless no-op.
*/
export const CODEX_WEB_SEARCH_FLAG = `-c 'web_search="cached"'`;
/**
* Shared Codex error handling block for resolver output.
* Used by ADVERSARIAL_STEP, CODEX_PLAN_REVIEW, CODEX_SECOND_OPINION,