fix(ext): workspaceUri 누락 + WS-only 전송 + user msg dedup

This commit is contained in:
Variet Worker
2026-03-17 10:38:45 +09:00
parent 96e9b8adce
commit 9523d1328e
2 changed files with 41 additions and 12 deletions

View File

@@ -103,7 +103,7 @@ const recentDiscordSentTexts: Map<string, number> = new Map();
function writeChatSnapshot(text: string) {
try {
// WS route (preferred)
// WS route (preferred) — skip file write to prevent duplicate Discord delivery
if (wsBridge && wsBridge.isConnected()) {
wsBridge.sendChat({
content: text,
@@ -111,8 +111,10 @@ function writeChatSnapshot(text: string) {
project_name: projectName,
});
logToFile(`[SNAPSHOT-WS] sent (${text.length} chars)`);
if (activeSessionId) { writeRegistration(activeSessionId); }
return;
}
// File route (fallback / Phase 0 dual-write)
// File route (fallback — only when WS is NOT connected)
const snapshotDir = path.join(bridgePath, 'chat_snapshots');
if (!fs.existsSync(snapshotDir)) { fs.mkdirSync(snapshotDir, { recursive: true }); }
const id = Date.now().toString();
@@ -136,7 +138,7 @@ function writeChatSnapshot(text: string) {
function writeChatSnapshotWithFiles(text: string, files: Array<{name: string, content: string}>) {
try {
// WS route (preferred)
// WS route (preferred) — skip file write to prevent duplicate Discord delivery
if (wsBridge && wsBridge.isConnected()) {
wsBridge.sendChat({
content: text,
@@ -145,8 +147,10 @@ function writeChatSnapshotWithFiles(text: string, files: Array<{name: string, co
project_name: projectName,
});
logToFile(`[SNAPSHOT-WS] sent with ${files.length} files (${text.length} chars)`);
if (activeSessionId) { writeRegistration(activeSessionId); }
return;
}
// File route (fallback)
// File route (fallback — only when WS is NOT connected)
const snapshotDir = path.join(bridgePath, 'chat_snapshots');
if (!fs.existsSync(snapshotDir)) { fs.mkdirSync(snapshotDir, { recursive: true }); }
const id = Date.now().toString();
@@ -1141,6 +1145,8 @@ export async function activate(context: vscode.ExtensionContext) {
lastPendingStepIndex,
stallProbed,
sawRunningAfterPending,
clickTrigger,
logToFile,
workspaceUri,
diffReviewMetadata: new Map(),
recentDiscordSentTexts,