fix: stabilize Telegram draft boundaries and suppress NO_REPLY lead leaks (#33169)

* fix: stabilize telegram draft stream message boundaries

* fix: suppress NO_REPLY lead-fragment leaks

* fix: keep underscore guard for non-NO_REPLY prefixes

* fix: skip assistant-start rotation only after real lane rotation

* fix: preserve finalized state when pre-rotation does not force

* fix: reset finalized preview state on message-start boundary

* fix: document Telegram draft boundary + NO_REPLY reliability updates (#33169) (thanks @obviyus)
This commit is contained in:
Ayaan Zaidi
2026-03-03 22:49:33 +05:30
committed by GitHub
parent a7a9a3d3c8
commit 3d998828b9
8 changed files with 212 additions and 137 deletions

View File

@@ -74,7 +74,8 @@ describe("stripSilentToken", () => {
});
describe("isSilentReplyPrefixText", () => {
it("matches uppercase underscore prefixes", () => {
it("matches uppercase token lead fragments", () => {
expect(isSilentReplyPrefixText("NO")).toBe(true);
expect(isSilentReplyPrefixText("NO_")).toBe(true);
expect(isSilentReplyPrefixText("NO_RE")).toBe(true);
expect(isSilentReplyPrefixText("NO_REPLY")).toBe(true);
@@ -84,9 +85,17 @@ describe("isSilentReplyPrefixText", () => {
it("rejects ambiguous natural-language prefixes", () => {
expect(isSilentReplyPrefixText("N")).toBe(false);
expect(isSilentReplyPrefixText("No")).toBe(false);
expect(isSilentReplyPrefixText("no")).toBe(false);
expect(isSilentReplyPrefixText("Hello")).toBe(false);
});
it("keeps underscore guard for non-NO_REPLY tokens", () => {
expect(isSilentReplyPrefixText("HE", "HEARTBEAT_OK")).toBe(false);
expect(isSilentReplyPrefixText("HEART", "HEARTBEAT_OK")).toBe(false);
expect(isSilentReplyPrefixText("HEARTBEAT", "HEARTBEAT_OK")).toBe(false);
expect(isSilentReplyPrefixText("HEARTBEAT_", "HEARTBEAT_OK")).toBe(true);
});
it("rejects non-prefixes and mixed characters", () => {
expect(isSilentReplyPrefixText("NO_X")).toBe(false);
expect(isSilentReplyPrefixText("NO_REPLY more")).toBe(false);