fix(grok): carry reasoning effort for models outside the seed catalog (#13365)

Launch resolves options from the static seed, so a discovered model id had no
options and silently dropped --reasoning-effort. unknownModelOptions keeps the
effort menu for those ids. Leave the multi-host launch gate unchanged.
This commit is contained in:
Jinjing 2026-08-09 12:31:47 -07:00
parent e172a51649
commit e77dab7910
2 changed files with 41 additions and 0 deletions

View File

@ -45,6 +45,10 @@ describe('grok session option catalog', () => {
}
})
it('gives unknown model ids the same effort menu launch reads from the seed', () => {
expect(GROK_SESSION_OPTION_CATALOG.unknownModelOptions?.map(({ id }) => id)).toEqual(['effort'])
})
it('treats a successful discovery as authoritative, unlike the other agents', () => {
expect(GROK_SESSION_OPTION_CATALOG.discoveredModelsAreAuthoritative).toBe(true)
for (const agent of ['claude', 'codex', 'gemini', 'cursor'] as const) {
@ -88,6 +92,39 @@ describe('grok launch args', () => {
})
})
it('carries a picked effort onto a discovered model the seed never listed', () => {
// Regression: launch reads options off the static seed, so a discovered id
// resolved to no options and dropped `--reasoning-effort` from the argv.
expect(resolveAgentSessionOptionLaunch('grok', { model: 'grok-build', effort: 'low' })).toEqual(
{
args: ['-m', 'grok-build', '--reasoning-effort', 'low'],
appliedValues: { model: 'grok-build', effort: 'low' }
}
)
})
it('drops an effort value the menu does not offer on an unseeded model', () => {
expect(
resolveAgentSessionOptionLaunch('grok', { model: 'grok-build', effort: 'none' })
).toEqual({ args: ['-m', 'grok-build'], appliedValues: { model: 'grok-build' } })
})
it('honors a user effort flag over the picker on an unseeded model too', () => {
expect(
resolveAgentSessionOptionLaunch('grok', { model: 'grok-build', effort: 'low' }, [
'--reasoning-effort=high'
]).appliedValues
).toEqual({ model: 'grok-build' })
})
it('still adds no effort default for a model the seed does not carry', () => {
// An unseeded id has no verified menu, so only an explicit pick may reach argv.
expect(resolveAgentSessionOptionLaunch('grok', { model: 'grok-build' }).args).toEqual([
'-m',
'grok-build'
])
})
it('spawns vanilla when no model was ever picked', () => {
expect(resolveAgentSessionOptionLaunch('grok', undefined)).toEqual({
args: [],

View File

@ -55,6 +55,10 @@ export const GROK_SESSION_OPTION_CATALOG: AgentSessionOptionCatalog = {
// agent picker…" and never persist a model, so `-m` would never be emitted.
midSession: { kind: 'command', build: (value) => `/model ${String(value)}` }
},
// Why: `--reasoning-effort` is a global grok flag, not a per-model capability, and
// launch resolves against this static seed. Without this, a discovered id the seed
// does not carry shows the effort menu but launches with the flag dropped.
unknownModelOptions: [GROK_EFFORT],
// Why: grok's selectable ids retire between releases, so a stale seed entry
// must be droppable — picking one is a fatal launch, not a warning.
discoveredModelsAreAuthoritative: true,