Files
gstack/test/helpers/tool-map.ts
T
Garry TanandClaude Fable 5 a9ca914f43 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>
2026-08-16 10:59:34 -07:00

83 lines
2.3 KiB
TypeScript

/**
* Tool compatibility map across provider CLIs.
*
* Not all provider CLIs expose equivalent tools. A benchmark that uses Edit, Glob,
* or Grep won't run cleanly on CLIs that don't have those. The map answers:
* "which tools does each provider's CLI expose by default?"
*
* When a benchmark is scoped to a tool a provider lacks, the harness records
* `unsupported_tool` in the result and continues with the other providers.
*
* Source-of-truth references:
* - Claude Code: https://code.claude.com/docs/en/tools
* - Codex CLI: `codex exec --help` tool listing
* - Gemini CLI: `gemini --help` (limited tool surface as of 2026-04)
*/
export type ToolName =
| 'Read'
| 'Write'
| 'Edit'
| 'Bash'
| 'Agent'
| 'Glob'
| 'Grep'
| 'AskUserQuestion'
| 'WebSearch'
| 'WebFetch';
export const TOOL_COMPATIBILITY: Record<'claude' | 'gpt' | 'gemini', Record<ToolName, boolean>> = {
claude: {
Read: true,
Write: true,
Edit: true,
Bash: true,
Agent: true,
Glob: true,
Grep: true,
AskUserQuestion: true,
WebSearch: true,
WebFetch: true,
},
gpt: {
// Codex CLI has a narrower tool surface: it uses shell + apply_patch.
// Read/Glob/Grep-style operations happen via shell pipelines.
Read: true,
Write: false, // apply_patch handles writes; no standalone Write tool
Edit: false, // apply_patch handles edits; no standalone Edit tool
Bash: true,
Agent: false,
Glob: false,
Grep: false,
AskUserQuestion: false,
WebSearch: true, // -c 'web_search="cached"' (CODEX_WEB_SEARCH_FLAG, #2525)
WebFetch: false,
},
gemini: {
// Gemini CLI (as of 2026-04) has a limited tool surface in --yolo mode.
// Shell access depends on flags; most agentic tools are not exposed.
Read: true,
Write: false,
Edit: false,
Bash: false,
Agent: false,
Glob: false,
Grep: false,
AskUserQuestion: false,
WebSearch: true,
WebFetch: false,
},
};
/**
* Determine which tools from a required-set are missing for a given provider.
* Empty array means full compatibility.
*/
export function missingTools(
provider: 'claude' | 'gpt' | 'gemini',
requiredTools: ToolName[]
): ToolName[] {
const map = TOOL_COMPATIBILITY[provider];
return requiredTools.filter(t => !map[t]);
}