feat(mitm): add Antigravity reasoning-effort overrides - #7228
diegosouzapw merged 2 commits into
Conversation
The Antigravity MITM alias mapping only ever swapped the destination model;
there was no way to override the reasoning effort Antigravity's own
thinkingConfig requested. Alias entries are now `{ model?, reasoningEffort? }`
(a legacy plain-string mapping still normalizes to `{ model }`, so no DB
migration is required). The standalone proxy (server.cjs) forwards the chosen
tier as a top-level `reasoningEffortOverride` on the intercepted request; the
antigravity->openai translator honors it ahead of its thinkingConfig-derived
guess, and an explicit "none" suppresses reasoning_effort entirely even when
Antigravity's own request asked for thinking. Reuses the existing canonical
5-tier reasoning vocabulary (`@/shared/reasoning/effortStandardization.ts`,
with max/extra aliasing to xhigh) instead of introducing a new one. The API
route validates the reasoning-effort value at the boundary and the Antigravity
tool card UI now exposes a per-model reasoning-effort selector alongside the
existing model-mapping input.
Co-authored-by: Truong Fiu <gnourtf@gmail.com>
Inspired-by: decolua/9router#2584
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Aprovado. Diff grande mas escopo bate 1:1 com o body (i18n é churn mecânico de placeholder MISSING em 44 locais, padrão já usado no projeto). Revert-proof no translator confirma fail-without-fix (2/14 testes caem sem o fix). Validação de segurança OK: Hard Rule #13 (sem interpolação de shell no .cjs) e #7 (Zod + hasInvalidReasoningEffort rejeitando valor de reasoning inválido com 400 na borda da API). Único ponto de atenção não-bloqueante: a duplicação aliasConfig.ts/aliasConfig.cjs é uma dívida arquitetural inerente (server.cjs não pode importar ESM/TS) — os dois têm teste próprio, mas nada garante que fiquem sincronizados se só um for editado no futuro; vale considerar um gerador ou um teste cross-check de paridade entre os dois módulos numa PR futura. Pronto para merge como está. |
…7228) * feat(mitm): add Antigravity reasoning-effort overrides The Antigravity MITM alias mapping only ever swapped the destination model; there was no way to override the reasoning effort Antigravity's own thinkingConfig requested. Alias entries are now `{ model?, reasoningEffort? }` (a legacy plain-string mapping still normalizes to `{ model }`, so no DB migration is required). The standalone proxy (server.cjs) forwards the chosen tier as a top-level `reasoningEffortOverride` on the intercepted request; the antigravity->openai translator honors it ahead of its thinkingConfig-derived guess, and an explicit "none" suppresses reasoning_effort entirely even when Antigravity's own request asked for thinking. Reuses the existing canonical 5-tier reasoning vocabulary (`@/shared/reasoning/effortStandardization.ts`, with max/extra aliasing to xhigh) instead of introducing a new one. The API route validates the reasoning-effort value at the boundary and the Antigravity tool card UI now exposes a per-model reasoning-effort selector alongside the existing model-mapping input. Co-authored-by: Truong Fiu <gnourtf@gmail.com> Inspired-by: decolua/9router#2584 * chore(changelog): fragment for diegosouzapw#7228 --------- Co-authored-by: Truong Fiu <gnourtf@gmail.com>
…7228) * feat(mitm): add Antigravity reasoning-effort overrides The Antigravity MITM alias mapping only ever swapped the destination model; there was no way to override the reasoning effort Antigravity's own thinkingConfig requested. Alias entries are now `{ model?, reasoningEffort? }` (a legacy plain-string mapping still normalizes to `{ model }`, so no DB migration is required). The standalone proxy (server.cjs) forwards the chosen tier as a top-level `reasoningEffortOverride` on the intercepted request; the antigravity->openai translator honors it ahead of its thinkingConfig-derived guess, and an explicit "none" suppresses reasoning_effort entirely even when Antigravity's own request asked for thinking. Reuses the existing canonical 5-tier reasoning vocabulary (`@/shared/reasoning/effortStandardization.ts`, with max/extra aliasing to xhigh) instead of introducing a new one. The API route validates the reasoning-effort value at the boundary and the Antigravity tool card UI now exposes a per-model reasoning-effort selector alongside the existing model-mapping input. Co-authored-by: Truong Fiu <gnourtf@gmail.com> Inspired-by: decolua/9router#2584 * chore(changelog): fragment for diegosouzapw#7228 --------- Co-authored-by: Truong Fiu <gnourtf@gmail.com>
Summary
{ model?, reasoningEffort? }); legacy plain-string mappings still normalize to{ model }with no DB migration required.reasoningEffortOverride; the antigravity→openai translator honors it ahead of itsthinkingConfig-derived guess, and an explicit "none" suppressesreasoning_efforteven when Antigravity's own request asked for thinking.Attribution
Thanks to @trfi for the original implementation.
Changes
src/mitm/aliasConfig.ts(new) +src/mitm/_internal/aliasConfig.cjs(new, CJS mirror for the standalone proxy process): normalize/validate alias entries and reasoning-effort values.src/mitm/server.cjs:getMappedModel→getMappedOverride;intercept()applies the override (model swap +reasoningEffortOverride) via the new shim.open-sse/translator/request/antigravity-to-openai.ts: honor an explicitreasoningEffortOverrideahead of the thinkingConfig-derived tier.src/app/api/cli-tools/antigravity-mitm/alias/route.ts+src/shared/validation/schemas/cli.ts: accept the structured mapping shape, validate reasoning-effort values at the API boundary.src/app/(dashboard)/dashboard/cli-code/components/AntigravityToolCard.tsx: per-model reasoning-effort selector.cliTools.reasoningEffort*keys inen.json+ placeholder entries in all other locales.Test plan
tests/unit/mitm-antigravity-reasoning-effort-override.test.ts(14 cases) andtests/unit/mitm-alias-config-shim.test.ts(6 cases) — confirmed failing against the pre-change translator (override ignored:low !== high,nonedid not suppressreasoning_effort, reasoning-only override was a no-op) and passing after the fix.npm run typecheck:core— clean.npx eslinton all changed files — clean (the one pre-existingAntigravityToolCard.tsxreact-hooks/exhaustive-depswarning was confirmed present on the unmodified base file, not introduced by this change).tests/unit/translator-antigravity-to-openai.test.ts(9 cases) andtests/unit/antigravity-orphan-toolresult-6026.test.ts(3 cases) still pass — no regression.