You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gotoFlow waited once using flowInstance.ctx.options.delay, which contains the final answer's options, and then sent the target answers without applying their individual delays. Consequently, consecutive delayed addAnswer messages could be sent immediately, and the initial wait could use the wrong answer's delay.
Changes
Replace the single flow-level wait with a wait before each target answer.
Use each answer's configured delay, falling back to the bot's general delay exactly like sendFlow.
Strengthen the existing issue regression with two delayed answers and timestamp assertions for both intervals.
No public API or flow-definition changes.
Verification
The strengthened regression failed before the fix because the second answer was not delayed.
Targeted gotoFlow tests: 6/6 passed.
pnpm test: all 29 monorepo test projects passed.
pnpm --filter @builderbot/bot build: passed.
ESLint and Prettier checks for both changed files: passed.
Antes de aprobar, necesitamos corregir una regresi贸n en la interacci贸n entre gotoFlow y el timeout de la cola. La espera por nodo soluciona el problema original, pero ahora las esperas se acumulan dentro del callback de un elemento cuyo timeout sigue corriendo. Si vence, el rechazo puede quedar sin manejar y terminar el proceso; si la aplicaci贸n captura globalmente ese rechazo, el bucle sigue enviando despu茅s de la cancelaci贸n.
Lo reproduje en 29c014603b3cedfaef458b6c13c23b9079746296, compar谩ndolo con la base cb24cf93f0efe7d7d3cc586223115b44f0dc8b4f, con Node 24.19.0 y usando createBot, createFlow, addKeyword y TestTool:
Al enviar start mediante el provider de prueba, la base termina con exit 0; el head termina con exit 1 y Error: Queue item timeout after 450ms.
Con un listener de unhandledRejection para observar la continuaci贸n, el head todav铆a env铆a C despu茅s del timeout, aproximadamente a los 808 ms.
El timeout de 450 ms solo acorta la reproducci贸n; el predeterminado de createBot es 50000 ms. La debilidad de cancelaci贸n ya exist铆a, pero este cambio hace que la misma entrada y configuraci贸n de gotoFlow ahora la active. Los 6 tests de gotoFlow y los 208 tests del paquete pasan, por lo que esa interacci贸n no est谩 cubierta actualmente.
驴Podr铆as mantener la correcci贸n por nodo y agregar un manejo controlado del timeout, propagando y respetando la cancelaci贸n, junto con un test de integraci贸n que exceda el timeout durante gotoFlow? El test deber铆a comprobar que no haya rechazo no manejado ni env铆os posteriores a la cancelaci贸n. Aumentar el timeout solamente no resuelve ese segundo problema. Gracias por trabajar en esta correcci贸n.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Que tipo de Pull Request es?
Descripci贸n
Fixes #877.
gotoFlowwaited once usingflowInstance.ctx.options.delay, which contains the final answer's options, and then sent the target answers without applying their individual delays. Consequently, consecutive delayedaddAnswermessages could be sent immediately, and the initial wait could use the wrong answer's delay.Changes
sendFlow.Verification
gotoFlowtests: 6/6 passed.pnpm test: all 29 monorepo test projects passed.pnpm --filter @builderbot/bot build: passed.