Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/chat/toolChains/getPrepareStepResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const getPrepareStepResult = (options: PrepareStepOptions): PrepareStepResult |
result.messages = options.messages.concat(nextToolItem.messages);
}

// Add model if specified for this tool
const model = TOOL_MODEL_MAP[nextToolItem.toolName];
if (model) {
result.model = model;
Expand Down
20 changes: 17 additions & 3 deletions lib/chat/toolChains/toolChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,25 @@ export type PrepareStepResult = {
messages?: ModelMessage[];
};

// Map specific tools to their required models
// Forced toolChoice is incompatible with Anthropic extended thinking.
// Every tool used in a chain must have a model here to avoid the conflict.
export const TOOL_MODEL_MAP: Record<string, LanguageModel> = {
update_account_info: "gemini-2.5-pro",
// Add other tools that need specific models here
// e.g., create_segments: "gpt-4-turbo",
get_spotify_search: "openai/gpt-5.4-mini",
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Custom agent: Flag AI Slop and Fabricated Changes

15 map entries hardcoded to the same "openai/gpt-5.4-mini" value replace the removed TOOL_CHAIN_FALLBACK_MODEL default. This is duplicated configuration that's fragile: any new tool added to a chain without a map entry here silently regresses to the original crash (the consumer in getPrepareStepResult.ts only sets the model if (model) — there is no fallback).

Restore a default/fallback constant and keep TOOL_MODEL_MAP only for overrides (like update_account_info → gemini-2.5-pro).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/chat/toolChains/toolChains.ts, line 22:

<comment>15 map entries hardcoded to the same `"openai/gpt-5.4-mini"` value replace the removed `TOOL_CHAIN_FALLBACK_MODEL` default. This is duplicated configuration that's fragile: any new tool added to a chain without a map entry here silently regresses to the original crash (the consumer in `getPrepareStepResult.ts` only sets the model `if (model)` — there is no fallback).

Restore a default/fallback constant and keep `TOOL_MODEL_MAP` only for overrides (like `update_account_info → gemini-2.5-pro`).</comment>

<file context>
@@ -16,12 +16,24 @@ export type PrepareStepResult = {
+// Every tool used in a chain must have a model here to avoid the conflict.
 export const TOOL_MODEL_MAP: Record<string, LanguageModel> = {
   update_account_info: "gemini-2.5-pro",
+  get_spotify_search: "openai/gpt-5.4-mini",
+  update_artist_socials: "openai/gpt-5.4-mini",
+  artist_deep_research: "openai/gpt-5.4-mini",
</file context>
Fix with Cubic

update_artist_socials: "openai/gpt-5.4-mini",
artist_deep_research: "openai/gpt-5.4-mini",
spotify_deep_research: "openai/gpt-5.4-mini",
get_artist_socials: "openai/gpt-5.4-mini",
get_spotify_artist_top_tracks: "openai/gpt-5.4-mini",
get_spotify_artist_albums: "openai/gpt-5.4-mini",
get_spotify_album: "openai/gpt-5.4-mini",
search_web: "openai/gpt-5.4-mini",
generate_txt_file: "openai/gpt-5.4-mini",
create_segments: "openai/gpt-5.4-mini",
youtube_login: "openai/gpt-5.4-mini",
web_deep_research: "openai/gpt-5.4-mini",
create_knowledge_base: "openai/gpt-5.4-mini",
send_email: "openai/gpt-5.4-mini",
};

// Map trigger tool -> sequence AFTER trigger
Expand Down
Loading