Files
multica/packages
Jiayuan 61684767c0 fix(agents): drop duplicate template thinking_level on runtime fallback (MUL-3772)
Remaining blocker on #4638: in duplicate mode the dialog initialized
`thinkingLevel` from the template even when the template runtime was
locked/missing and it fell back to a different-provider runtime. The
provider-change effect skips the initial establishment (to preserve genuine
pre-fill) and the catalog-based clear can't run when the fallback runtime is
offline / its catalog hasn't resolved, so the stale per-provider token could
be submitted and 400 (e.g. a Claude `max` on an offline Codex fallback).

Fix: only clone the template's `thinking_level` when the clone actually lands
on the template's own runtime — the same usability condition that governs the
runtime pre-fill, now factored into a shared `landsOnTemplateRuntime` helper.
On fallback to any other runtime the level starts blank, so it can never be
carried over regardless of provider, online state, or catalog timing.

Tests: locked template runtime → offline different-provider fallback drops the
level and omits it from the payload; landing on the template runtime (offline,
same provider) still preserves it.

Co-authored-by: multica-agent <github@multica.ai>
2026-06-27 02:54:27 +08:00
..