testdriverai 7.9.0-test.45 → 7.9.0-test.47
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/agent/lib/sandbox.js +12 -0
- package/package.json +1 -1
- package/vitest.config.mjs +1 -1
package/agent/lib/sandbox.js
CHANGED
|
@@ -547,6 +547,8 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
547
547
|
timeout,
|
|
548
548
|
);
|
|
549
549
|
|
|
550
|
+
logger.debug(`[sandbox] authenticate response: success=${reply.success} status=${reply.status || 'none'} sandboxId=${reply.sandboxId || 'none'}`);
|
|
551
|
+
|
|
550
552
|
if (!reply.success) {
|
|
551
553
|
var err = new Error(
|
|
552
554
|
reply.errorMessage || "Failed to allocate sandbox",
|
|
@@ -559,6 +561,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
559
561
|
this._teamId = reply.teamId;
|
|
560
562
|
|
|
561
563
|
if (reply.ably && reply.ably.token) {
|
|
564
|
+
logger.debug(`[sandbox] Initializing Ably with channel=${reply.ably.channel}, membersChannel=${reply.ably.membersChannel || '(derived)'}`);
|
|
562
565
|
await this._initAbly(reply.ably.token, reply.ably.channel, reply.ably.membersChannel);
|
|
563
566
|
this.instanceSocketConnected = true;
|
|
564
567
|
|
|
@@ -584,6 +587,7 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
584
587
|
var slotPollStart = Date.now();
|
|
585
588
|
while (reply.status === 'pending') {
|
|
586
589
|
logger.log('Slot claim pending — waiting for approval via Ably...');
|
|
590
|
+
logger.debug(`[slots] sandboxId=${this._sandboxId} channel=${this._channelName} membersChannel=${this._membersChannelName}`);
|
|
587
591
|
|
|
588
592
|
var self = this;
|
|
589
593
|
var slotResolved = false;
|
|
@@ -624,24 +628,32 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
624
628
|
// The claim-slot task fires in response to presence enter, so the
|
|
625
629
|
// decision may already be published by the time we get here.
|
|
626
630
|
var slotControlSub = await self._sessionChannel.subscribe('control', onSlotControl);
|
|
631
|
+
logger.debug(`[slots] Subscribed to control channel for slot decision (sandboxId=${this._sandboxId})`);
|
|
627
632
|
|
|
628
633
|
// Check for decisions published before this subscription was active
|
|
629
634
|
if (!slotResolved && slotControlSub) {
|
|
630
635
|
try {
|
|
636
|
+
logger.debug(`[slots] Checking history for pre-subscription slot decisions (sandboxId=${this._sandboxId})`);
|
|
637
|
+
logger.debug(`[slots] Checking history for pre-subscription slot decisions (sandboxId=${this._sandboxId})`);
|
|
631
638
|
var histPage = await slotControlSub.historyBeforeSubscribe({ limit: 10 });
|
|
639
|
+
var histItemCount = 0;
|
|
632
640
|
while (histPage && !slotResolved) {
|
|
633
641
|
for (var hi = 0; hi < histPage.items.length; hi++) {
|
|
642
|
+
histItemCount++;
|
|
643
|
+
logger.debug(`[slots] History item: type=${histPage.items[hi].data && histPage.items[hi].data.type} (sandboxId=${this._sandboxId})`);
|
|
634
644
|
onSlotControl(histPage.items[hi]);
|
|
635
645
|
if (slotResolved) break;
|
|
636
646
|
}
|
|
637
647
|
histPage = (!slotResolved && histPage.hasNext()) ? await histPage.next() : null;
|
|
638
648
|
}
|
|
649
|
+
logger.debug(`[slots] History check done: ${histItemCount} items checked, resolved=${slotResolved} (sandboxId=${this._sandboxId})`);
|
|
639
650
|
} catch (histErr) {
|
|
640
651
|
logger.warn('[slots] Failed to check history for slot decision: ' + (histErr.message || histErr));
|
|
641
652
|
}
|
|
642
653
|
}
|
|
643
654
|
|
|
644
655
|
var slotDecision = await slotDecisionPromise;
|
|
656
|
+
logger.debug(`[slots] Slot decision received: approved=${slotDecision.approved} sandboxId=${this._sandboxId} elapsedMs=${Date.now() - slotPollStart}`);
|
|
645
657
|
|
|
646
658
|
if (!slotDecision.approved) {
|
|
647
659
|
// Slot denied — disconnect Ably and re-try the full authenticate
|
package/package.json
CHANGED