Skip to content

Commit 7b07615

Browse files
authored
refactor: clarify message channel validation (#120872)
1 parent 6246f67 commit 7b07615

56 files changed

Lines changed: 344 additions & 341 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/.generated/plugin-sdk-api-baseline.sha256‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ d117ebba8cc490501725778676a9d75855872b6e5fe2b2f64b1270d4808a2277 module/health
7676
f6e3c44e7d1090a97aca554a3c247219b8de78b3cb4399cac5efde8a0a6c1156 module/inbound-envelope
7777
1d5ca69fcf2a8476a2309dcd830fc3bbae04b7029fa30eea1081b6590a789f10 module/inbound-event-delivery
7878
36721c58f479fe9ca32737f67850f4607bf8753ef6b193ff129e7a9e5fdbc6bd module/inbound-reply-dispatch
79-
fe7172bcab3d1adf00e7bcfce6beaea9f3b231df251d5e5ad8dc2d20abd90eca module/infra-runtime
79+
58675872c8985b66cfa32f3a1085bfb6d40c5abbafb3cd59d97b7bdde09dbe1a module/infra-runtime
8080
2e717cccb3db127aed0287d4ea14c41a8e64e46d60c728638153e31e2fb0d296 module/ingress-effect-once
8181
9389d91a090259f06e5ec2aae14c9857e45988d4edc4f91170cb8bc573b966a2 module/interactive-runtime
8282
9dd66baf2def46386ad4706380e57f9068fa9bb3878be2d9ba961ec2f46d3d87 module/json-store
@@ -112,7 +112,7 @@ ac2b199e95c5c8b1e2a65e62bd41d1b6322e531bca294ef4979a297a12640bce module/reply-h
112112
ad69a4a6970cfac86f9379efb927beac898217946d025c3aea55e6f399da08bb module/reply-payload
113113
1f899eb54013f268d6698ce8e6943289ea0e872747e8e868259106829518db86 module/reply-runtime
114114
b4043b356372f6af64ee3c26e4d6a6d623b817e4d95346358dc0e64a3b61d1e0 module/root-walk
115-
97fc4ed1ac6e62b7af95b4352cee3893252d8b691fef71a000c2602b3128541a module/routing
115+
011840eb45317373eefc8505a021c19ef47e7e7f4134c6e411a32ce120ca739f module/routing
116116
ff6cca86f54f94f238205f5b122af36666314e0a380f3ec7f0ccb9ed9208df31 module/run-command
117117
53b0295cec105696a1664c5c7f5576a7b55d197eb95dcd9185486f010bd53750 module/runtime
118118
fcf103d18c1d64ffa9719f1d5a1ca349df3a6125d00c9d54a1b76c195ba8691b module/runtime-config-snapshot

‎scripts/audit-seams.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ function describeSubagentSeamKinds(relativePath, source) {
663663
"./subagent-announce-dispatch.js",
664664
"./subagent-announce-queue.js",
665665
"../infra/outbound/bound-delivery-router.js",
666-
"../utils/delivery-context.js",
666+
"../utils/delivery-context.shared.js",
667667
"../gateway/call.js",
668668
]);
669669
const importsCleanup = hasAnyImportSource(source, [

‎scripts/check-channel-agnostic-boundaries.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const channelCoreProtectedSources = [
2727
path.join(repoRoot, "src", "channels", "thread-bindings-messages.ts"),
2828
path.join(repoRoot, "src", "sessions", "send-policy.ts"),
2929
path.join(repoRoot, "src", "sessions", "session-chat-type-shared.ts"),
30-
path.join(repoRoot, "src", "utils", "delivery-context.ts"),
30+
path.join(repoRoot, "src", "utils", "delivery-context.shared.ts"),
3131
];
3232
const acpUserFacingTextSources = [
3333
path.join(repoRoot, "src", "auto-reply", "reply", "commands-acp"),

‎src/acp/control-plane/manager.background-task.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import {
99
startTaskRunByRunId,
1010
} from "../../tasks/detached-task-runtime.js";
1111
import { resolveRequiredCompletionTerminalResult } from "../../tasks/task-completion-contract.js";
12-
import { deliveryContextFromSession, type DeliveryContext } from "../../utils/delivery-context.js";
12+
import {
13+
deliveryContextFromSession,
14+
type DeliveryContext,
15+
} from "../../utils/delivery-context.shared.js";
1316
import { AcpRuntimeError } from "../runtime/errors.js";
1417
import { ACP_TURN_TIMEOUT_DETAIL_CODE } from "./manager.turn-timeout.js";
1518
import type { AcpSessionManagerDeps } from "./manager.types.js";

‎src/agents/acp-spawn-heartbeat.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { loadSessionEntryReadOnly } from "../config/sessions/session-accessor.js
66
import type { OpenClawConfig } from "../config/types.openclaw.js";
77
import { areHeartbeatsEnabled } from "../infra/heartbeat-wake.js";
88
import { normalizeAgentId, parseAgentSessionKey } from "../routing/session-key.js";
9-
import { deliveryContextFromSession } from "../utils/delivery-context.js";
9+
import { deliveryContextFromSession } from "../utils/delivery-context.shared.js";
1010
import { listAgentEntries } from "./agent-scope-config.js";
1111
import { resolveAgentConfig, resolveDefaultAgentId } from "./agent-scope.js";
1212

‎src/agents/acp-spawn-requester.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { formatErrorMessage } from "../infra/errors.js";
1212
import { getSessionBindingService } from "../infra/outbound/session-binding-service.js";
1313
import { createSubsystemLogger } from "../logging/subsystem.js";
1414
import { isSubagentSessionKey, parseAgentSessionKey } from "../routing/session-key.js";
15-
import { normalizeDeliveryContext } from "../utils/delivery-context.js";
15+
import { normalizeDeliveryContext } from "../utils/delivery-context.shared.js";
1616
import {
1717
hasSessionLocalHeartbeatRelayRoute,
1818
isHeartbeatEnabledForSessionAgent,

‎src/agents/acp-spawn.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
resolveAgentIdFromSessionKey,
3333
} from "../routing/session-key.js";
3434
import { recordSessionCreated, recordSubagentSpawned } from "../sessions/session-state-events.js";
35-
import { deliveryContextFromSession } from "../utils/delivery-context.js";
35+
import { deliveryContextFromSession } from "../utils/delivery-context.shared.js";
3636
import { countUntrackedActiveAcpRunsForOwner } from "./acp-spawn-admission.js";
3737
import {
3838
resolveAcpSpawnBootstrapDeliveryPlan,

‎src/agents/bash-process-registry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { ChildProcessWithoutNullStreams } from "node:child_process";
77
import { sliceUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
88
import type { EventSessionRoutingPolicy } from "../infra/event-session-routing.js";
99
import type { TerminationReason } from "../process/supervisor/types.js";
10-
import type { DeliveryContext } from "../utils/delivery-context.js";
10+
import type { DeliveryContext } from "../utils/delivery-context.shared.js";
1111
import { readEnvInt } from "./bash-tools.shared.js";
1212
import { createSessionSlug as createSessionSlugId } from "./session-slug.js";
1313

‎src/agents/bash-tools.exec-run.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { rejectUnsafeExecControlShellCommand } from "../infra/exec-control-comma
1717
import { resolveExecSafeBinRuntimePolicy } from "../infra/exec-safe-bin-runtime-policy.js";
1818
import { logInfo } from "../logger.js";
1919
import { parseAgentSessionKey, resolveAgentIdFromSessionKey } from "../routing/session-key.js";
20-
import { normalizeDeliveryContext } from "../utils/delivery-context.js";
20+
import { normalizeDeliveryContext } from "../utils/delivery-context.shared.js";
2121
import { markBackgrounded } from "./bash-process-registry.js";
2222
import { describeExecTool } from "./bash-tools.descriptions.js";
2323
import { processGatewayAllowlist } from "./bash-tools.exec-host-gateway.js";

‎src/agents/bash-tools.exec.approval-id.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ vi.mock("../utils/message-channel.js", () => {
7474
};
7575
});
7676

77-
vi.mock("../utils/delivery-context.js", () => ({
77+
vi.mock("../utils/delivery-context.shared.js", () => ({
7878
normalizeDeliveryContext: (context?: {
7979
channel?: string | null;
8080
to?: string | number | null;

0 commit comments

Comments
 (0)