惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
The Cloudflare Blog
IT之家
IT之家
V
V2EX
雷峰网
雷峰网
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
小众软件
小众软件
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
A
About on SuperTechFans
B
Blog
月光博客
月光博客
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(telegram): avoid duplicate dm chat window context (#8...
sweetcornna · 2026-06-27 · via Recent Commits to openclaw:main
1+

import { describe, expect, it } from "vitest";

2+

import { buildTelegramMessageContextForTest } from "./bot-message-context.test-harness.js";

3+

import type { TelegramPromptContextEntry } from "./bot-message-context.types.js";

4+5+

const telegramChatWindowContext: TelegramPromptContextEntry = {

6+

label: "Conversation context",

7+

source: "telegram",

8+

type: "chat_window",

9+

payload: {

10+

order: "chronological",

11+

relation: "selected_for_current_message",

12+

messages: [

13+

{

14+

message_id: "10",

15+

sender: "Pat",

16+

timestamp_ms: 1_700_000_000_000,

17+

body: "Earlier DM turn already in the transcript",

18+

},

19+

],

20+

},

21+

};

22+23+

describe("buildTelegramMessageContext prompt context", () => {

24+

it("omits Telegram chat-window context for existing unthreaded private DM sessions", async () => {

25+

const ctx = await buildTelegramMessageContextForTest({

26+

message: {

27+

chat: { id: 1234, type: "private", first_name: "Pat" },

28+

from: { id: 1234, first_name: "Pat" },

29+

text: "continue",

30+

},

31+

promptContext: [telegramChatWindowContext],

32+

sessionRuntime: {

33+

readSessionUpdatedAt: ({ sessionKey }) =>

34+

sessionKey === "agent:main:main" ? 1_700_000_000_000 : undefined,

35+

},

36+

});

37+38+

expect(ctx?.ctxPayload.SessionKey).toBe("agent:main:main");

39+

expect(ctx?.ctxPayload.UntrustedStructuredContext).toBeUndefined();

40+

});

41+42+

it("keeps Telegram chat-window context for fresh private DM sessions", async () => {

43+

const ctx = await buildTelegramMessageContextForTest({

44+

message: {

45+

chat: { id: 1234, type: "private", first_name: "Pat" },

46+

from: { id: 1234, first_name: "Pat" },

47+

text: "start",

48+

},

49+

promptContext: [telegramChatWindowContext],

50+

});

51+52+

expect(ctx?.ctxPayload.UntrustedStructuredContext).toEqual([telegramChatWindowContext]);

53+

});

54+55+

it("keeps Telegram chat-window context for existing private DM replies", async () => {

56+

const ctx = await buildTelegramMessageContextForTest({

57+

message: {

58+

chat: { id: 1234, type: "private", first_name: "Pat" },

59+

from: { id: 1234, first_name: "Pat" },

60+

text: "replying with context",

61+

reply_to_message: {

62+

chat: { id: 1234, type: "private", first_name: "Pat" },

63+

from: { id: 1234, first_name: "Pat" },

64+

text: "older referenced turn",

65+

date: 1_700_000_000,

66+

message_id: 10,

67+

},

68+

},

69+

promptContext: [telegramChatWindowContext],

70+

sessionRuntime: {

71+

readSessionUpdatedAt: ({ sessionKey }) =>

72+

sessionKey === "agent:main:main" ? 1_700_000_000_000 : undefined,

73+

},

74+

});

75+76+

expect(ctx?.ctxPayload.UntrustedStructuredContext).toEqual([telegramChatWindowContext]);

77+

});

78+

});