Conversation
Un turno solo-tool (p. ej. pauseBot) dejaba role=assistant content="" en D1. Anthropic rechaza bloques de texto vacíos y lastN reinyectaba la fila, así que cada turno siguiente fallaba para siempre. Ahora no se persiste ni se envía un reply vacío, y usableHistory omite filas en blanco al armar el historial para que hilos ya envenenados se recuperen solos. Co-authored-by: santmun <santmun@users.noreply.github.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Qué cambia
Un turno solo-tool (sin texto) ya no deja una fila
assistantvacía en D1, y el historial que se manda al LLM omite filas en blanco. Así no se envenena la conversación y las que ya estaban envenenadas se recuperan solas.Por qué
Ticket de soporte #2C233C (Eduardo Cruz, bot v1.0.74).
Cuando el modelo cierra un turno solo con una tool (legítimo:
pauseBot/pauseSuspectedBotpiden no mandar mensaje),SupportAgent.processBufferigual hacíamsgs.append(convId, "assistant", "").lastN(convId, 20)reinyectaba esa fila en cada turno. Anthropic respondemessages: text content blocks must be non-empty→AI_NoOutputGeneratedError→ el cliente ve "Algo falló de mi lado…" para siempre, hasta borrar la fila a mano.Causa verificada en código (no solo hipótesis):
src/agent.tstrasrunLlmTurn.lastNsin filtrarcontentvacío.chunkReply("")produce[""], que Telegram rechaza con 400.Dos capas, porque son dos problemas:
usableHistoryomite filas vacías/whitespace al armar el historial (agente + co-pilot/suggest). Cura hilos ya envenenados sin cirugía en D1.Fuera de alcance (nota del reporter):
pauseSuspectedBotpuede silenciar 24h a un cliente real sin aviso. No se tocó.Cómo lo probaste
pnpm testpasa — 79 files, 567 testspnpm typechecklimpioTests nuevos:
usableHistory/hasMessageTextdropean""y whitespace.processBuffercon texto vacío + tool: no haceappend("assistant", …)nisendReply.streamTextno recibe bloques vacíos./suggesttambién omite filas vacías.Log del turno solo-tool (el engine ahora sale sin persistir ni mandar):
[SupportAgent.processBuffer] tool-only turn, no reply sent, model=claude-haiku-4-5-20251001Checklist
member/(config de cada quien)