summaryrefslogtreecommitdiffhomepage
path: root/src/adapters
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-08-26 00:08:40 +0900
committerAdam Malczewski <[email protected]>2026-08-26 00:08:40 +0900
commit33c7245f18346553f660434bc3ac589cff3e80c2 (patch)
tree202002771681259446ed95506b4fbb6adece2fd8 /src/adapters
parent4e56e548872a162129efee1b09987af7893b0e0c (diff)
downloaddispatch-web-33c7245f18346553f660434bc3ac589cff3e80c2.tar.gz
dispatch-web-33c7245f18346553f660434bc3ac589cff3e80c2.zip
fix(tabs): stamp tabs with the conversation's persisted model (conv.model), not activeModel
Diffstat (limited to 'src/adapters')
-rw-r--r--src/adapters/ws/logic.test.ts32
-rw-r--r--src/adapters/ws/logic.ts5
2 files changed, 37 insertions, 0 deletions
diff --git a/src/adapters/ws/logic.test.ts b/src/adapters/ws/logic.test.ts
index dd2b773..43cf8ff 100644
--- a/src/adapters/ws/logic.test.ts
+++ b/src/adapters/ws/logic.test.ts
@@ -232,6 +232,38 @@ describe("parseServerMessage", () => {
});
});
+ it("parses a conversation.open message with a persisted model", () => {
+ const data = JSON.stringify({
+ type: "conversation.open",
+ conversationId: "c1",
+ workspaceId: "w1",
+ model: "openrouter/stealth/ox-alpha",
+ });
+ const result = parseServerMessage(data);
+ expect(result).toEqual({
+ type: "conversation.open",
+ conversationId: "c1",
+ workspaceId: "w1",
+ model: "openrouter/stealth/ox-alpha",
+ });
+ });
+
+ it("omits the model when conversation.open carries a non-string/empty model", () => {
+ const result = parseServerMessage(
+ JSON.stringify({
+ type: "conversation.open",
+ conversationId: "c1",
+ workspaceId: "w1",
+ model: 42,
+ }),
+ );
+ expect(result).toEqual({
+ type: "conversation.open",
+ conversationId: "c1",
+ workspaceId: "w1",
+ });
+ });
+
it("returns null for conversation.open with missing conversationId", () => {
expect(
parseServerMessage(JSON.stringify({ type: "conversation.open", workspaceId: "w1" })),
diff --git a/src/adapters/ws/logic.ts b/src/adapters/ws/logic.ts
index 03ef763..72a6338 100644
--- a/src/adapters/ws/logic.ts
+++ b/src/adapters/ws/logic.ts
@@ -116,10 +116,15 @@ export function parseServerMessage(data: string): WsServerMessage | null {
case "conversation.open": {
if (typeof parsed.conversationId !== "string") return null;
if (typeof parsed.workspaceId !== "string") return null;
+ // Forward the persisted per-conversation model when the backend includes
+ // it, so a client can stamp the opened tab with the conversation's ACTUAL
+ // model (fix-toolcall-duplicate-keys plan Part 4).
+ const model = parsed.model;
const msg: ConversationOpenMessage = {
type: "conversation.open",
conversationId: parsed.conversationId,
workspaceId: parsed.workspaceId,
+ ...(typeof model === "string" && model.length > 0 ? { model } : {}),
};
return msg;
}