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

推荐订阅源

云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
博客园 - 【当耐特】
H
Help Net Security
腾讯CDC
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
Y
Y Combinator Blog
C
Check Point Blog
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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
refactor: centralize reserved target error checks · openc...
zhangguiping · 2026-06-25 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -11,6 +11,7 @@ import type { OpenClawConfig } from "../../config/types.openclaw.js";

1111

import { formatErrorMessage } from "../../infra/errors.js";

1212

import { stripTargetProviderPrefix } from "../../infra/outbound/channel-target-prefix.js";

1313

import type { OutboundSessionRoute } from "../../infra/outbound/outbound-session.js";

14+

import { isReservedTargetLiteralError } from "../../infra/outbound/target-errors.js";

1415

import type { ResolvedMessagingTarget } from "../../infra/outbound/target-resolver.js";

1516

import { tryResolveLoadedOutboundTarget } from "../../infra/outbound/targets-loaded.js";

1617

import { resolveSessionDeliveryTarget } from "../../infra/outbound/targets-session.js";

@@ -349,7 +350,7 @@ export async function resolveDeliveryTarget(

349350

allowFrom: effectiveAllowFrom,

350351

});

351352

if (!docked.ok) {

352-

if (!toCandidate || !docked.error.message.includes("Reserved target")) {

353+

if (!toCandidate || !isReservedTargetLiteralError(docked.error)) {

353354

return {

354355

ok: false,

355356

channel,

Original file line numberDiff line numberDiff line change

@@ -15,6 +15,7 @@ import {

1515

} from "../../utils/message-channel.js";

1616

import { resolveOutboundChannelPlugin } from "./channel-resolution.js";

1717

import { resolveOutboundSessionRoute } from "./outbound-session.js";

18+

import { isReservedTargetLiteralError } from "./target-errors.js";

1819

import { resolveChannelTarget, type ResolvedMessagingTarget } from "./target-resolver.js";

1920

import type { OutboundTargetResolution } from "./targets.js";

2021

import {

@@ -174,7 +175,7 @@ export async function resolveAgentDeliveryPlanWithSessionRoute(

174175

if (normalizedTarget.ok) {

175176

sessionRouteTarget = normalizedTarget.to;

176177

} else {

177-

if (!normalizedTarget.error.message.includes("Reserved target")) {

178+

if (!isReservedTargetLiteralError(normalizedTarget.error)) {

178179

return { ...plan, targetResolutionError: normalizedTarget.error };

179180

}

180181

const resolvedTarget = await resolveChannelTarget({

Original file line numberDiff line numberDiff line change

@@ -3,8 +3,10 @@ import { describe, expect, it } from "vitest";

33

import {

44

ambiguousTargetError,

55

ambiguousTargetMessage,

6+

isReservedTargetLiteralError,

67

missingTargetError,

78

missingTargetMessage,

9+

reservedTargetLiteralError,

810

unknownTargetError,

911

unknownTargetMessage,

1012

} from "./target-errors.js";

@@ -69,4 +71,13 @@ describe("target error helpers", () => {

6971

"Hint: Use channel:123",

7072

);

7173

});

74+
75+

it("identifies reserved target literal errors", () => {

76+

expect(isReservedTargetLiteralError(reservedTargetLiteralError("Telegram", "current"))).toBe(

77+

true,

78+

);

79+

expect(isReservedTargetLiteralError(new Error('Unknown target "current" for Telegram.'))).toBe(

80+

false,

81+

);

82+

});

7283

});

Original file line numberDiff line numberDiff line change

@@ -48,6 +48,10 @@ export function reservedTargetLiteralError(provider: string, raw: string, hint?:

4848

return new Error(reservedTargetLiteralMessage(provider, raw, hint));

4949

}

5050
51+

export function isReservedTargetLiteralError(error: Error): boolean {

52+

return error.message.includes("Reserved target");

53+

}

54+
5155

function formatTargetHint(hint?: string, withLabel = false): string {

5256

const normalized = hint?.trim();

5357

if (!normalized) {

Original file line numberDiff line numberDiff line change

@@ -27,6 +27,7 @@ import {

2727

resolveOutboundChannelPlugin,

2828

} from "./channel-resolution.js";

2929

import { resolveOutboundSessionRoute } from "./outbound-session.js";

30+

import { isReservedTargetLiteralError } from "./target-errors.js";

3031

import { resolveChannelTarget, type ResolvedMessagingTarget } from "./target-resolver.js";

3132

import {

3233

resolveOutboundTargetWithPlugin,

@@ -361,7 +362,7 @@ export async function resolveHeartbeatDeliveryTargetWithSessionRoute(params: {

361362

})();

362363

if (targetResolution?.ok) {

363364

routeResolvedTarget = targetResolution.target;

364-

} else if (targetResolution?.error.message.includes("Reserved target")) {

365+

} else if (targetResolution && isReservedTargetLiteralError(targetResolution.error)) {

365366

return buildNoHeartbeatDeliveryTarget({

366367

reason: "no-target",

367368

accountId: delivery.accountId,