test(voice): classify current-frame send and cancellation outcomes

Keep viewport and pointer-crop capture unchanged, but expose static reason codes for unavailable frames, invalidated turn captures and retained image sends. No image or user text in diagnostics.
This commit is contained in:
Kevin Rajan committed 2026-10-16 23:37:22 -05:00
1 parent 8c02f5852f
commit 050f68ac03
2 files changed
+75 -2

No files matched your search

+14 -2
View File
@@ -437,15 +437,24 @@ export class RealtimeViewport {
const captured = await captureImage();
const imageUrl =
typeof captured === 'string' ? captured : captured?.dataUrl || null;
if (!imageUrl) {
this.debugLog?.('viewport_context.skipped', {
reason: 'capture-unavailable',
});
return false;
}
if (
!imageUrl ||
generation !== this.generation ||
request !== this.captureSeq ||
this.dc !== channel ||
channel.readyState !== 'open' ||
(typeof frame.valid === 'function' && !frame.valid())
)
) {
this.debugLog?.('viewport_context.skipped', {
reason: 'capture-invalidated',
});
return false;
}
// Keep at most one viewport screenshot in context. Images are the single
// most expensive item (re-billed every turn they linger), so we proactively
@@ -506,6 +515,9 @@ export class RealtimeViewport {
cameraKey: this.readCameraKey(),
}
: null;
this.debugLog?.('viewport_context.result', {
reason: sent ? 'sent' : 'data-channel-send-failed',
});
return sent;
}