fix(chatcore): restore missing mergeResponseToolNameMap import

Genuine pre-existing bug on upstream release/v3.8.50 (verified byte-
identical to their tip, not introduced by this branch's merge): chatCore.ts
calls mergeResponseToolNameMap() but never imports it from
./chatCore/passthroughToolNames.ts, throwing a ReferenceError on every
request that reaches that line (surfaced by
agentrouter-chatcore-protocols.test.ts's 3 streaming-protocol cases).

Also renumbers this branch's own migrations from 137/138 back to a
contiguous 136/137 — the earlier 135->137 renumber (done to resolve this
branch's collision with upstream's independently-added
135_migrate_model_capability_max_token.sql) skipped 136 entirely, leaving
an unexplained sequence gap that check-migration-numbering.test.ts's real-
migrations-dir check correctly flagged.
This commit is contained in:
Markus Hartung
2026-08-06 07:29:44 +02:00
parent 58f36a3484
commit 81646aaf04
4 changed files with 7 additions and 6 deletions

View File

@@ -223,6 +223,7 @@ import { recordCost } from "@/domain/costRules";
import { calculateCost } from "@/lib/usage/costCalculator";
import {
buildClaudePassthroughToolNameMap,
mergeResponseToolNameMap,
normalizeOpenAIToolFinishReasons,
restoreNonStreamingToolNames,
} from "./chatCore/passthroughToolNames.ts";

View File

@@ -7,7 +7,7 @@
*
* `last_message_count`/`last_messages_hash` on `agentic_conversations` are
* dead columns kept only for backward on-disk compatibility (superseded by
* `conversation_turn_nodes`, migration 138) — never read, written as
* `conversation_turn_nodes`, migration 137) — never read, written as
* placeholders.
*/
@@ -51,7 +51,7 @@ export function createAgenticConversation(input: {
const id = input.id || `conv_${uuidv4()}`;
// last_message_count/last_messages_hash are dead columns (superseded by
// conversation_turn_nodes, migration 138) — 0/'' placeholders only.
// conversation_turn_nodes, migration 137) — 0/'' placeholders only.
db.prepare(
`INSERT INTO agentic_conversations
(id, api_key_id, fingerprint_hash, last_message_count, last_messages_hash, turn_count, first_seen_at, last_seen_at)
@@ -89,7 +89,7 @@ export function updateAgenticConversation(id: string, patch: { turnCount: number
);
}
// ── Turn-node tree (migration 138) ───────────────────────────────────────
// ── Turn-node tree (migration 137) ───────────────────────────────────────
export interface ConversationTurnNode {
id: string;

View File

@@ -1,4 +1,4 @@
-- 137_agentic_conversations.sql
-- 136_agentic_conversations.sql
-- Stable multi-turn conversation tracking for /v1/chat/completions and
-- /v1/responses. Clients resend the full growing message/input history on
-- every turn; this table lets us detect "request N's history is request

View File

@@ -1,4 +1,4 @@
-- 138_conversation_turn_nodes.sql
-- 137_conversation_turn_nodes.sql
-- Per-turn hash-chain nodes backing a conversation's linear transcript
-- (open-sse/services/conversationTracker.ts). Each row is one distinct
-- turn instance, chained to its predecessor the same way a git commit
@@ -9,7 +9,7 @@
-- duplicates a turn mid-history to keep provider-side prompt caches warm)
-- becomes its OWN independent conversation instead (2026-08-06 — every
-- OmniRoute conversation is a single straight line, it never forks; see
-- resolveConversationId's doc comment). See agentic_conversations (137) for
-- resolveConversationId's doc comment). See agentic_conversations (136) for
-- the conversation-root record; its last_message_count/last_messages_hash
-- columns are superseded by this table and no longer written to.
--