Skip to content

Commit 82ff10a

Browse files
committed
test(telegram): cover commentary ownership across streaming modes
1 parent 4a51b97 commit 82ff10a

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

‎extensions/telegram/src/bot-message-dispatch-turn.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,8 @@ export async function runTelegramDispatchTurn(turn: Turn) {
265265
turn.streamMode === "progress" ? turn.commentaryProgressEnabled : undefined,
266266
progressPreambleEnabled: turn.progressPreambleEnabled,
267267
commentaryPayloadsEnabled: turn.progressPreambleEnabled,
268-
// One commentary owner per turn (Slack/Discord parity, #121009):
269-
// core freezes this getter at turn start, so an enabled commentary
270-
// draft and the durable path can never both show the same preamble.
268+
// Read the current getter after core freezes visibility so draft
269+
// and durable commentary cannot both own the same preamble.
271270
shouldDeliverCommentaryPayloads:
272271
turn.streamMode === "progress" && turn.commentaryProgressEnabled
273272
? () => turn.verboseProgressActive()

‎extensions/telegram/src/bot-message-dispatch.progress-updates.test.ts‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -766,20 +766,39 @@ describeTelegramDispatch("dispatchTelegramMessage progress-updates", () => {
766766
},
767767
);
768768

769-
it("omits the durable commentary owner when Telegram commentary progress is disabled", async () => {
769+
it.each([
770+
{
771+
label: "progress commentary is disabled",
772+
streamMode: "progress",
773+
commentary: false,
774+
commentaryPayloadsEnabled: true,
775+
},
776+
{
777+
label: "partial streaming owns the answer preview",
778+
streamMode: "partial",
779+
commentary: true,
780+
commentaryPayloadsEnabled: undefined,
781+
},
782+
{
783+
label: "streaming is disabled",
784+
streamMode: "off",
785+
commentary: true,
786+
commentaryPayloadsEnabled: undefined,
787+
},
788+
] as const)("omits the durable commentary owner when $label", async (scenario) => {
770789
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ replyOptions }) => {
771-
expect(replyOptions?.commentaryPayloadsEnabled).toBe(true);
790+
expect(replyOptions?.commentaryPayloadsEnabled).toBe(scenario.commentaryPayloadsEnabled);
772791
expect(replyOptions?.shouldDeliverCommentaryPayloads).toBeUndefined();
773792
return { queuedFinal: false };
774793
});
775794

776795
await dispatchWithContext({
777796
context: createContext(),
778-
streamMode: "progress",
797+
streamMode: scenario.streamMode,
779798
telegramCfg: {
780799
streaming: {
781-
mode: "progress",
782-
progress: { label: "Shelling" },
800+
mode: scenario.streamMode,
801+
progress: { label: "Shelling", commentary: scenario.commentary },
783802
},
784803
},
785804
});

0 commit comments

Comments
 (0)