Skip to content

Commit 5d0e267

Browse files
committed
Remove legacy backward compatibility code and version checks for websocket clients
- remove logic targeting older version
1 parent 77be01d commit 5d0e267

2 files changed

Lines changed: 8 additions & 31 deletions

File tree

‎apps/editor/src/services/websocket-manager.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,7 @@ export class WebSocketManager {
204204
this.connected_browsers = message.connected_browsers
205205
this.has_connected_browsers = this.connected_browsers.length > 0
206206
this._on_connection_status_change.fire(this.has_connected_browsers)
207-
} else if (
208-
message.action == 'apply-response' ||
209-
(message.action as any) == 'apply-chat-response' // Backward compatibility 20.07.26
210-
) {
207+
} else if (message.action == 'apply-response') {
211208
const apply_msg = message as ApplyResponseMessage
212209
vscode.commands.executeCommand('codeWebChat.applyResponse', {
213210
raw_instructions: apply_msg.raw_instructions,
@@ -462,7 +459,7 @@ export class WebSocketManager {
462459
reasoning_effort: web_configuration.reasoningEffort,
463460
system_instructions: web_configuration.systemInstructions,
464461
options: web_configuration.options,
465-
client_id: this.client_id || 0, // 0 is a temporary fallback and should be removed few weeks from 28.03.25
462+
client_id: this.client_id!,
466463
raw_instructions: params.raw_instructions,
467464
inject_apply_response_button: params.inject_apply_response_button
468465
}
@@ -564,7 +561,7 @@ export class WebSocketManager {
564561
reasoning_effort: params.web_configuration.reasoning_effort,
565562
system_instructions: params.web_configuration.system_instructions,
566563
options: params.web_configuration.options,
567-
client_id: this.client_id || 0, // 0 is a temporary fallback and should be removed few weeks from 28.03.25
564+
client_id: this.client_id!,
568565
raw_instructions: params.raw_instructions,
569566
inject_apply_response_button: params.inject_apply_response_button
570567
}

‎apps/editor/src/services/websocket-server-process.ts‎

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@ const WebSocket = require('ws')
55

66
import { DEFAULT_PORT, SECURITY_TOKENS } from '@shared/constants/websocket'
77

8-
const is_version_gte = (v: string, target: string) => {
9-
if (v === 'unknown') return false
10-
const vParts = v.split('.').map(Number)
11-
const tParts = target.split('.').map(Number)
12-
for (let i = 0; i < Math.max(vParts.length, tParts.length); i++) {
13-
const p1 = vParts[i] || 0
14-
const p2 = tParts[i] || 0
15-
if (p1 > p2) return true
16-
if (p1 < p2) return false
17-
}
18-
return true
19-
}
20-
218
interface BrowserClient {
229
ws: WebSocket
2310
version: string
@@ -200,10 +187,7 @@ class WebSocketServer {
200187
}
201188
}
202189
}
203-
} else if (
204-
msg_data.action == 'apply-response' ||
205-
msg_data.action == 'apply-chat-response' // Backward compatibility 20.07.26
206-
) {
190+
} else if (msg_data.action == 'apply-response') {
207191
const target_client_id = msg_data.client_id
208192
const target_client = this.vscode_clients.get(target_client_id)
209193
if (target_client && target_client.ws.readyState == WebSocket.OPEN) {
@@ -277,15 +261,11 @@ class WebSocketServer {
277261
const ping_message = JSON.stringify({ action: 'ping' })
278262

279263
for (const client of this.browser_clients.values()) {
280-
const expects_pong = is_version_gte(client.version, '2026.7.2')
281-
282-
if (expects_pong) {
283-
if (!client.is_alive) {
284-
;(client.ws as any).terminate()
285-
continue
286-
}
287-
client.is_alive = false
264+
if (!client.is_alive) {
265+
;(client.ws as any).terminate()
266+
continue
288267
}
268+
client.is_alive = false
289269
if (client.ws.readyState === WebSocket.OPEN) {
290270
client.ws.send(ping_message)
291271
}

0 commit comments

Comments
 (0)