fix(extension): resolve 10-item limit truncation & WS zombie disconnection (v0.5.14)

This commit is contained in:
Variet Worker
2026-04-01 18:21:51 +09:00
parent 2d5059d2d5
commit 13f13ee243
10 changed files with 147 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
"name": "gravity-bridge",
"displayName": "Gravity Bridge",
"description": "Antigravity ↔ Discord 브리지 연동 확장",
"version": "0.5.11",
"version": "0.5.14",
"publisher": "variet",
"engines": {
"vscode": "^1.100.0"

View File

@@ -178,7 +178,8 @@ function setupMonitor() {
ctx.logToFile(`[POLL#${pollCount}] alive`);
}
try {
const allTraj = await ctx.sdk.ls.rawRPC('GetAllCascadeTrajectories', {});
// Fix (v0.5.14): Reverted 100-limit DoS but restored descending: true with a safe limit of 30
const allTraj = await ctx.sdk.ls.rawRPC('GetAllCascadeTrajectories', { limit: 30, descending: true });
if (!allTraj?.trajectorySummaries) {
if (pollCount <= 3) ctx.logToFile('[POLL] no trajectorySummaries');
return;

View File

@@ -124,6 +124,7 @@ export class WSBridgeClient {
private heartbeatTimer: NodeJS.Timeout | null = null;
private authTimer: NodeJS.Timeout | null = null;
private lastPongTime: number = 0;
private forceHeartbeatTimeoutIfNoPong = false;
// Message queue (survives reconnection)
private messageQueue: WSMessage[] = [];
@@ -440,6 +441,14 @@ export class WSBridgeClient {
break;
}
case 'pong': {
// Sent by Hub in response to our 'heartbeat' JSON message
// This is crucial for Browser-style WebSockets that don't expose native ping/pong
this.forceHeartbeatTimeoutIfNoPong = true;
this.lastPongTime = Date.now();
break;
}
default:
this.logFn(`[WS] Unknown message type: ${msg.type}`);
}
@@ -498,7 +507,8 @@ export class WSBridgeClient {
this.heartbeatTimer = setInterval(() => {
if (this.ws && this.connected) {
// Check for zombie connection (no pong for 60s)
if (Date.now() - this.lastPongTime > 60000) {
const isNodeWs = (typeof this.ws.ping === 'function');
if ((isNodeWs || this.forceHeartbeatTimeoutIfNoPong) && Date.now() - this.lastPongTime > 60000) {
this.logFn('[WS] Heartbeat timeout — no pong received for 60s (zombie connection), terminating');
if (this.ws) {
try { this.ws.terminate(); } catch { try { this.ws.close(); } catch { } }