Fix fall-through bug, mismatched message IDs, and hardcoded model string

- Add default case to inner switch in APPLY_CORE_DELTA to prevent
  fall-through to SYNC_PROJECTS when delta.kind is unrecognized
- Share a single crypto.randomUUID() between PUSH_USER_MESSAGE dispatch
  and AppendUserMessage server command to keep IDs consistent
- Replace hardcoded "gpt-5" with DEFAULT_MODEL constant in projectsAdd handler
This commit is contained in:
Cursor Agent committed 2026-02-22 01:17:15 +00:00
1 parent 4ce3c3bf8a
commit 38db5d59ec
3 files changed
+7 -3

No files matched your search

+2 -1
View File
@@ -19,6 +19,7 @@ import {
type WsRequest,
type WsResponse,
wsRequestSchema,
DEFAULT_MODEL,
} from "@t3tools/contracts";
import { WebSocketServer, type WebSocket } from "ws";
@@ -379,7 +380,7 @@ export function createServer(options: ServerOptions) {
id: result.project.id,
name: result.project.name,
cwd: result.project.cwd,
model: "gpt-5",
model: DEFAULT_MODEL,
},
},
};
+3 -2
View File
@@ -1769,10 +1769,11 @@ export default function ChatView({ threadId }: ChatViewProps) {
sizeBytes: image.sizeBytes,
previewUrl: image.previewUrl,
}));
const messageId = crypto.randomUUID();
dispatch({
type: "PUSH_USER_MESSAGE",
threadId: activeThread.id,
id: crypto.randomUUID(),
id: messageId,
text: trimmed,
...(messageAttachments.length > 0 ? { attachments: messageAttachments } : {}),
});
@@ -1783,7 +1784,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
issuedAt: new Date().toISOString(),
payload: {
threadId: activeThread.id,
messageId: crypto.randomUUID(),
messageId,
text: trimmed,
createdAt: new Date().toISOString(),
},
+2
View File
@@ -513,6 +513,8 @@ export function reducer(state: AppState, action: Action): AppState {
}
case "gitStatusUpsert":
return state;
default:
return state;
}
}