testdriverai 7.3.26 → 7.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/agent/index.js +6 -3
- package/agent/lib/sandbox.js +36 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [7.3.28](https://github.com/testdriverai/testdriverai/compare/v7.3.27...v7.3.28) (2026-02-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [7.3.27](https://github.com/testdriverai/testdriverai/compare/v7.3.25...v7.3.27) (2026-02-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
1
9
|
## [7.3.26](https://github.com/testdriverai/testdriverai/compare/v7.3.25...v7.3.26) (2026-02-20)
|
|
2
10
|
|
|
3
11
|
|
package/agent/index.js
CHANGED
|
@@ -1791,10 +1791,13 @@ ${regression}
|
|
|
1791
1791
|
ip: this.ip,
|
|
1792
1792
|
});
|
|
1793
1793
|
|
|
1794
|
-
// Store
|
|
1795
|
-
//
|
|
1794
|
+
// Store connection params for reconnection
|
|
1795
|
+
// For direct IP connections, store as a direct type so reconnection
|
|
1796
|
+
// sends a 'direct' message instead of 'connect' with an IP as sandboxId
|
|
1796
1797
|
this.sandbox._lastConnectParams = {
|
|
1797
|
-
|
|
1798
|
+
type: 'direct',
|
|
1799
|
+
ip: this.ip,
|
|
1800
|
+
sandboxId: instance?.instance?.instanceId || instance?.instance?.sandboxId || null,
|
|
1798
1801
|
persist: true,
|
|
1799
1802
|
keepAlive: this.keepAlive,
|
|
1800
1803
|
};
|
package/agent/lib/sandbox.js
CHANGED
|
@@ -97,8 +97,13 @@ const createSandbox = (emitter, analytics, sessionInstance) => {
|
|
|
97
97
|
|
|
98
98
|
// Add sandboxId to every message if we have a connected sandbox
|
|
99
99
|
// This allows the API to reconnect if the connection was rerouted
|
|
100
|
+
// Don't inject IP addresses as sandboxId — only valid instance/sandbox IDs
|
|
100
101
|
if (this._lastConnectParams?.sandboxId && !message.sandboxId) {
|
|
101
|
-
|
|
102
|
+
const id = this._lastConnectParams.sandboxId;
|
|
103
|
+
// Only inject if it looks like a valid ID (not an IP address)
|
|
104
|
+
if (id && !/^\d+\.\d+\.\d+\.\d+$/.test(id)) {
|
|
105
|
+
message.sandboxId = id;
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
let p = new Promise((resolve, reject) => {
|
|
@@ -215,6 +220,26 @@ const createSandbox = (emitter, analytics, sessionInstance) => {
|
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Reconnect to a direct IP-based sandbox after connection loss.
|
|
225
|
+
* Sends a 'direct' message instead of 'connect' to avoid the API
|
|
226
|
+
* treating the IP as an AWS instance ID.
|
|
227
|
+
*/
|
|
228
|
+
async reconnectDirect(ip) {
|
|
229
|
+
let reply = await this.send({
|
|
230
|
+
type: "direct",
|
|
231
|
+
ip,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
if (reply.success) {
|
|
235
|
+
this.instanceSocketConnected = true;
|
|
236
|
+
emitter.emit(events.sandbox.connected);
|
|
237
|
+
return reply;
|
|
238
|
+
} else {
|
|
239
|
+
throw new Error(reply.errorMessage || "Failed to reconnect to direct sandbox");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
218
243
|
async handleConnectionLoss() {
|
|
219
244
|
if (this.intentionalDisconnect) return;
|
|
220
245
|
|
|
@@ -300,9 +325,16 @@ const createSandbox = (emitter, analytics, sessionInstance) => {
|
|
|
300
325
|
// Without this, the new API instance has no connection.desktop
|
|
301
326
|
// and all Linux operations will fail with "sandbox not initialized"
|
|
302
327
|
if (this._lastConnectParams) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
328
|
+
if (this._lastConnectParams.type === 'direct') {
|
|
329
|
+
// Direct IP connections must reconnect via 'direct' message, not 'connect'
|
|
330
|
+
const { ip, persist, keepAlive } = this._lastConnectParams;
|
|
331
|
+
console.log(`[Sandbox] Re-establishing direct connection (${ip})...`);
|
|
332
|
+
await this.reconnectDirect(ip);
|
|
333
|
+
} else {
|
|
334
|
+
const { sandboxId, persist, keepAlive } = this._lastConnectParams;
|
|
335
|
+
console.log(`[Sandbox] Re-establishing sandbox connection (${sandboxId})...`);
|
|
336
|
+
await this.connect(sandboxId, persist, keepAlive);
|
|
337
|
+
}
|
|
306
338
|
}
|
|
307
339
|
console.log("[Sandbox] Reconnected successfully.");
|
|
308
340
|
|