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

推荐订阅源

V
Visual Studio Blog
博客园 - 司徒正美
博客园_首页
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
I
InfoQ
M
MIT News - Artificial intelligence
T
Tailwind CSS Blog
L
LangChain Blog
Last Week in AI
Last Week in AI
A
About on SuperTechFans
B
Blog
博客园 - 叶小钗
雷峰网
雷峰网
H
Help Net Security
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

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(cron): preserve telegram direct thread inference · op...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -3,11 +3,15 @@ import { loadConfig } from "../../config/config.js";

33

import { normalizeCronJobCreate, normalizeCronJobPatch } from "../../cron/normalize.js";

44

import type { CronDelivery, CronMessageChannel } from "../../cron/types.js";

55

import { normalizeHttpWebhookUrl } from "../../cron/webhook-url.js";

6-

import { parseAgentSessionKey } from "../../sessions/session-key-utils.js";

6+

import {

7+

parseAgentSessionKey,

8+

parseThreadSessionSuffix,

9+

} from "../../sessions/session-key-utils.js";

710

import { extractTextFromChatContent } from "../../shared/chat-content.js";

811

import {

912

normalizeLowercaseStringOrEmpty,

1013

normalizeOptionalLowercaseString,

14+

normalizeOptionalString,

1115

} from "../../shared/string-coerce.js";

1216

import { isRecord, truncateUtf16Safe } from "../../utils.js";

1317

import {

@@ -398,12 +402,37 @@ function stripThreadSuffixFromSessionKey(sessionKey: string): string {

398402

return parent ? parent : sessionKey;

399403

}

400404405+

function resolveTelegramDirectThreadId(params: {

406+

peerId: string;

407+

threadId?: string;

408+

}): string | undefined {

409+

const threadId = normalizeOptionalString(params.threadId);

410+

if (!threadId) {

411+

return undefined;

412+

}

413+

const peerId = normalizeOptionalString(params.peerId);

414+

if (!peerId) {

415+

return undefined;

416+

}

417+

const [threadChatId, ...threadIdParts] = threadId.split(":");

418+

if (threadIdParts.length === 0) {

419+

return threadId;

420+

}

421+

if (normalizeOptionalLowercaseString(threadChatId) !== peerId) {

422+

return undefined;

423+

}

424+

return normalizeOptionalString(threadIdParts.join(":"));

425+

}

426+401427

function inferDeliveryFromSessionKey(agentSessionKey?: string): CronDelivery | null {

402428

const rawSessionKey = agentSessionKey?.trim();

403429

if (!rawSessionKey) {

404430

return null;

405431

}

406-

const parsed = parseAgentSessionKey(stripThreadSuffixFromSessionKey(rawSessionKey));

432+

const threadSuffix = parseThreadSessionSuffix(rawSessionKey);

433+

const parsed = parseAgentSessionKey(

434+

threadSuffix.baseSessionKey ?? stripThreadSuffixFromSessionKey(rawSessionKey),

435+

);

407436

if (!parsed || !parsed.rest) {

408437

return null;

409438

}

@@ -444,10 +473,26 @@ function inferDeliveryFromSessionKey(agentSessionKey?: string): CronDelivery | n

444473

channel = normalizeOptionalLowercaseString(parts[0]) as CronMessageChannel | undefined;

445474

}

446475476+

const marker = parts[markerIndex];

447477

const delivery: CronDelivery = { mode: "announce", to: peerId };

448478

if (channel) {

449479

delivery.channel = channel;

450480

}

481+

if (channel === "telegram" && markerIndex === 2) {

482+

const accountId = normalizeOptionalString(parts[1]);

483+

if (accountId) {

484+

delivery.accountId = accountId;

485+

}

486+

}

487+

if (channel === "telegram" && (marker === "direct" || marker === "dm")) {

488+

const threadId = resolveTelegramDirectThreadId({

489+

peerId,

490+

threadId: threadSuffix.threadId,

491+

});

492+

if (threadId) {

493+

delivery.threadId = threadId;

494+

}

495+

}

451496

return delivery;

452497

}

453498