Elffuss BraidHub

utopia-ia/elffuss-code public

Tests: press Stop only once the turn has reached the model

stopqueue.mjs checks that Stop shows "Stopping..." while a turn lets go. It
pressed Stop as soon as the button turned into Stop, but the button does
that when the message enters the queue, before the turn saves its attempt
and takes the inference lock. A stop in that gap stops a message that has
not started, and the app rightly goes straight to "Send" and "Stopped.":
there is no turn to let go. On a loaded machine the gap was long enough,
and a full run failed the English section (2 of 38; the
provider there needs a while to let go after the stop, so "Send" right
after the click means it had not been called).

Sections 5 and 8 now wait until the provider has the message before
pressing Stop, and that wait is a check of its own, so a turn that never
starts fails loudly instead of being measured as something else. Three
reruns: 40 of 40 each.
Changeset6099f7d102e13f24788e20ed0ff988e0578ed6cae4ef6d870f8239aebd629f44
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-11 16:02 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 16:02 +02:00
Parents250949a672a8

Browse the files at this changeset

1 file changed

modified tests/stopqueue.mjs +13 −0
@@ -227,6 +227,14 @@
227227 await p.fill('#prompt', 'otro trabajo largo');
228228 await p.click('#btn-send');
229229 await p.waitForFunction(() => document.getElementById('btn-send').classList.contains('is-stop'), null, { timeout: 5000 }).catch(() => {});
230+// «Parando…» solo existe mientras un turno que YA llegó al modelo se suelta. El
231+// ■ se enciende en cuanto el mensaje entra en la cola, antes de que el turno
232+// guarde su intento y coja el cerrojo; un clic en ese hueco para un mensaje que
233+// aún no ha empezado, y eso pasa a «Enviar» al momento (bien hecho, pero no es
234+// lo que se mide aquí). En una máquina cargada el hueco dura lo bastante para
235+// caer dentro: se espera a que el modelo tenga el mensaje.
236+const empezo5 = await p.waitForFunction(() => window.__prov5.llamadas.length >= 1, null, { timeout: 10000 }).then(() => true, () => false);
237+ok('5 · (premisa) el turno llegó al modelo antes de pulsar ■', empezo5);
230238 // Cada nombre accesible que toma el botón desde aquí hasta «Enviar», en orden.
231239 await p.evaluate(() => {
232240 const b = document.getElementById('btn-send');
@@ -399,7 +407,9 @@
399407 await pe.evaluate(async () => {
400408 window.__dormir = ms => new Promise(r => setTimeout(r, ms));
401409 const conv = await import('/js/conversations.js');
410+ window.__llamadasEn = 0;
402411 conv.setProvider({ name: 'lento-en', chat: async (h, s, cb, signal) => {
412+ window.__llamadasEn++;
403413 for (let i = 0; i < 400; i++) {
404414 if (signal?.aborted) { await window.__dormir(600); throw new DOMException('Stopped', 'AbortError'); }
405415 cb('·'); await window.__dormir(25);
@@ -410,6 +420,9 @@
410420 await pe.fill('#prompt', 'long job');
411421 await pe.click('#btn-send');
412422 await pe.waitForFunction(() => document.getElementById('btn-send').classList.contains('is-stop'), null, { timeout: 5000 }).catch(() => {});
423+ // Como en el 5: que el turno haya llegado al modelo antes de pulsar ■.
424+ const empezo8 = await pe.waitForFunction(() => window.__llamadasEn >= 1, null, { timeout: 10000 }).then(() => true, () => false);
425+ ok('8 · (premisa) el turno llegó al modelo antes de pulsar ■', empezo8);
413426 const trabajando = await boton(pe);
414427 await pe.click('#btn-send');
415428 await pe.waitForTimeout(150);